This commit is contained in:
Emmanuel Garette 2021-01-19 19:28:29 +01:00
parent 925c94c63e
commit 74898b1ed7
11 changed files with 21 additions and 22 deletions

View file

@ -9,7 +9,7 @@ from .fill import FillAnnotator
from .family import FamilyAnnotator, modes from .family import FamilyAnnotator, modes
from .property import PropertyAnnotator from .property import PropertyAnnotator
class SpaceAnnotator: class SpaceAnnotator: # pylint: disable=R0903
"""Transformations applied on a CreoleObjSpace instance """Transformations applied on a CreoleObjSpace instance
""" """
def __init__(self, objectspace, eosfunc_file): def __init__(self, objectspace, eosfunc_file):

View file

@ -28,7 +28,7 @@ class CheckAnnotator:
self.check_change_warning() self.check_change_warning()
self.convert_check() self.convert_check()
def check_check(self): def check_check(self): # pylint: disable=R0912
"""valid and manage <check> """valid and manage <check>
""" """
remove_indexes = [] remove_indexes = []
@ -46,7 +46,7 @@ class CheckAnnotator:
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
msg = _(f'the target "{check.target}" in check cannot be a dynamic ' msg = _(f'the target "{check.target}" in check cannot be a dynamic '
f'variable in {xmlfiles}') f'variable in {xmlfiles}')
raise DictConsistencyError(msg, 22) raise DictConsistencyError(msg, 22) from err
raise err raise err
check.is_in_leadership = self.objectspace.paths.is_in_leadership(check_name) check.is_in_leadership = self.objectspace.paths.is_in_leadership(check_name)
if not hasattr(check, 'param'): if not hasattr(check, 'param'):

View file

@ -103,7 +103,7 @@ class Conditionnnotator:
if not target.optional: if not target.optional:
xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles) xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles)
msg = f'cannot found target "{target.name}" in the condition in {xmlfiles}' msg = f'cannot found target "{target.name}" in the condition in {xmlfiles}'
raise DictConsistencyError(_(msg), 12) raise DictConsistencyError(_(msg), 12) from err
remove_targets.append(index) remove_targets.append(index)
remove_targets.sort(reverse=True) remove_targets.sort(reverse=True)
for index in remove_targets: for index in remove_targets:
@ -209,7 +209,7 @@ class Conditionnnotator:
xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles) xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles)
msg = _(f'the source "{condition.source}" in condition cannot be a dynamic ' msg = _(f'the source "{condition.source}" in condition cannot be a dynamic '
f'variable in {xmlfiles}') f'variable in {xmlfiles}')
raise DictConsistencyError(msg, 20) raise DictConsistencyError(msg, 20) from err
def check_choice_option_condition(self): def check_choice_option_condition(self):
"""remove condition for ChoiceOption that don't have param """remove condition for ChoiceOption that don't have param

View file

@ -8,7 +8,7 @@ from ..error import DictConsistencyError
modes_level = ('basic', 'normal', 'expert') modes_level = ('basic', 'normal', 'expert')
class Mode: class Mode: # pylint: disable=R0903
"""Class to manage mode level """Class to manage mode level
""" """
def __init__(self, def __init__(self,

View file

@ -177,7 +177,7 @@ class ServiceAnnotator:
value, value,
xmlfiles, xmlfiles,
path, path,
): ): # pylint: disable=R0913
variable = self.objectspace.variable(xmlfiles) variable = self.objectspace.variable(xmlfiles)
variable.name = normalize_family(key) variable.name = normalize_family(key)
variable.mode = None variable.mode = None

View file

@ -1,7 +1,6 @@
"""Annotate variable """Annotate variable
""" """
from ..utils import normalize_family from ..utils import normalize_family
from ..config import Config
CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int), CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
@ -44,7 +43,7 @@ FORCE_CHOICE = {'schedule': ['none', 'daily', 'weekly', 'monthly'],
RENAME_ATTIBUTES = {'description': 'doc'} RENAME_ATTIBUTES = {'description': 'doc'}
class VariableAnnotator: class VariableAnnotator: # pylint: disable=R0903
"""Annotate variable """Annotate variable
""" """
def __init__(self, def __init__(self,

View file

@ -149,7 +149,7 @@ class RougailObjSpace:
redefine_variables, redefine_variables,
) )
def _xml_parse(self, def _xml_parse(self, # pylint: disable=R0913
xmlfile, xmlfile,
document, document,
space, space,
@ -211,7 +211,7 @@ class RougailObjSpace:
space, space,
namespace, namespace,
redefine_variables, redefine_variables,
): ): # pylint: disable=R0913
""" """
retrieves or creates Rougail Object Subspace objects retrieves or creates Rougail Object Subspace objects
""" """
@ -256,7 +256,7 @@ class RougailObjSpace:
name, name,
namespace, namespace,
redefine_variables, redefine_variables,
): ): # pylint: disable=R0913
"""A redefinable object could be created or updated """A redefinable object could be created or updated
""" """
existed_var = self.get_existed_obj(name, existed_var = self.get_existed_obj(name,

View file

@ -110,7 +110,7 @@ class Path:
return leadership.variable[0].path == path return leadership.variable[0].path == path
# Variable # Variable
def add_variable(self, def add_variable(self, # pylint: disable=R0913
namespace: str, namespace: str,
name: str, name: str,
family: str, family: str,

View file

@ -44,12 +44,12 @@ def cl_compile(kls, *args, **kwargs):
'commentEndToken' : 'µ' * 10, 'commentEndToken' : 'µ' * 10,
'multiLineCommentStartToken' : 'µ' * 10, 'multiLineCommentStartToken' : 'µ' * 10,
'multiLineCommentEndToken' : 'µ' * 10} 'multiLineCommentEndToken' : 'µ' * 10}
return kls.old_compile(*args, **kwargs) return kls.old_compile(*args, **kwargs) # pylint: disable=E1101
ChtTemplate.old_compile = ChtTemplate.compile ChtTemplate.old_compile = ChtTemplate.compile
ChtTemplate.compile = cl_compile ChtTemplate.compile = cl_compile
class CheetahTemplate(ChtTemplate): class CheetahTemplate(ChtTemplate): # pylint: disable=W0223
"""Construct a cheetah templating object """Construct a cheetah templating object
""" """
def __init__(self, def __init__(self,
@ -200,7 +200,7 @@ class CreoleExtra:
class CreoleTemplateEngine: class CreoleTemplateEngine:
"""Engine to process Creole cheetah template """Engine to process Creole cheetah template
""" """
def __init__(self, def __init__(self, # pylint: disable=R0913
config: Config, config: Config,
eosfunc_file: str, eosfunc_file: str,
distrib_dir: str, distrib_dir: str,
@ -278,10 +278,10 @@ class CreoleTemplateEngine:
except CheetahNotFound as err: # pragma: no cover except CheetahNotFound as err: # pragma: no cover
varname = err.args[0][13:-1] varname = err.args[0][13:-1]
msg = f"Error: unknown variable used in template {source} to {destfilename}: {varname}" msg = f"Error: unknown variable used in template {source} to {destfilename}: {varname}"
raise TemplateError(_(msg)) raise TemplateError(_(msg)) from err
except Exception as err: # pragma: no cover except Exception as err: # pragma: no cover
msg = _(f"Error while instantiating template {source} to {destfilename}: {err}") msg = _(f"Error while instantiating template {source} to {destfilename}: {err}")
raise TemplateError(msg) raise TemplateError(msg) from err
with open(destfilename, 'w') as file_h: with open(destfilename, 'w') as file_h:
file_h.write(data) file_h.write(data)

View file

@ -11,7 +11,7 @@ FORCE_INFORMATIONS = ['help', 'test', 'manage']
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi') ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi')
class Root(): class Root(): # pylint: disable=R0903
"""Root classes """Root classes
""" """
path = '.' path = '.'
@ -57,7 +57,7 @@ class TiramisuReflector:
elt, elt,
) )
# parse object # parse object
baseelt.reflector_object.get() baseelt.reflector_object.get() # pylint: disable=E1101
@staticmethod @staticmethod
def reorder_family(space): def reorder_family(space):
@ -162,7 +162,7 @@ class TiramisuReflector:
return '\n'.join(self.text) return '\n'.join(self.text)
class BaseElt: class BaseElt: # pylint: disable=R0903
"""Base element """Base element
""" """
name = 'baseoption' name = 'baseoption'

View file

@ -38,7 +38,7 @@ class XMLReflector:
try: try:
document = parse(xmlfile) document = parse(xmlfile)
except XMLSyntaxError as err: except XMLSyntaxError as err:
raise DictConsistencyError(_(f'{xmlfile} is not an XML file: {err}'), 52) raise DictConsistencyError(_(f'{xmlfile} is not an XML file: {err}'), 52) from err
if not self.dtd.validate(document): if not self.dtd.validate(document):
dtd_error = self.dtd.error_log.filter_from_errors()[0] dtd_error = self.dtd.error_log.filter_from_errors()[0]
msg = _(f'"{xmlfile}" not a valid XML file: {dtd_error}') msg = _(f'"{xmlfile}" not a valid XML file: {dtd_error}')