pylint
pylint copied to clipboard
It's not just a linter that annoys you!
### Bug description There is a false positive `not-async-context-manager` when using Pydantic v2's `PrivateAttr`. Fyi I am coming from https://github.com/pydantic/pydantic/issues/9921 ```python import asyncio from pydantic import BaseModel, PrivateAttr class SomeModel(BaseModel):...
### Bug description ```python """test_lint.py""" from typing import Optional class Foo: """class Foo""" a: Optional[dict] = None def empty(self): """foo""" @classmethod def init(cls): """init""" if cls.a is None: cls.a =...
### Current problem The following code redefines global objects and should be reported as such: ``` foo = 10 def f(x): return x + foo foo = 100 def f(x):...
### Current problem I'm using pyreverse to visualize the structure of sympy which is a fairly large project, with a lot of relations modelled by classes, but also some functionality...
### Bug description ```python from dataclasses import InitVar from dataclasses import dataclass @dataclass class Base: x: int def __post_init__(self): self.x += 1 @dataclass class Child(Base): y: InitVar[int] def __post_init__(self, y):...
### Bug description ```python # pylint: disable=missing-module-docstring, too-few-public-methods class NoAttributesDefinedInInit: """Both assignments should raise.""" def later(self): """Only the first assignment raises.""" self.a = "a" setattr(self, "b", "b") ``` ### Configuration...
Ran into this when trying to use pyreverse, but I think this might be an astroid bug. It seems like the issue is that `is_stdlib_module()` expects a string module name,...
### Bug description ```python # pylint: disable=missing-docstring,too-few-public-methods import ctypes class Test(ctypes.Structure): _fields_ = [("member", ctypes.c_uint8)] test = Test() test.member = 42 # pylint: disable=attribute-defined-outside-init test.not_a_member = 24 assert bytes(test) ==...
### Bug description hello.py ```python # pylint: disable=missing-module-docstring eg = ExceptionGroup("Hello", [Exception("A"), Exception("B")]) for e in eg.exceptions: print(e) ``` ### Configuration _No response_ ### Command used ```shell pylint hello.py ```...
### Current problem There is an Astroid function for detecting Numpy members (`attribute_looks_like_numpy_member`). I'm sure it is very useful for code that uses Numpy, but for code that doesn't use...