Commit 2afd4339 authored by Piotr Batko's avatar Piotr Batko
Browse files

Workaround Pylint crash problem

parent 7834b366
......@@ -10,6 +10,11 @@ if TYPE_CHECKING:
class Context:
# Member _names should be private (__names), but when it is, Pylint crashes.
# Issue is reported and can be tracked here: https://github.com/PyCQA/pylint/issues/6709.
#
# When issue will be resolved, make `_names` member private.
DEFAULT_CURRENT_DIRECTORY = Path('./generated').absolute()
def __init__(self, *, parent: Optional[Context]):
......@@ -20,12 +25,12 @@ class Context:
if self.__parent is not None:
self.__current_directory = self.__parent.get_current_directory()
self.__logger = self.__parent.get_logger()
self.__names = Names(parent=self.__parent.__names) # pylint: disable=protected-access
self._names = Names(parent=self.__parent._names) # pylint: disable=protected-access
# Accessing another instance private member of the same class is not a privacy violation.
else:
self.__current_directory = self.DEFAULT_CURRENT_DIRECTORY
self.__logger = None
self.__names = Names()
self._names = Names()
def get_current_directory(self) -> Path:
return self.__current_directory
......@@ -40,4 +45,4 @@ class Context:
self.__logger = logger
def get_names(self) -> Names:
return self.__names
return self._names
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment