__init__
PYL-W0201249
250 def __enter__(self) -> Optional[Context]:
251 global current # This is OK, skipcq: PYL-W0603
252 self.old_context = current253 current = self.new_context
254 return current
255
Defining an instance attribute outside __init__
affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__
method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None
in the init then call the sub-initialization methods.