Skip to content

Commit c49573f

Browse files
committed
more ruff rules clarify
1 parent 35d78a1 commit c49573f

11 files changed

Lines changed: 57 additions & 64 deletions

File tree

pyproject.toml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,26 @@
157157

158158
ignore = [
159159
# ignore for now:
160-
"ARG002","ARG001",
161-
"D107","D102","D101","D103","D100","D105","D104","D205","D203",
162-
"N812","N818","N806","N802","N815","N816","N803","N999",
160+
#"ARG001",
161+
#"ARG002",
162+
163+
"D100",
164+
"D101",
165+
"D102",
166+
"D104",
167+
"D105",
168+
"D107",
169+
"D103", # Missing docstring in public function
170+
171+
"N802",
172+
"N803",
173+
"N806",
174+
"N812",
175+
"N815",
176+
"N816",
177+
"N818",
178+
"N999",
179+
163180
"PLR2004",
164181

165182
"PLR0911", # Too many return statements
@@ -171,7 +188,6 @@
171188

172189
"RUF001","RUF067", "RUF012",
173190
"S101", # Use of `assert` detected
174-
# "S602",
175191

176192
#
177193
"COM812", # The following rule may cause conflicts when used with the formatter: `COM812`

whoisdomain/cache/dummyCache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ def __init__(
1515

1616
def get( # noqa: PLR6301
1717
self,
18-
keyString: str,
18+
keyString: str, # noqa: ARG002
1919
) -> str | None:
2020
return None
2121

2222
def put( # noqa: PLR6301
2323
self,
24-
keyString: str,
24+
keyString: str, # noqa: ARG002
2525
data: str,
2626
) -> str:
2727
return data

whoisdomain/doWhoisCommand.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def setMyCache(myCache: Any) -> None:
3030

3131
def _initDefaultCache(
3232
pc: ParameterContext,
33-
dc: DataContext,
33+
# dc: DataContext,
3434
) -> Any:
3535
global CACHE_STUB
3636

@@ -62,7 +62,7 @@ def doWhoisAndReturnString(
6262
) -> str:
6363
cache = _initDefaultCache(
6464
pc=pc,
65-
dc=dc,
65+
# dc=dc,
6666
)
6767
keyString = ".".join(dc.dList)
6868

whoisdomain/domain.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ def _cleanupArray(
5858

5959
def _doNameservers(
6060
self,
61-
pc: ParameterContext,
61+
# pc: ParameterContext,
62+
*,
6263
dc: DataContext,
6364
) -> None:
6465
tmp: list[str] = []
@@ -178,7 +179,7 @@ def _parseData(
178179

179180
self.dnssec = dc.data["DNSSEC"]
180181
self._doStatus(pc, dc)
181-
self._doNameservers(pc, dc)
182+
self._doNameservers(dc=dc)
182183

183184
# optional fields
184185
self._doOptionalFields(dc.data)

whoisdomain/handleDateStrings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ def str_to_date(
8383
text: str,
8484
*,
8585
tld: str | None = None,
86-
verbose: bool = False,
8786
) -> datetime.datetime | None:
8887
text = text.strip().lower()
8988

whoisdomain/helpers.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@
1515

1616

1717
def filterTldToSupportedPattern(
18-
domain: str,
1918
dList: list[str],
20-
*,
21-
verbose: bool = False,
2219
) -> str | None:
2320
global tldInfo
24-
return tldInfo.filterTldToSupportedPattern(domain, dList, verbose=verbose)
21+
return tldInfo.filterTldToSupportedPattern(dList)
2522

2623

2724
def mergeExternalDictWithRegex(

whoisdomain/main.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,6 @@ def testItem(d: str, pc: whois.ParameterContext) -> Any:
223223

224224
def testItem1(
225225
d: str,
226-
*,
227-
printgetRawWhoisResult: bool = False,
228226
) -> None:
229227
global \
230228
IgnoreReturncode, \
@@ -378,7 +376,7 @@ def getAllCurrentTld() -> list[str]:
378376

379377
def appendHintOrMeta(
380378
rr: list[str],
381-
allRegex: str | None,
379+
# allRegex: str | None,
382380
tld: str,
383381
) -> None:
384382
global TestAllTld, TestRunOnly
@@ -393,7 +391,7 @@ def appendHintOrMeta(
393391

394392
def appendHint(
395393
rr: list[str],
396-
allRegex: str | None,
394+
# allRegex: str | None,
397395
tld: str,
398396
) -> None:
399397
global TestAllTld, TestRunOnly
@@ -405,17 +403,17 @@ def appendHint(
405403

406404

407405
def makeMetaAllCurrentTld(
408-
allHaving: str | None = None,
406+
# allHaving: str | None = None,
409407
allRegex: str | None = None,
410408
) -> list[str]:
411409
rr: list[str] = []
412410
for tld in getAllCurrentTld():
413411
if allRegex is None:
414-
appendHintOrMeta(rr, allRegex, tld)
412+
appendHintOrMeta(rr, tld)
415413
continue
416414

417415
if re.search(allRegex, tld):
418-
appendHintOrMeta(rr, allRegex, tld)
416+
appendHintOrMeta(rr, tld)
419417

420418
return rr
421419

@@ -426,10 +424,10 @@ def makeTestAllCurrentTld(
426424
rr: list[str] = []
427425
for tld in getAllCurrentTld():
428426
if allRegex is None:
429-
appendHint(rr, allRegex, tld)
427+
appendHint(rr, tld)
430428
continue
431429
if re.search(allRegex, tld):
432-
appendHint(rr, allRegex, tld)
430+
appendHint(rr, tld)
433431

434432
return rr
435433

@@ -583,7 +581,7 @@ def main() -> None: # noqa: C901,PLR0915
583581

584582
# TestAllTld: bool = False
585583

586-
allHaving: str | None = None # from all supported tld only process the ones having this :: TODO ::
584+
# allHaving: str | None = None # from all supported tld only process the ones having this :: TODO ::
587585
allRegex: str | None = None # from all supported tld process only the ones matching this regex
588586

589587
directory: str | None = None
@@ -614,9 +612,9 @@ def main() -> None: # noqa: C901,PLR0915
614612
if opt in {"-a", "--all"}:
615613
TestAllTld = True
616614

617-
if opt in {"-H", "--having"}:
618-
TestAllTld = True
619-
allHaving = str(arg)
615+
# if opt in {"-H", "--having"}:
616+
# TestAllTld = True
617+
# allHaving = str(arg)
620618

621619
if opt in {"-r", "--reg"}:
622620
TestAllTld = True
@@ -709,7 +707,7 @@ def main() -> None: # noqa: C901,PLR0915
709707

710708
if TestAllTld:
711709
if TestRunOnly is False:
712-
testDomains(makeMetaAllCurrentTld(allHaving, allRegex))
710+
testDomains(makeMetaAllCurrentTld(allRegex))
713711
else:
714712
testDomains(makeTestAllCurrentTld(allRegex))
715713

whoisdomain/processWhoisDomainRequest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ def _internationalizedDomainNameToPunyCode(d: list[str]) -> list[str]:
8585

8686
# Is it a supported domain =======
8787
self.dc.tldString = filterTldToSupportedPattern(
88-
self.dc.domain,
8988
self.dc.dList,
90-
verbose=self.pc.verbose,
9189
)
9290

9391
if self.dc.tldString is None:

whoisdomain/tldDb/finders.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ def newLineSplit(
3434
) -> Callable[[str], list[str]]:
3535
def xNewlineSplit(
3636
whoisStr: str,
37-
*,
38-
verbose: bool = False,
3937
) -> Any:
4038
# split the incoming text on newlines \n\n
4139
reStr = r"\n\n"
@@ -52,11 +50,11 @@ def R(
5250
reStr: str,
5351
*,
5452
ignoreCase: bool = True,
55-
) -> Callable[[str, list[str]], list[str]]:
53+
) -> Callable[[str], list[str]]:
5654
# regular simple regex strings are converter with currying to functins to be called later
5755
def reFindAll(
5856
textStr: str,
59-
sData: list[str],
57+
# sData: list[str],
6058
) -> Any:
6159
flags = re.IGNORECASE if ignoreCase else 0 # NOFLAG is 3.11
6260
pattern = make_pat(reStr, flags)
@@ -78,14 +76,14 @@ def findFromToAndLookFor(
7876
lookForStr: str,
7977
*,
8078
ignoreCase: bool = True,
81-
) -> Callable[[str, list[str]], list[str]]:
79+
) -> Callable[[str], list[str]]:
8280
# look for a particular string like R()
8381
# but limit the context we look in
8482
# to a specific sub section of the whois cli response
8583
# use currying to create a func that will be called later
8684
def xFindFromToAndLookFor(
8785
textStr: str,
88-
sData: list[str],
86+
# sData: list[str],
8987
) -> Any:
9088
flags = re.IGNORECASE if ignoreCase else 0 # NOFLAG is 3.11
9189
p1 = make_pat(fromStr, flags)
@@ -163,15 +161,15 @@ def findFromToAndLookForWithFindFirst(
163161
lookForStr: str,
164162
*,
165163
ignoreCase: bool = True,
166-
) -> Callable[[str, list[str]], list[str]]:
164+
) -> Callable[[str], list[str]]:
167165
# look for a particular string like R() with find first
168166
# then build a from ,to context using the result from findFirst (google.fr is a example)
169167
# but limit the context we look in
170168
# to a specific sub section of the whois cli response
171169
# use currying to create a func that will be called later
172170
def xFindFromToAndLookForWithFindFirst(
173171
textStr: str,
174-
sData: list[str],
172+
# sData: list[str],
175173
) -> list[str]:
176174
flags = re.IGNORECASE if ignoreCase else 0 # NOFLAG is 3.11
177175

whoisdomain/tldDb/groupers.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# import sys
33
import logging
44
import os
5-
from collections.abc import Callable
65

76
log = logging.getLogger(__name__)
87
logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO"))
@@ -18,21 +17,13 @@
1817
]
1918

2019

21-
def groupFromList(
22-
aList: list[str],
23-
) -> Callable[[str], dict[str, str]]:
24-
def xgroupFromList(
25-
whoisStr: str,
26-
*,
27-
verbose: bool = False,
28-
) -> dict[str, str]:
29-
result: dict[str, str] = {}
30-
# iterate over the lines of whoisStr
31-
# for key each item in the list
32-
# create a empty list
33-
# store the list under key
34-
# see if there is a match ans append matched lines to the list
35-
# what = r"\n\n"
36-
return result
37-
38-
return xgroupFromList
20+
# def groupFromList(
21+
# aList: list[str],
22+
# ) -> Callable[[str], dict[str, str]]:
23+
# def xgroupFromList(
24+
# whoisStr: str,
25+
# ) -> dict[str, str]:
26+
# result: dict[str, str] = {}
27+
# return result
28+
#
29+
# return xgroupFromList

0 commit comments

Comments
 (0)