Skip to content

Commit 227bcd1

Browse files
committed
style: update style tooling, run it
1 parent cc16ba9 commit 227bcd1

File tree

9 files changed

+26
-21
lines changed

9 files changed

+26
-21
lines changed

.github/workflows/labels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
https://raw.githubusercontent.com/biocommons/.github/main/etc/labels.yml
2727
.github/labels.yml
2828
29-
delete-other-labels: false
29+
delete-other-labels: false

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ dev = [
2323
"build ~= 0.8",
2424
"ipython ~= 8.4",
2525
"mypy-extensions ~= 1.0",
26-
"pre-commit ~= 3.4",
26+
"pre-commit >= 4.2.0",
2727
"pyright~=1.1",
2828
"ruff == 0.12.8",
29-
"pre-commit>=4.2.0",
3029
]
3130
tests = [
3231
"pytest-cov ~= 4.1",
@@ -199,15 +198,17 @@ ignore = [
199198
"E501",
200199
"W191",
201200
"S321",
201+
"COM812",
202202
# other
203203
"ANN002",
204204
"ANN003",
205205
"PLR0913",
206206
"PLC0206",
207207
"EM101",
208208
"D213",
209+
"D203",
209210
"D400",
210-
"d415",
211+
"D415",
211212
]
212213

213214
[tool.ruff.lint.per-file-ignores]

src/biocommons/example/__main__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
_logger = logging.getLogger(__name__)
99

1010

11-
def main(): # pragma: no cover
11+
def main() -> None: # pragma: no cover
1212
"""marvin.example main"""
13-
import coloredlogs
13+
import coloredlogs # noqa: PLC0415
1414

1515
logging.Formatter.converter = time.gmtime
1616
coloredlogs.install(
@@ -22,8 +22,8 @@ def main(): # pragma: no cover
2222
quote = marvin.get_quote()
2323
_logger.warning("Got quote from Marvin (len=%s)", len(quote))
2424

25-
print("Marvin says:")
26-
print(quote)
25+
print("Marvin says:") # noqa: T201
26+
print(quote) # noqa: T201
2727

2828

2929
if __name__ == "__main__":

src/biocommons/example/marvin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919

2020
def is_alive() -> bool:
21-
"""tests whether Marvin is alive
21+
"""Test whether Marvin is alive
2222
2323
>>> is_alive() is True
2424
True
@@ -28,7 +28,7 @@ def is_alive() -> bool:
2828

2929

3030
def get_quote() -> str:
31-
"""return random Marvin quote
31+
"""Return random Marvin quote
3232
3333
eg> get_quote()
3434
"There's only one life-form as intelligent..."
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""biocommons.example test, adjacent to code"""
22

3-
from .marvin import get_quote
3+
from biocommons.example.marvin import get_quote
44

55

6-
def test_get_quote():
7-
"""test get_quote"""
6+
def test_get_quote() -> None:
7+
"""Test get_quote"""
88
assert get_quote() is not None # noqa: S101

src/biocommons/example/quotes.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ quotes:
1212
fifty thousand times more intelligent than you and even I don't
1313
know the answer. It gives me a headache just trying to think down
1414
to your level.
15-
15+
1616
- >-
1717
There's only one life-form as intelligent as me within thirty
1818
parsecs of here and that's me.
19-
19+
2020
- >-
2121
I wish you'd just tell me rather trying to engage my enthusiasm
2222
because I haven't got one.
23-
23+
2424
- >-
2525
And then, of course, I've got this terrible pain in all the diodes
2626
down my left side.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Declare tests internal to src directory"""
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
"""Provide fixtures to tests."""
2+
13
import importlib.resources
24

35
import pytest
46
import yaml
57

68

7-
@pytest.fixture()
8-
def all_quotes():
9+
@pytest.fixture
10+
def all_quotes() -> None:
11+
"""Provide quotes fixture"""
912
quotes_stream = importlib.resources.files("example").joinpath("quotes.yaml").read_text()
1013
return yaml.load(quotes_stream, Loader=yaml.SafeLoader)["quotes"]
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""biocommons.example test, within tests directory adjacent to source"""
22

3-
from ..marvin import get_quote
3+
from biocommons.example.marvin import get_quote
44

55

6-
def test_get_quote(all_quotes):
7-
"""test get_quote"""
6+
def test_get_quote(all_quotes: list[str]) -> None:
7+
"""Test get_quote"""
88
# NB: all_quotes argument is a test fixture; see ./conftest.py
99
assert get_quote() in all_quotes # noqa: S101

0 commit comments

Comments
 (0)