pylint
This commit is contained in:
parent
925c94c63e
commit
74898b1ed7
@ -9,7 +9,7 @@ from .fill import FillAnnotator
|
||||
from .family import FamilyAnnotator, modes
|
||||
from .property import PropertyAnnotator
|
||||
|
||||
class SpaceAnnotator:
|
||||
class SpaceAnnotator: # pylint: disable=R0903
|
||||
"""Transformations applied on a CreoleObjSpace instance
|
||||
"""
|
||||
def __init__(self, objectspace, eosfunc_file):
|
||||
|
@ -28,7 +28,7 @@ class CheckAnnotator:
|
||||
self.check_change_warning()
|
||||
self.convert_check()
|
||||
|
||||
def check_check(self):
|
||||
def check_check(self): # pylint: disable=R0912
|
||||
"""valid and manage <check>
|
||||
"""
|
||||
remove_indexes = []
|
||||
@ -46,7 +46,7 @@ class CheckAnnotator:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
|
||||
msg = _(f'the target "{check.target}" in check cannot be a dynamic '
|
||||
f'variable in {xmlfiles}')
|
||||
raise DictConsistencyError(msg, 22)
|
||||
raise DictConsistencyError(msg, 22) from err
|
||||
raise err
|
||||
check.is_in_leadership = self.objectspace.paths.is_in_leadership(check_name)
|
||||
if not hasattr(check, 'param'):
|
||||
|
@ -103,7 +103,7 @@ class Conditionnnotator:
|
||||
if not target.optional:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(condition.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.sort(reverse=True)
|
||||
for index in remove_targets:
|
||||
@ -209,7 +209,7 @@ class Conditionnnotator:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles)
|
||||
msg = _(f'the source "{condition.source}" in condition cannot be a dynamic '
|
||||
f'variable in {xmlfiles}')
|
||||
raise DictConsistencyError(msg, 20)
|
||||
raise DictConsistencyError(msg, 20) from err
|
||||
|
||||
def check_choice_option_condition(self):
|
||||
"""remove condition for ChoiceOption that don't have param
|
||||
|
@ -8,7 +8,7 @@ from ..error import DictConsistencyError
|
||||
modes_level = ('basic', 'normal', 'expert')
|
||||
|
||||
|
||||
class Mode:
|
||||
class Mode: # pylint: disable=R0903
|
||||
"""Class to manage mode level
|
||||
"""
|
||||
def __init__(self,
|
||||
|
@ -177,7 +177,7 @@ class ServiceAnnotator:
|
||||
value,
|
||||
xmlfiles,
|
||||
path,
|
||||
):
|
||||
): # pylint: disable=R0913
|
||||
variable = self.objectspace.variable(xmlfiles)
|
||||
variable.name = normalize_family(key)
|
||||
variable.mode = None
|
||||
|
@ -1,7 +1,6 @@
|
||||
"""Annotate variable
|
||||
"""
|
||||
from ..utils import normalize_family
|
||||
from ..config import Config
|
||||
|
||||
|
||||
CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
||||
@ -44,7 +43,7 @@ FORCE_CHOICE = {'schedule': ['none', 'daily', 'weekly', 'monthly'],
|
||||
RENAME_ATTIBUTES = {'description': 'doc'}
|
||||
|
||||
|
||||
class VariableAnnotator:
|
||||
class VariableAnnotator: # pylint: disable=R0903
|
||||
"""Annotate variable
|
||||
"""
|
||||
def __init__(self,
|
||||
|
@ -149,7 +149,7 @@ class RougailObjSpace:
|
||||
redefine_variables,
|
||||
)
|
||||
|
||||
def _xml_parse(self,
|
||||
def _xml_parse(self, # pylint: disable=R0913
|
||||
xmlfile,
|
||||
document,
|
||||
space,
|
||||
@ -211,7 +211,7 @@ class RougailObjSpace:
|
||||
space,
|
||||
namespace,
|
||||
redefine_variables,
|
||||
):
|
||||
): # pylint: disable=R0913
|
||||
"""
|
||||
retrieves or creates Rougail Object Subspace objects
|
||||
"""
|
||||
@ -256,7 +256,7 @@ class RougailObjSpace:
|
||||
name,
|
||||
namespace,
|
||||
redefine_variables,
|
||||
):
|
||||
): # pylint: disable=R0913
|
||||
"""A redefinable object could be created or updated
|
||||
"""
|
||||
existed_var = self.get_existed_obj(name,
|
||||
|
@ -110,7 +110,7 @@ class Path:
|
||||
return leadership.variable[0].path == path
|
||||
|
||||
# Variable
|
||||
def add_variable(self,
|
||||
def add_variable(self, # pylint: disable=R0913
|
||||
namespace: str,
|
||||
name: str,
|
||||
family: str,
|
||||
|
@ -44,12 +44,12 @@ def cl_compile(kls, *args, **kwargs):
|
||||
'commentEndToken' : 'µ' * 10,
|
||||
'multiLineCommentStartToken' : 'µ' * 10,
|
||||
'multiLineCommentEndToken' : 'µ' * 10}
|
||||
return kls.old_compile(*args, **kwargs)
|
||||
return kls.old_compile(*args, **kwargs) # pylint: disable=E1101
|
||||
ChtTemplate.old_compile = ChtTemplate.compile
|
||||
ChtTemplate.compile = cl_compile
|
||||
|
||||
|
||||
class CheetahTemplate(ChtTemplate):
|
||||
class CheetahTemplate(ChtTemplate): # pylint: disable=W0223
|
||||
"""Construct a cheetah templating object
|
||||
"""
|
||||
def __init__(self,
|
||||
@ -200,7 +200,7 @@ class CreoleExtra:
|
||||
class CreoleTemplateEngine:
|
||||
"""Engine to process Creole cheetah template
|
||||
"""
|
||||
def __init__(self,
|
||||
def __init__(self, # pylint: disable=R0913
|
||||
config: Config,
|
||||
eosfunc_file: str,
|
||||
distrib_dir: str,
|
||||
@ -278,10 +278,10 @@ class CreoleTemplateEngine:
|
||||
except CheetahNotFound as err: # pragma: no cover
|
||||
varname = err.args[0][13:-1]
|
||||
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
|
||||
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:
|
||||
file_h.write(data)
|
||||
|
@ -11,7 +11,7 @@ FORCE_INFORMATIONS = ['help', 'test', 'manage']
|
||||
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi')
|
||||
|
||||
|
||||
class Root():
|
||||
class Root(): # pylint: disable=R0903
|
||||
"""Root classes
|
||||
"""
|
||||
path = '.'
|
||||
@ -57,7 +57,7 @@ class TiramisuReflector:
|
||||
elt,
|
||||
)
|
||||
# parse object
|
||||
baseelt.reflector_object.get()
|
||||
baseelt.reflector_object.get() # pylint: disable=E1101
|
||||
|
||||
@staticmethod
|
||||
def reorder_family(space):
|
||||
@ -162,7 +162,7 @@ class TiramisuReflector:
|
||||
return '\n'.join(self.text)
|
||||
|
||||
|
||||
class BaseElt:
|
||||
class BaseElt: # pylint: disable=R0903
|
||||
"""Base element
|
||||
"""
|
||||
name = 'baseoption'
|
||||
|
@ -38,7 +38,7 @@ class XMLReflector:
|
||||
try:
|
||||
document = parse(xmlfile)
|
||||
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):
|
||||
dtd_error = self.dtd.error_log.filter_from_errors()[0]
|
||||
msg = _(f'"{xmlfile}" not a valid XML file: {dtd_error}')
|
||||
|
Loading…
Reference in New Issue
Block a user