-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathCLAUDE_TODO
More file actions
26 lines (19 loc) · 1.03 KB
/
CLAUDE_TODO
File metadata and controls
26 lines (19 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---
# TLD regex database compiled eagerly at import
whoisdomain/helpers.py · lines 99–100
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.
---
# Module-level mutable globals everywhere
helpers.py:99, doWhoisCommand.py:20, lastWhois.py:21, main.py:550
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.
---
# Quick nits
is True / is False comparisons throughout — just use if x: / if not x:
~40 sites