john-kurkowski / tldextract

Accurately separates a URL’s subdomain, domain, and public suffix, using the Public Suffix List (PSL).
BSD 3-Clause "New" or "Revised" License
1.81k stars 211 forks source link

`suffix_list_urls` should be `Optional` #265

Closed MrRawbin closed 2 years ago

MrRawbin commented 2 years ago

According to the README, the suffix_list_urls can be set to None to prevent live HTTP fetching:

# extract callable that falls back to the included TLD snapshot, no live HTTP fetching
no_fetch_extract = tldextract.TLDExtract(suffix_list_urls=None)

The TLDExtract constructor then handles None by setting the value to an empty tuple like this:

suffix_list_urls = suffix_list_urls or ()

However, my IDE complains about me using None as value for suffix_list_urls since it is not Optional. A workaround is using an empty tuple as a value myself, but I don't think I should have to.

john-kurkowski commented 2 years ago

Thanks for raising this issue! That's a documentation bug. Fixed in cd07547. I prefer the simpler type, as is.