diff --git a/soitool/modules/code_table_base.py b/soitool/modules/code_table_base.py index b3ed96a03846b36364a857725be725d3ba3b1cf4..8d36d3db30e27bb30b63e5a7bbc96fff48a942c1 100644 --- a/soitool/modules/code_table_base.py +++ b/soitool/modules/code_table_base.py @@ -29,13 +29,16 @@ class CodeTableBase(ModuleBase, QTableWidget, metaclass=Meta): """ def __init__(self, size, data): - if self.type not in [ - AUTHENTICATIONBOARD_MODULE, - SUBTRACTORCODES_MODULE, - ]: + # Disabling pylint-error 'Access to member before its definition line' + # because the variable is defined in subclass. + # pylint: disable=E0203 + if self.start_no_of_codes > self.maximum_no_of_codes: raise ValueError( - "Invalid value for class-variable type: " - "'{}'".format(self.type) + "The value of module-constant 'START_NO_OF_CODES' is larger " + "than module-constant 'MAXIMUM_NO_OF_CODES': " + "{} > {}".format( + self.start_no_of_codes, self.maximum_no_of_codes + ) ) QTableWidget.__init__(self) ModuleBase.__init__(self) diff --git a/soitool/modules/module_authentication_board.py b/soitool/modules/module_authentication_board.py index 76830366c24ec6873b3e616b977c18658e397b48..ca46c80dcfac75cb449104380700fe62e8d24916 100644 --- a/soitool/modules/module_authentication_board.py +++ b/soitool/modules/module_authentication_board.py @@ -23,7 +23,6 @@ CODE_CHARACTER_TYPE = "ascii" # Font for authentication codes, should be a monospaced font CODE_FONT = QtGui.QFont("Consolas", 10, QtGui.QFont.SansSerif) - # Adds space between sets of characters, 0 => no spaces # If code is 123456 and interval is 2, code will be 12 34 56 SPACE_INTERVAL = 5 @@ -60,12 +59,6 @@ class AuthenticationBoardModule(CodeTableBase): def __init__(self, size=None, data=None): self.type = "AuthenticationBoardModule" - if START_NO_OF_CODES > MAXIMUM_NO_OF_CODES: - raise ValueError( - "Invalid value for CONSTANT 'START_NO_OF_CODES': " - "'{}'".format(START_NO_OF_CODES) - ) - if CODE_CHARACTER_TYPE == "ascii": self.code_characters = string.ascii_uppercase elif CODE_CHARACTER_TYPE == "digits": diff --git a/soitool/modules/module_subtractorcodes.py b/soitool/modules/module_subtractorcodes.py index 6692b2fb0ba164eda307b1c00547092bc85ffcfc..68727c3757d1cd3d78cca999dd89f61dad090143 100644 --- a/soitool/modules/module_subtractorcodes.py +++ b/soitool/modules/module_subtractorcodes.py @@ -50,11 +50,6 @@ class SubtractorcodesModule(CodeTableBase): def __init__(self, size=None, data=None): self.type = "SubtractorcodesModule" - if START_NO_OF_CODES > MAXIMUM_NO_OF_CODES: - raise ValueError( - "Invalid value for CONSTANT 'START_NO_OF_CODES': " - "'{}'".format(START_NO_OF_CODES) - ) self.code_character_type = "digits" self.code_font = CODE_FONT self.maximum_no_of_codes = MAXIMUM_NO_OF_CODES