Skip to content

Commit ec35b07

Browse files
Merge pull request #123 from jarrodmillman/ruffconf
Update ruff config
2 parents 63707ac + b5bf3f6 commit ec35b07

File tree

6 files changed

+46
-23
lines changed

6 files changed

+46
-23
lines changed

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1f423a22d8b27926da7d7b7393c833da0f3714a4

.pre-commit-config.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,9 @@ repos:
2323
files: \.(html|md|yml|yaml|toml)
2424
args: [--prose-wrap=preserve]
2525

26-
- repo: https://github.com/psf/black
27-
rev: 3702ba224ecffbcec30af640c149f231d90aebdb # frozen: 24.4.2
28-
hooks:
29-
- id: black
30-
3126
- repo: https://github.com/astral-sh/ruff-pre-commit
3227
rev: 1dc9eb131c2ea4816c708e4d85820d2cc8542683 # frozen: v0.5.0
3328
hooks:
3429
- id: ruff
35-
args: [--fix, --exit-non-zero-on-fix]
30+
args: ["--fix", "--show-fixes", "--exit-non-zero-on-fix"]
31+
- id: ruff-format

lazy_loader/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ def attach(package_name, submodules=None, submod_attrs=None):
3838
The typical way to call this function, replacing the above imports, is::
3939
4040
__getattr__, __dir__, __all__ = lazy.attach(
41-
__name__,
42-
['mysubmodule', 'anothersubmodule'],
43-
{'foo': ['someattr']}
41+
__name__, ["mysubmodule", "anothersubmodule"], {"foo": ["someattr"]}
4442
)
4543
4644
Parameters
@@ -162,7 +160,7 @@ def myfunc():
162160
fullname : str
163161
The full name of the module or submodule to import. For example::
164162
165-
sp = lazy.load('scipy') # import scipy as sp
163+
sp = lazy.load("scipy") # import scipy as sp
166164
167165
require : str
168166
A dependency requirement as defined in PEP-508. For example::
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
def some_func():
22
"""Function with same name as submodule."""
3-
pass

lazy_loader/tests/test_lazy_loader.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,5 +186,6 @@ def test_parallel_load():
186186
[
187187
sys.executable,
188188
os.path.join(os.path.dirname(__file__), "import_np_parallel.py"),
189-
]
189+
],
190+
check=True,
190191
)

pyproject.toml

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,55 @@ dev = ["changelist == 0.5"]
3333
Home = "https://scientific-python.org/specs/spec-0001/"
3434
Source = "https://github.com/scientific-python/lazy-loader"
3535

36-
3736
[tool.changelist]
3837
ignored_user_logins = ["dependabot[bot]", "pre-commit-ci[bot]", "web-flow"]
3938

4039
[tool.setuptools.dynamic.version]
4140
attr = 'lazy_loader.__version__'
4241

4342
[tool.ruff]
44-
line-length = 88
4543
exclude = [
4644
"lazy_loader/tests/fake_pkg/__init__.pyi",
4745
]
4846

4947
[tool.ruff.lint]
50-
select = [
51-
"C",
52-
"E",
53-
"F",
54-
"W",
55-
"B",
56-
"I",
57-
"UP",
48+
extend-select = [
49+
"B", # flake8-bugbear
50+
"I", # isort
51+
"ARG", # flake8-unused-arguments
52+
"C4", # flake8-comprehensions
53+
"EM", # flake8-errmsg
54+
"ICN", # flake8-import-conventions
55+
"G", # flake8-logging-format
56+
"PGH", # pygrep-hooks
57+
"PIE", # flake8-pie
58+
"PL", # pylint
59+
"PT", # flake8-pytest-style
60+
# "PTH", # flake8-use-pathlib
61+
"RET", # flake8-return
62+
"RUF", # Ruff-specific
63+
"SIM", # flake8-simplify
64+
"T20", # flake8-print
65+
"UP", # pyupgrade
66+
"YTT", # flake8-2020
67+
"EXE", # flake8-executable
68+
"NPY", # NumPy specific rules
69+
"PD", # pandas-vet
70+
"FURB", # refurb
71+
"PYI", # flake8-pyi
72+
]
73+
ignore = [
74+
"PLR09", # Too many <...>
75+
"PLR2004", # Magic value used in comparison
76+
"ISC001", # Conflicts with formatter
77+
"B018", # Found useless expression
78+
"B028", # No explicit `stacklevel` keyword argument found
79+
"PT011", # `pytest.raises(ValueError)` is too broad
80+
"EM102", # Exception must not use an f-string literal
81+
"EM101", # Exception must not use a string literal
82+
"RET505", # Unnecessary `elif` after `return` statement
83+
"SIM108", # Use ternary operator
5884
]
59-
ignore = ["B018", "B028"]
85+
86+
[tool.ruff.format]
87+
docstring-code-format = true

0 commit comments

Comments
 (0)