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

[pre-commit.ci] pre-commit autoupdate #2681

Merged
merged 4 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: end-of-file-fixer
exclude: tests/testdata
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.9.3"
rev: "v0.9.4"
hooks:
- id: ruff
args: ["--fix"]
Expand All @@ -33,7 +33,7 @@ repos:
- id: black-disable-checker
exclude: tests/test_nodes_lineno.py
- repo: https://github.com/psf/black
rev: 24.10.0
rev: 25.1.0
hooks:
- id: black
args: [--safe, --quiet]
Expand Down Expand Up @@ -65,3 +65,7 @@ repos:
hooks:
- id: prettier
args: [--prose-wrap=always, --print-width=88]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "v2.5.0"
hooks:
- id: pyproject-fmt
2 changes: 1 addition & 1 deletion astroid/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def wrapped(


def yes_if_nothing_inferred(
func: Callable[_P, Generator[InferenceResult]]
func: Callable[_P, Generator[InferenceResult]],
) -> Callable[_P, Generator[InferenceResult]]:
def inner(*args: _P.args, **kwargs: _P.kwargs) -> Generator[InferenceResult]:
generator = func(*args, **kwargs)
Expand Down
245 changes: 119 additions & 126 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,112 +1,142 @@
[build-system]
requires = ["setuptools>=75.2.0"]
build-backend = "setuptools.build_meta"

requires = [ "setuptools>=75.2" ]

[project]
name = "astroid"
license = {text = "LGPL-2.1-or-later"}
name = "astroid"
description = "An abstract syntax tree for Python with inference support."
readme = "README.rst"
keywords = ["static code analysis", "python", "abstract syntax tree"]
readme = "README.rst"
keywords = [ "abstract syntax tree", "python", "static code analysis" ]
license = { text = "LGPL-2.1-or-later" }
requires-python = ">=3.9.0"
classifiers = [
"Development Status :: 6 - Mature",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Software Development :: Testing",
"Development Status :: 6 - Mature",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Software Development :: Testing",
]
requires-python = ">=3.9.0"
dynamic = [ "version" ]

dependencies = [
"typing-extensions>=4.0.0;python_version<'3.11'",
"typing-extensions>=4; python_version<'3.11'",
]
dynamic = ["version"]

[project.urls]
"Docs" = "https://pylint.readthedocs.io/projects/astroid/en/latest/"
"Source Code" = "https://github.com/pylint-dev/astroid"
"Bug tracker" = "https://github.com/pylint-dev/astroid/issues"
"Discord server" = "https://discord.gg/Egy6P8AMB5"
urls."Bug tracker" = "https://github.com/pylint-dev/astroid/issues"
urls."Discord server" = "https://discord.gg/Egy6P8AMB5"
urls."Docs" = "https://pylint.readthedocs.io/projects/astroid/en/latest/"
urls."Source Code" = "https://github.com/pylint-dev/astroid"

[tool.setuptools]
license-files = ["LICENSE", "CONTRIBUTORS.txt"] # Keep in sync with setup.cfg
license-files = [ "LICENSE", "CONTRIBUTORS.txt" ] # Keep in sync with setup.cfg

[tool.setuptools.package-dir]
"" = "."

[tool.setuptools.packages.find]
include = ["astroid*"]
include = [ "astroid*" ]

[tool.setuptools.dynamic]
version = {attr = "astroid.__pkginfo__.__version__"}
version = { attr = "astroid.__pkginfo__.__version__" }

[tool.aliases]
test = "pytest"
[tool.ruff]
target-version = "py39"

# ruff is less lenient than pylint and does not make any exceptions
# (for docstrings, strings and comments in particular).
line-length = 110

extend-exclude = [ "tests/testdata/" ]

lint.select = [
"B", # bugbear
"E", # pycodestyle
"F", # pyflakes
"I", # isort
"RUF", # ruff
"W", # pycodestyle
]
lint.ignore = [
"B905", # `zip()` without an explicit `strict=` parameter
"F401", # API
"RUF100", # ruff does not understand pylint's directive usefulness
]
# Ruff is autofixing a tests with a voluntarily sneaky unicode
lint.per-file-ignores."tests/test_regrtest.py" = [ "RUF001" ]
lint.fixable = [
"B", # bugbear
"E", # pycodestyle
"F", # pyflakes
"I", # isort
"RUF", # ruff
"W", # pycodestyle
]
lint.unfixable = [ "RUF001" ]

[tool.pytest.ini_options]
addopts = '-m "not acceptance"'
python_files = ["*test_*.py"]
testpaths = ["tests"]
python_files = [ "*test_*.py" ]
testpaths = [ "tests" ]
filterwarnings = "error"

[tool.mypy]
python_version = "3.9"
files = [
"astroid/_ast.py",
"astroid/_backport_stdlib_names.py",
"astroid/astroid_manager.py",
"astroid/brain/brain_crypt.py",
"astroid/brain/brain_ctypes.py",
"astroid/brain/brain_curses.py",
"astroid/brain/brain_datetime.py",
"astroid/brain/brain_dateutil.py",
"astroid/brain/brain_hashlib.py",
"astroid/brain/brain_http.py",
"astroid/brain/brain_hypothesis.py",
"astroid/brain/brain_mechanize.py",
"astroid/brain/brain_numpy_core_einsumfunc.py",
"astroid/brain/brain_numpy_core_fromnumeric.py",
"astroid/brain/brain_numpy_core_function_base.py",
"astroid/brain/brain_numpy_core_multiarray.py",
"astroid/brain/brain_numpy_core_numeric.py",
"astroid/brain/brain_numpy_core_numerictypes.py",
"astroid/brain/brain_numpy_core_umath.py",
"astroid/brain/brain_numpy_ma.py",
"astroid/brain/brain_numpy_random_mtrand.py",
"astroid/brain/brain_pkg_resources.py",
"astroid/brain/brain_pytest.py",
"astroid/brain/brain_responses.py",
"astroid/brain/brain_scipy_signal.py",
"astroid/brain/brain_sqlalchemy.py",
"astroid/brain/brain_ssl.py",
"astroid/brain/brain_subprocess.py",
"astroid/brain/brain_threading.py",
"astroid/brain/brain_unittest.py",
"astroid/brain/brain_uuid.py",
"astroid/const.py",
"astroid/context.py",
"astroid/interpreter/_import/",
"astroid/modutils.py",
"astroid/nodes/const.py",
"astroid/nodes/utils.py",
"astroid/_ast.py",
"astroid/_backport_stdlib_names.py",
"astroid/astroid_manager.py",
"astroid/brain/brain_crypt.py",
"astroid/brain/brain_ctypes.py",
"astroid/brain/brain_curses.py",
"astroid/brain/brain_datetime.py",
"astroid/brain/brain_dateutil.py",
"astroid/brain/brain_hashlib.py",
"astroid/brain/brain_http.py",
"astroid/brain/brain_hypothesis.py",
"astroid/brain/brain_mechanize.py",
"astroid/brain/brain_numpy_core_einsumfunc.py",
"astroid/brain/brain_numpy_core_fromnumeric.py",
"astroid/brain/brain_numpy_core_function_base.py",
"astroid/brain/brain_numpy_core_multiarray.py",
"astroid/brain/brain_numpy_core_numeric.py",
"astroid/brain/brain_numpy_core_numerictypes.py",
"astroid/brain/brain_numpy_core_umath.py",
"astroid/brain/brain_numpy_ma.py",
"astroid/brain/brain_numpy_random_mtrand.py",
"astroid/brain/brain_pkg_resources.py",
"astroid/brain/brain_pytest.py",
"astroid/brain/brain_responses.py",
"astroid/brain/brain_scipy_signal.py",
"astroid/brain/brain_sqlalchemy.py",
"astroid/brain/brain_ssl.py",
"astroid/brain/brain_subprocess.py",
"astroid/brain/brain_threading.py",
"astroid/brain/brain_unittest.py",
"astroid/brain/brain_uuid.py",
"astroid/const.py",
"astroid/context.py",
"astroid/interpreter/_import/",
"astroid/modutils.py",
"astroid/nodes/const.py",
"astroid/nodes/utils.py",
]
always_false = [
"PY310_PLUS",
"PY311_PLUS",
"PY312_PLUS",
"PY313_PLUS",
"PY310_PLUS",
"PY311_PLUS",
"PY312_PLUS",
"PY313_PLUS",
]
disallow_any_decorated = true
disallow_any_explicit = true
Expand All @@ -120,52 +150,15 @@ warn_unreachable = true
[[tool.mypy.overrides]]
# Importlib typeshed stubs do not include the private functions we use
module = [
"_io.*",
"gi.*",
"importlib.*",
"nose.*",
"numpy.*",
"pytest",
"setuptools",
"_io.*",
"gi.*",
"importlib.*",
"nose.*",
"numpy.*",
"pytest",
"setuptools",
]
ignore_missing_imports = true


[tool.ruff]
target-version = "py39"

extend-exclude = ["tests/testdata/"]

# ruff is less lenient than pylint and does not make any exceptions
# (for docstrings, strings and comments in particular).
line-length = 110

[tool.ruff.lint]
select = [
"E", # pycodestyle
"F", # pyflakes
"W", # pycodestyle
"B", # bugbear
"I", # isort
"RUF", # ruff
]

ignore = [
"B905", # `zip()` without an explicit `strict=` parameter
"F401", # API
"RUF100", # ruff does not understand pylint's directive usefulness
]

fixable = [
"E", # pycodestyle
"F", # pyflakes
"W", # pycodestyle
"B", # bugbear
"I", # isort
"RUF", # ruff
]
unfixable = ["RUF001"]

[tool.ruff.lint.per-file-ignores]
# Ruff is autofixing a tests with a voluntarily sneaky unicode
"tests/test_regrtest.py" = ["RUF001"]
[tool.aliases]
test = "pytest"