Python 3 has a sane super() implementation (no arguments), so convert to using that.

This commit is contained in:
Mike Auty
2016-08-14 00:55:02 +01:00
parent 523e159047
commit e02feed16e
18 changed files with 60 additions and 68 deletions
@@ -8,6 +8,9 @@ class AutomagicInterface(validity.ValidityRoutines, metaclass = ABCMeta):
priority = 10
def __init__(self):
super().__init__()
@abstractmethod
def __call__(self, context, config_path, configurable):
"""Runs the automagic over the configurable"""
@@ -17,7 +17,7 @@ class RequirementInterface(validity.ValidityRoutines, metaclass = ABCMeta):
"""Class to distinguish configuration elements from everything else"""
def __init__(self, name, description = None, default = None, optional = False):
validity.ValidityRoutines.__init__(self)
super().__init__()
self._check_type(name, str)
if CONFIG_SEPARATOR in name:
raise ValueError("Name cannot contain the config-hierarchy divider (" + CONFIG_SEPARATOR + ")")
@@ -88,7 +88,7 @@ class ClassRequirement(RequirementInterface):
"""Requires a specific class"""
def __init__(self, *args, **kwargs):
RequirementInterface.__init__(self, *args, **kwargs)
super().__init__(*args, **kwargs)
self._cls = None
@property
@@ -114,7 +114,7 @@ class ClassRequirement(RequirementInterface):
class ConstructableRequirementInterface(RequirementInterface):
def __init__(self, *args, **kwargs):
RequirementInterface.__init__(self, *args, **kwargs)
super().__init__(*args, **kwargs)
self.add_requirement(ClassRequirement("class", "Class of the translation layer"))
self._current_class_requirements = set()
@@ -171,7 +171,7 @@ class ConfigurableInterface(validity.ValidityRoutines):
def __init__(self, config_path):
"""Basic initializer that allows configurables to access their own config settings"""
validity.ValidityRoutines.__init__(self)
super().__init__()
self._config_path = self._check_type(config_path, str)
@classmethod
+1 -2
View File
@@ -68,8 +68,7 @@ class DataLayerInterface(configuration.ConfigurableInterface, validity.ValidityR
provides = {"type": "interface"}
def __init__(self, context, config_path, name):
configuration.ConfigurableInterface.__init__(self, config_path)
validity.ValidityRoutines.__init__(self)
super().__init__(config_path)
self._context = context
self._check_type(name, str)
self._name = name
+5 -4
View File
@@ -44,10 +44,10 @@ class ObjectInformation(ReadOnlyMapping):
self._check_type(offset, int)
if parent:
self._check_type(parent, ObjectInterface)
ReadOnlyMapping.__init__(self, {'layer_name': layer_name,
'offset': offset,
'member_name': member_name,
'parent': parent})
super().__init__({'layer_name': layer_name,
'offset': offset,
'member_name': member_name,
'parent': parent})
class ObjectInterface(validity.ValidityRoutines, metaclass = ABCMeta):
@@ -124,6 +124,7 @@ class Template(validity.ValidityRoutines):
def __init__(self, type_name, **arguments):
"""Stores the keyword arguments for later use"""
# Allow the updating of template arguments whilst still in template form
super().__init__()
self._vol = collections.ChainMap(arguments, {'type_name': type_name})
@property
+1 -2
View File
@@ -26,8 +26,7 @@ class PluginInterface(configuration_interface.ConfigurableInterface, validity.Va
"""Class that defines the interface all Plugins must maintain"""
def __init__(self, context, config_path):
validity.ValidityRoutines.__init__(self)
configuration_interface.ConfigurableInterface.__init__(self, config_path)
super().__init__(config_path)
self._context = self._check_type(context, context_interface.ContextInterface)
# self.validate()