Skip to content

Commit 511c1a0

Browse files
committed
chore: Update Ruff linters
1 parent 1acd254 commit 511c1a0

File tree

6 files changed

+56
-9
lines changed

6 files changed

+56
-9
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
- repo: https://github.com/astral-sh/ruff-pre-commit
1010
rev: v0.12.2
1111
hooks:
12-
- id: ruff
12+
- id: ruff-check
1313
- id: ruff-format
1414

1515
- repo: https://github.com/gitleaks/gitleaks

pyproject.toml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,32 +67,62 @@ line-length = 79
6767
[tool.ruff.lint]
6868
extend-select = [
6969
"A",
70+
"AIR",
71+
# "ANN",
72+
"ARG",
73+
"ASYNC",
7074
"B",
7175
"BLE",
7276
"C4",
7377
"C90",
7478
"D",
79+
"DJ",
7580
# "DTZ",
7681
"E",
7782
"EM",
7883
"ERA",
7984
"EXE",
85+
"F",
86+
# "FA",
8087
"FBT",
88+
"FIX",
89+
"FLY",
90+
"FURB",
91+
"G",
92+
"I",
93+
"ICN",
94+
"INP",
95+
"INT",
96+
"ISC",
97+
"LOG",
98+
# "N",
8199
"NPY",
100+
"PD",
101+
# "PERF",
82102
"PGH",
103+
"PIE",
83104
"PL",
84105
"PT",
85106
"PTH",
107+
"PYI",
108+
"Q",
86109
"RET",
87110
"RSE",
88111
"RUF",
89112
# "S",
90113
"SIM",
114+
"SLF",
115+
"SLOT",
116+
"T10",
117+
# "T20",
118+
"TC",
119+
"TD",
91120
"TID",
92121
"TCH",
93122
"TRY",
94123
# "UP",
95124
"W",
125+
"YTT",
96126
]
97127
ignore = [
98128
"D212",
@@ -106,14 +136,22 @@ extend-allowed-calls = [
106136

107137

108138
[tool.ruff.lint.per-file-ignores]
109-
"**/test_*.py" = ["S101"]
139+
"**/test_*.py" = [
140+
"S101",
141+
"SLF001",
142+
]
143+
"doc/source/conf.py" = ["INP001"]
110144
"html_utilities.py" = ["PLR2004"]
111145

112146

113147
[tool.ruff.lint.pydocstyle]
114148
convention = "google"
115149

116150

151+
[tool.ruff.lint.pyupgrade]
152+
keep-runtime-typing = true
153+
154+
117155

118156
[tool.semantic_release]
119157
build_command = "python3 -m pip install poetry && poetry build"

shell_logger/shell.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from types import SimpleNamespace
2121
from typing import IO, Optional, TextIO
2222

23-
2423
END_OF_READ = 4
2524

2625

shell_logger/shell_logger.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def update_done_time(self) -> None:
248248
"""
249249
self.done_time = datetime.now()
250250

251-
def __update_duration(self) -> None:
251+
def update_duration(self) -> None:
252252
"""
253253
Update the :attr:`duration` attribute.
254254
@@ -427,7 +427,7 @@ def to_html(self) -> Union[Iterator[str], list[Iterator[str]]]:
427427
if isinstance(log, ShellLogger):
428428
# Update the duration of this ShellLogger's commands.
429429
if log.duration is None:
430-
log.__update_duration()
430+
log.update_duration()
431431
html.append(child_logger_card(log))
432432

433433
# Otherwise, if this is a message being logged...
@@ -737,7 +737,7 @@ def default(self, obj: object) -> object: # noqa: PLR0911
737737
"""
738738
if isinstance(obj, ShellLogger):
739739
return {
740-
**{"__type__": "ShellLogger"},
740+
"__type__": "ShellLogger",
741741
**{k: self.default(v) for k, v in obj.__dict__.items()},
742742
}
743743
if isinstance(obj, (int, float, str, bytes)):

shell_logger/stats_collector.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,6 @@ def __init__(self, interval: float, manager: SyncManager) -> None:
317317

318318
def collect(self) -> None:
319319
"""Don't collect any disk statistics."""
320-
pass
321320

322321
def unproxied_stats(self) -> None:
323322
"""
@@ -352,7 +351,6 @@ def __init__(self, interval: float, manager: SyncManager) -> None:
352351

353352
def collect(self) -> None:
354353
"""Don't collect any CPU statistics."""
355-
pass
356354

357355
def unproxied_stats(self) -> None:
358356
"""
@@ -387,7 +385,6 @@ def __init__(self, interval: float, manager: SyncManager) -> None:
387385

388386
def collect(self) -> None:
389387
"""Don't collect any memory statistics."""
390-
pass
391388

392389
def unproxied_stats(self) -> None:
393390
"""

test/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Create the ``test`` package.
3+
4+
This ``__init__.py`` file creates the ``test`` package, such that tests
5+
can relative-import from modules in the sibling ``shell_logger``
6+
directory.
7+
"""
8+
9+
# © 2023 National Technology & Engineering Solutions of Sandia, LLC
10+
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the
11+
# U.S. Government retains certain rights in this software.
12+
13+
# SPDX-License-Identifier: BSD-3-Clause

0 commit comments

Comments
 (0)