self
or cls
detected PYL-W0642814 initialized from a dictionary or with keyword arguments."""
815
816 def __init__(*args: t.Any, **kwargs: t.Any) -> None: # noqa: B902
817 self, args = args[0], args[1:]818 self.__attrs = dict(*args, **kwargs)
819
820 def __getattribute__(self, name: str) -> t.Any:
335 if kwargs.get("_loop_vars"):
336 __self = __self.derived(kwargs["_loop_vars"])
337 if kwargs.get("_block_vars"):
338 __self = __self.derived(kwargs["_block_vars"]) 339 args = (__self,) + args
340 elif pass_arg is _PassArg.eval_context:
341 args = (__self.eval_ctx,) + args
333 # the active context should have access to variables set in
334 # loops and blocks without mutating the context itself
335 if kwargs.get("_loop_vars"):
336 __self = __self.derived(kwargs["_loop_vars"]) 337 if kwargs.get("_block_vars"):
338 __self = __self.derived(kwargs["_block_vars"])
339 args = (__self,) + args
Assignment to self
and cls
is invalid and strongly discouraged. Doing so can cause errors when accessing the object or the class.
class Foo:
def __init__(self, x):
self = x # Does nothing
class Foo:
def __init__(self, x):
self.x = x