UNPKG

pi-lens

Version:

Real-time code feedback for pi — LSP, linters, formatters, type-checking, structural analysis & booboo

42 lines (41 loc) • 899 B
id: no-init-return valid: - | class Foo: def __init__(self): self.x = 1 - | class Foo: def __init__(self): return - | class Foo: def other(self): return 1 - | def init_like(): return 1 # #439: a factory whose body defines a class with __init__ — the factory's # own return must NOT be flagged (its name is not __init__). - | def make_thing(): class Thing: def __init__(self): self.x = 1 return Thing # A sibling method in a class that also has __init__ must not be flagged. - | class Foo: def __init__(self): self.x = 1 def build(self): return self.x invalid: - | class Foo: def __init__(self): return 1 - | class Foo: def __init__(self, x): return x