diff options
author | Akihiro Motoki <amotoki@gmail.com> | 2020-09-15 14:08:17 +0900 |
---|---|---|
committer | Akihiro Motoki <amotoki@gmail.com> | 2020-10-15 14:37:20 +0900 |
commit | e5d09edc205d70ffc315b5f0ae687b356f0833b9 (patch) | |
tree | 6358a96c95ce61c3100a09d48a89aabb4b8882f2 /openstack_dashboard/utils | |
parent | 74df97f57cbc4d69e34b5bf2ee20a9836c929dc9 (diff) | |
download | horizon-e5d09edc205d70ffc315b5f0ae687b356f0833b9.tar.gz |
Use python3-style super()
In python3, super() does not always require a class and self reference.
In other words, super() is enough for most cases.
This is much simpler and it is time to switch it to the newer style.
pylint provides a check for this.
Let's enable 'super-with-arguments' check.
NOTE: _prepare_mappings() method of FormRegion in
openstack_dashboard/test/integration_tests/regions/forms.py is refactored.
super() (without explicit class and self referece) does not work when
a subclass method calls a same method in a parent class multiple times.
It looks better to prepare a separate method to provide a common logic.
Change-Id: Id9512a14be9f20dbd5ebd63d446570c7b7c825ff
Diffstat (limited to 'openstack_dashboard/utils')
-rw-r--r-- | openstack_dashboard/utils/config_types.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/openstack_dashboard/utils/config_types.py b/openstack_dashboard/utils/config_types.py index 90619c0aa..5eae5760a 100644 --- a/openstack_dashboard/utils/config_types.py +++ b/openstack_dashboard/utils/config_types.py @@ -31,7 +31,7 @@ class Maybe(types.ConfigType): def __init__(self, type_): self.type_ = type_ type_name = getattr(type_, 'type_name', 'unknown value') - super(Maybe, self).__init__('optional %s' % type_name) + super().__init__('optional %s' % type_name) def __call__(self, value): if value is None: @@ -50,7 +50,7 @@ class URL(types.ConfigType): CLEAN_SLASH_RE = re.compile(r'(?<!:)//') def __init__(self): - super(URL, self).__init__('web URL') + super().__init__('web URL') def __call__(self, value): if not isinstance(value, str): @@ -68,7 +68,7 @@ class Path(types.ConfigType): """A custom option type for a path to file.""" def __init__(self): - super(Path, self).__init__('filesystem path') + super().__init__('filesystem path') def __call__(self, value): if not isinstance(value, str): @@ -84,7 +84,7 @@ class Translate(types.ConfigType): def __init__(self, hint=None): self.hint = hint - super(Translate, self).__init__('translatable string') + super().__init__('translatable string') def __call__(self, value): if not isinstance(value, str): @@ -101,7 +101,7 @@ class Literal(types.ConfigType): def __init__(self, spec=None): self.spec = spec - super(Literal, self).__init__('python literal') + super().__init__('python literal') def __call__(self, value): if isinstance(value, str): @@ -194,7 +194,7 @@ class Importable(types.ConfigType): """A custom option type for an importable python object.""" def __init__(self): - super(Importable, self).__init__('importable python object') + super().__init__('importable python object') def __call__(self, value): if not isinstance(value, str): |