fix quality warnings

This commit is contained in:
cclecle
2023-03-26 20:34:45 +01:00
parent 1be6751d5c
commit 8a01ad04bb
2 changed files with 6 additions and 6 deletions

View File

@@ -1,2 +1,3 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
encoding//src/pychangelogfactory/changelogfactory.py=utf-8
encoding/<project>=UTF-8 encoding/<project>=UTF-8

View File

@@ -94,7 +94,7 @@ def _ChangelogFormaterRecordType(Klass: Type[T_ChangelogFormater]) -> Type[T_Cha
Klass: class to register in the factory Klass: class to register in the factory
Returns: Returns:
untouched class""" untouched class"""
cast(ChangelogFactory[ChangelogFormater], ChangelogFactory)._ar_SavedFormaterKlass.add(Klass) cast(ChangelogFactory[ChangelogFormater], ChangelogFactory).ar_SavedFormaterKlass.add(Klass)
return ChangelogFormaterRecordType(Klass) return ChangelogFormaterRecordType(Klass)
@@ -198,7 +198,7 @@ class ChangelogFormater(ABC):
class ChangelogFactory(Generic[T_ChangelogFormater]): class ChangelogFactory(Generic[T_ChangelogFormater]):
"""The main changelog class""" """The main changelog class"""
_ar_SavedFormaterKlass: ClassVar[_ChangelogFormatersCtx[ChangelogFormater]] = _ChangelogFormatersCtx[ChangelogFormater]() ar_SavedFormaterKlass: ClassVar[_ChangelogFormatersCtx[ChangelogFormater]] = _ChangelogFormatersCtx[ChangelogFormater]()
ar_FormaterKlass: _ChangelogFormatersCtx[T_ChangelogFormater] = _ChangelogFormatersCtx[T_ChangelogFormater]() ar_FormaterKlass: _ChangelogFormatersCtx[T_ChangelogFormater] = _ChangelogFormatersCtx[T_ChangelogFormater]()
ar_Formater: Dict[str, T_ChangelogFormater] = {} ar_Formater: Dict[str, T_ChangelogFormater] = {}
@@ -228,7 +228,7 @@ class ChangelogFactory(Generic[T_ChangelogFormater]):
self for convenience self for convenience
""" """
self.ar_FormaterKlass: T_ChangelogFormater = deepcopy( self.ar_FormaterKlass: T_ChangelogFormater = deepcopy(
cast(_ChangelogFormatersCtx[T_ChangelogFormater], ChangelogFactory._ar_SavedFormaterKlass) cast(_ChangelogFormatersCtx[T_ChangelogFormater], ChangelogFactory.ar_SavedFormaterKlass)
) )
self.ar_Formater = {} self.ar_Formater = {}
for FormaterKlass in self.ar_FormaterKlass.get(): for FormaterKlass in self.ar_FormaterKlass.get():
@@ -247,8 +247,7 @@ class ChangelogFactory(Generic[T_ChangelogFormater]):
@classmethod @classmethod
def ResetBaseFormaterList(cls) -> None: def ResetBaseFormaterList(cls) -> None:
"""Reset the formater class list to original (BaseClass wise)""" """Reset the formater class list to original (BaseClass wise)"""
cls.ar_FormaterKlass = deepcopy(cls._ar_SavedFormaterKlass) cls.ar_FormaterKlass = deepcopy(cls.ar_SavedFormaterKlass)
return None
def RegisterFormater(self, FormaterKlass: Type[T_ChangelogFormater]) -> ChangelogFactory[T_ChangelogFormater]: def RegisterFormater(self, FormaterKlass: Type[T_ChangelogFormater]) -> ChangelogFactory[T_ChangelogFormater]:
"""Register a new formater in the current instance """Register a new formater in the current instance
@@ -442,7 +441,7 @@ for RecordType, Config in {
) )
globals()[_name] = _tmp globals()[_name] = _tmp
cast(ChangelogFactory[ChangelogFormater], ChangelogFactory).RegisterBaseFormater(_tmp) cast(ChangelogFactory[ChangelogFormater], ChangelogFactory).RegisterBaseFormater(_tmp)
cast(ChangelogFactory[ChangelogFormater], ChangelogFactory)._ar_SavedFormaterKlass.add(_tmp) cast(ChangelogFactory[ChangelogFormater], ChangelogFactory).ar_SavedFormaterKlass.add(_tmp)
@_ChangelogFormaterRecordType @_ChangelogFormaterRecordType