Skip to content

Commit

Permalink
chore: fix pylint 'invalid-name' issues (#712)
Browse files Browse the repository at this point in the history
  • Loading branch information
miltolstoy authored Mar 27, 2022
1 parent 5f98c78 commit 96cb237
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions universum/configuration_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,10 @@ def stringify_command(self) -> bool:
return result


DictType = TypeVar('DictType', bound=dict)
DictTypeT = TypeVar('DictTypeT', bound=dict)


def combine(dictionary_a: DictType, dictionary_b: DictType) -> DictType:
def combine(dictionary_a: DictTypeT, dictionary_b: DictTypeT) -> DictTypeT:
# TODO: move to utils, as this is no longer specific to configurations
"""
Combine two dictionaries using plus operator for matching keys
Expand Down
16 changes: 8 additions & 8 deletions universum/lib/gravity.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ def __new__(cls: Type['Module'], main_settings: 'HasModulesMapping', *args, **kw
return instance


ComponentType = TypeVar('ComponentType', bound=Module)
ComponentTypeT = TypeVar('ComponentTypeT', bound=Module)


def construct_component(cls: Type[ComponentType], main_settings: 'HasModulesMapping', *args, **kwargs) -> ComponentType:
def construct_component(cls: Type[ComponentTypeT], main_settings: 'HasModulesMapping', *args, **kwargs) -> ComponentTypeT:
if not getattr(main_settings, "active_modules", None):
main_settings.active_modules = {}

Expand All @@ -86,21 +86,21 @@ def construct_component(cls: Type[ComponentType], main_settings: 'HasModulesMapp
# noinspection PyArgumentList
instance.__init__(*args, **kwargs) # type: ignore
main_settings.active_modules[cls] = instance
return cast(ComponentType, main_settings.active_modules[cls])
return cast(ComponentTypeT, main_settings.active_modules[cls])


DependencyType = TypeVar('DependencyType', bound=Module)
DependencyTypeT = TypeVar('DependencyTypeT', bound=Module)


class Dependency(Generic[DependencyType]):
def __init__(self, cls: Type[DependencyType]) -> None:
class Dependency(Generic[DependencyTypeT]):
def __init__(self, cls: Type[DependencyTypeT]) -> None:
self.cls = cls

# The source and the target of the dependency are different modules,
# so we need to use different type variables to annotate them.
# instance parameter of the __get__ method is source module.
def __get__(self, instance: Module, owner: Any) -> Callable[..., DependencyType]:
def constructor_function(*args, **kwargs) -> DependencyType:
def __get__(self, instance: Module, owner: Any) -> Callable[..., DependencyTypeT]:
def constructor_function(*args, **kwargs) -> DependencyTypeT:
return construct_component(self.cls, instance.main_settings, *args, **kwargs)
return constructor_function

Expand Down

0 comments on commit 96cb237

Please sign in to comment.