Refactor the validity function names to make it easier for autocomplete to find.

This commit is contained in:
Mike Auty
2015-12-29 22:24:32 +00:00
parent 595e2faeb4
commit bcbfee9016
14 changed files with 29 additions and 29 deletions
@@ -38,7 +38,7 @@ class ConfigurationSchemaNode(validity.ValidityRoutines):
def __init__(self, name, description = None, default = None, optional = False):
validity.ValidityRoutines.__init__(self)
self._type_check(name, str)
self._check_type(name, str)
if SCHEMA_NAME_DIVIDER in name:
raise ValueError("Name cannot contain the namespace divider (" + SCHEMA_NAME_DIVIDER + ")")
self._name = name
+1 -1
View File
@@ -58,7 +58,7 @@ class ContextModifierInterface(validity.ValidityRoutines, metaclass = ABCMeta):
:param namespace: Specifies the namespace for all configuration options to be specified under
:type namespace: str
"""
self.namespace = self._type_check(namespace, str)
self.namespace = self._check_type(namespace, str)
def config_get(self, context):
return context.config[self.namespace]
+2 -2
View File
@@ -15,8 +15,8 @@ class DataLayerInterface(validity.ValidityRoutines, configuration.Configurable,
"""A Layer that directly holds data (and does not translate it"""
def __init__(self, context, name):
self._type_check(name, str)
self._type_check(context, context_module.ContextInterface)
self._check_type(name, str)
self._check_type(context, context_module.ContextInterface)
self._name = name
self._context = context
+4 -4
View File
@@ -41,9 +41,9 @@ class ObjectInformation(ReadOnlyMapping):
"""Contains information useful/pertinent only to an individual object (like an instance)"""
def __init__(self, layer_name, offset, member_name = None, parent = None):
self._type_check(offset, int)
self._check_type(offset, int)
if parent:
self._type_check(parent, ObjectInterface)
self._check_type(parent, ObjectInterface)
ReadOnlyMapping.__init__(self, {'layer_name': layer_name,
'offset': offset,
'member_name': member_name,
@@ -57,8 +57,8 @@ class ObjectInterface(validity.ValidityRoutines, metaclass = ABCMeta):
# Since objects are likely to be instantiated often,
# we're only checking that context, offset and parent
# Everything else may be wrong, but that will get caught later on
self._type_check(context, context_module.ContextInterface)
self._type_check(object_info, ObjectInformation)
self._check_type(context, context_module.ContextInterface)
self._check_type(object_info, ObjectInformation)
# Add an empty dictionary at the start to allow objects to add their own data to the vol object
#
+1 -1
View File
@@ -26,7 +26,7 @@ class PluginInterface(validity.ValidityRoutines, interfaces.configuration.Config
"""Class that defines the interface all Plugins must maintain"""
def __init__(self, context):
self._type_check(context, interfaces.context.ContextInterface)
self._check_type(context, interfaces.context.ContextInterface)
self._context = context
self.validate_inputs()
+3 -3
View File
@@ -11,9 +11,9 @@ class SymbolTableInterface(validity.ValidityRoutines):
"""Handles a table of symbols"""
def __init__(self, name, native_structures = None):
self._type_check(native_structures, NativeTableInterface)
self._check_type(native_structures, NativeTableInterface)
if name:
self._type_check(name, str)
self._check_type(name, str)
self.name = name or None
self._native_structures = native_structures
@@ -58,7 +58,7 @@ class SymbolTableInterface(validity.ValidityRoutines):
WARNING: This allows changing the underlying size of all the other structures referenced in the symbolspace
"""
self._type_check(value, NativeTableInterface)
self._check_type(value, NativeTableInterface)
self._native_structures = value
# ## Functions for overriding classes