Skip to content

Commit 4605228

Browse files
committed
cleanup ruff rule errors in the code
1 parent a2b01a4 commit 4605228

20 files changed

Lines changed: 110 additions & 64 deletions

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include Makefile.inc
44

55
MYPY_INSTALL := \
66
types-requests \
7-
types-python-dateutil
7+
types-python-dateutil redis
88

99
prep: clean format check mypy
1010

pyproject.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,20 +158,17 @@
158158
ignore = [
159159
# ignore for now:
160160
"ARG002","ARG001",
161-
"COM812",
162161
"D107","D102","D101","D103","D100","D105","D104","D205","D203",
163-
"FBT002","FBT001",
164-
"FIX004",
165162
"N812","N818","N806","N802","N815","N816","N803","N999",
166-
"PIE810",
167163
"PLR6201","PLR2004","PLR0917","PLR0913","PLR0911","PLR0912","PLR0914",
168-
"PLW0603","PLW0602", "PLW2901",
164+
"PLW0603", # Using the global statement to update `xxx` is discouraged
165+
"PLW0602", # Using global for `xxx` but no assignment is done
169166
"RUF001","RUF067", "RUF012",
170167
"S101","S602",
171168

172169
#
170+
"COM812", # The following rule may cause conflicts when used with the formatter: `COM812`
173171
"T201", # print statements are ok, used in verbose mode
174-
"FIX002", # TODOs need some love but we will probably not get of them
175172
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible.
176173
"PT028", # experimental rule, incomplete
177174
]

whoisdomain/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@
126126
]
127127

128128

129-
def _result2dict(func: Any) -> Any:
129+
def _result2dict(
130+
func: Any,
131+
) -> Any:
130132
@wraps(func)
131133
def _inner(*args: str, **kw: Any) -> dict[str, Any]:
132134
r = func(*args, **kw)
@@ -138,6 +140,7 @@ def _inner(*args: str, **kw: Any) -> dict[str, Any]:
138140
def remoteQ2(
139141
conn: Any,
140142
max_requests: int,
143+
*,
141144
verbose: bool = False,
142145
) -> None:
143146
n: int = 0
@@ -249,6 +252,7 @@ def q2(
249252

250253
def query(
251254
domain: str,
255+
*,
252256
force: bool = False,
253257
cache_file: str | None = None,
254258
cache_age: int = 60 * 60 * 48,

whoisdomain/cache/dbmCache.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class DBMCache:
1010
def __init__(
1111
self,
1212
dbmFile: str,
13+
*,
1314
verbose: bool = False,
1415
) -> None:
1516
self.verbose = verbose

whoisdomain/cache/dummyCache.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
class DummyCache:
99
def __init__(
1010
self,
11+
*,
1112
verbose: bool = False,
1213
) -> None:
1314
self.verbose = verbose

whoisdomain/cache/redisCache.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@
1515
if HAS_REDIS:
1616

1717
class RedisCache:
18-
def __init__(self, verbose: bool = False, host: str = "localhost", port: int = 6379, db: int = 0) -> None:
18+
def __init__(
19+
self,
20+
*,
21+
verbose: bool = False,
22+
host: str = "localhost",
23+
port: int = 6379,
24+
db: int = 0,
25+
) -> None:
1926
self.verbose = verbose
2027

2128
self.pool = redis.ConnectionPool(host=host, port=port, db=db, decode_responses=True)

whoisdomain/cache/simpleCacheBase.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
class SimpleCacheBase:
1010
def __init__(
1111
self,
12+
*,
1213
verbose: bool = False,
1314
cacheMaxAge: int = (60 * 60 * 48),
1415
) -> None:

whoisdomain/cache/simpleCacheWithFile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class SimpleCacheWithFile(SimpleCacheBase):
1616

1717
def __init__(
1818
self,
19+
*,
1920
verbose: bool = False,
2021
cacheFilePath: str | None = None,
2122
cacheMaxAge: int = (60 * 60 * 48),

whoisdomain/context/dataContext.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class DataContext:
1212
def __init__(
1313
self,
1414
domain: str,
15+
*,
1516
hasLibTld: bool = False,
1617
) -> None:
1718
self.originalDomain: str = domain # the requested domain before cleanup

whoisdomain/doWhoisCommand.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def doWhoisAndReturnString(
7676
cache.put(
7777
keyString,
7878
wci.executeWhoisQueryOrReturnFileData(),
79-
)
79+
),
8080
)
8181

8282

0 commit comments

Comments
 (0)