You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Importing whoisdomain forces processing all 3,000+ lines of ZZ immediately. Consumers who only need one TLD pay the cost of all of them. Make MY_TLD_INFO lazy — initialize on first call to get_TLD_RE() or filterTldToSupportedPattern(). Bonus: significantly faster python -c "import whoisdomain", which matters for CLI tools and lambdas.
7
+
8
+
---
9
+
10
+
# ParameterContext is a JSON-parsed config rather than a dataclass
11
+
whoisdomain/context/parameterContext.py
12
+
13
+
A 150-line JSON literal is parsed at import to define ~25 parameters, then __getattr__ returns Any for every read. mypy can't help you, IDE autocomplete can't help your users, and the validation code (~80 lines) duplicates what @dataclass(slots=True) + __post_init__ would give you for free. Sketch:
MY_TLD_INFO, CACHE_STUB, LastWhois, and a 14-name global declaration in main(). This makes the package effectively a singleton — concurrent users (e.g. an async webapp) will fight over state, and tests can't run in parallel. Move shared state onto a Whois client class that callers instantiate, and keep the module-level helpers as thin wrappers around a default instance for backwards compatibility.
34
+
35
+
---
36
+
37
+
# Quick nits
38
+
is True / is False comparisons throughout — just use if x: / if not x:
0 commit comments