Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive PD011 #14508

Closed
Matt-Ord opened this issue Nov 21, 2024 · 1 comment
Closed

False positive PD011 #14508

Matt-Ord opened this issue Nov 21, 2024 · 1 comment

Comments

@Matt-Ord
Copy link

I don't have pandas installed, but it is triggering PD011 on .values property that I have defined in my own class.

code:

class MyClass:
    @property
    def values(self):
        return None


a = MyClass()

vals = a.values  //Error

ruff 0.7.4

[tool.poetry.dependencies]
python = ">=3.13,<3.14"
numpy = "^2.0.0"
matplotlib = { version = "^3.9.2", optional = true }
slate = { git = "https://github.com/Matt-Ord/slate.git", rev = "9c8d4d2" }
sse_solver_py = { git = "https://github.com/Matt-Ord/sse_solver.git", rev = "4af64bb", subdirectory = "sse_solver_py", optional = true }
scipy = "^1.14.1"
qutip = { version = "^5.0.0", optional = true }

[tool.poetry.group.dev.dependencies]
ruff = "*"
pytest = "^8.3.3"
pyright = "^1.1.386"
sphinx = "^8.1.3"
pydata-sphinx-theme = "^0.16.0"

[tool.poetry.extras]
plot = ["matplotlib", "slate"]
qutip = ["qutip"]
sse_solver_py = ["sse_solver_py"]
simulation = ["qutip", "sse_solver_py"]

[tool.ruff]
unsafe-fixes = true

[tool.ruff.lint]
select = ["ALL"]
preview = true
ignore = [
    "COM812",
    "E501",
    "ANN101",
    "S101",
    "PT009",
    "D100",
    "D105",
    "CPY001",
    "TD003",
    "TD002",
    "DOC201",
    "DOC402",
    "DOC501",
]


[tool.ruff.lint.extend-per-file-ignores]
"tests/**/*" = ["PLR6301", "PLC2701", "PLR0914", "D101", "D102", "D103", "D104"]
"examples/**/*" = ["INP001"]
"docs/**/*" = ["INP001", "I002"]

[tool.ruff.lint.pylint]
allow-dunder-method-names = [
    "__as_fundamental__",
    "__from_fundamental__",
    "__into_fundamental__",
    "__as_transformed__",
    "__into_transformed__",
    "__from_transformed__",
    "__convert_vector_into__",
    "__into_inner__",
    "__from_inner__",
]

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.ruff.lint.isort]
required-imports = ["from __future__ import annotations"]

@MichaReiser
Copy link
Member

Thanks, this is similar to #6432. We are working on an overhaul of our analysis engine that will allow us to fix this false positive long-term, but that's still far out. For now, I suggest you to disable all PD rules if you aren't using pandas ignore = ["PD"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants