extend-exclude = [
    "numpy/__config__.py",
    "numpy/distutils",
    "numpy/typing/_char_codes.py",
    "numpy/typing/tests/data",
    "spin/cmds.py",
    # Submodules.
    "doc/source/_static/scipy-mathjax",
    "vendored-meson/meson",
    "numpy/fft/pocketfft",
    "numpy/_core/src/umath/svml",
    "numpy/_core/src/npysort/x86-simd-sort",
    "numpy/_core/src/highway",
    "numpy/_core/src/common/pythoncapi-compat",
]

line-length = 88

[lint]
preview = true
extend-select = [
    "B",
    "C4",
    "ISC",
    "LOG",
    "G",
    "PIE",
    "TID",
    "FLY",
    "I",
    "PD",
    "E",
    "W",
    "PGH",
    "PLE",
    "UP",
]
ignore = [
    "B006",   # Do not use mutable data structures for argument defaults
    "B007",   # Loop control variable not used within loop body
    "B011",   # Do not `assert False` (`python -O` removes these calls), raise `AssertionError()`
    "B023",   # Function definition does not bind loop variable
    "B028",   # No explicit `stacklevel` keyword argument found
    "B904",   # Within an `except` clause distinguish raised exceptions from errors in exception handling
    "B905",   #`zip()` without an explicit `strict=` parameter
    "C408",   # Unnecessary `dict()` call (rewrite as a literal)
    "ISC002", # Implicitly concatenated string literals over multiple lines
    "PIE790", # Unnecessary `pass` statement
    "PD901",  # Avoid using the generic variable name `df` for DataFrames
    "E241",   # Multiple spaces after comma
    "E265",   # Block comment should start with `# `
    "E266",   # Too many leading `#` before block comment
    "E302",   # TODO: Expected 2 blank lines, found 1
    "E402",   # Module level import not at top of file
    "E712",   # Avoid equality comparisons to `True` or `False`
    "E721",   # TODO: Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance check
    "E731",   # Do not assign a `lambda` expression, use a `def`
    "E741",   # Ambiguous variable name
    "F403",   # `from ... import *` used; unable to detect undefined names
    "F405",   # may be undefined, or defined from star imports
    "F821",   # Undefined name
    "F841",   # Local variable is assigned to but never used
    "UP015",  # Unnecessary mode argument
    "UP031",  # TODO: Use format specifiers instead of percent format
]

[lint.per-file-ignores]
"_tempita.py" = ["B909"]
"bench_*.py" = ["B015", "B018"]
"test*.py" = ["B015", "B018", "E201", "E714"]
"benchmarks/*py" = ["E501"]
"numpy/_core/tests/**" = ["E501"]
"numpy/_core/_add_newdocs.py" = ["E501"]
"numpy/_core/_add_newdocs_scalars.py" = ["E501"]
"numpy/_core/code_generators/generate_umath.py" = ["E501"]
"numpy/_typing/*py" = ["E501"]
"numpy/lib/tests/*py" = ["E501"]
"numpy/linalg/tests/*py" = ["E501"]
"numpy/ma/tests/*py" = ["E501"]
"numpy/tests/*py" = ["E501"]
"numpy*pyi" = ["E501"]
"numpy/f2py/*py" = ["E501"]
"__init__.py" = ["F401", "F403", "F405"]
"__init__.pyi" = ["F401"]
"numpy/_core/defchararray.py" = ["F403", "F405"]
"numpy/_core/multiarray.py" = ["F405"]
"numpy/_core/numeric.py" = ["F403", "F405"]
"numpy/_core/umath.py" = ["F401", "F403", "F405"]
"numpy/f2py/capi_maps.py" = ["F403", "F405"]
"numpy/f2py/crackfortran.py" = ["F403", "F405"]
"numpy/f2py/f90mod_rules.py" = ["F403", "F405"]
"numpy/ma/core.pyi" = ["F403", "F405"]
"numpy/matlib.py" = ["F405"]
"numpy/matlib.pyi" = ["F811"]
