tldextract/tldextract.py
File tldextract.py
has 416 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""`tldextract` accurately separates a URL's subdomain, domain, and public suffix.
It does this via the Public Suffix List (PSL).
>>> import tldextract
Function suffix_index
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def suffix_index(
self, spl: list[str], include_psl_private_domains: bool | None = None
) -> tuple[int, bool]:
"""Return the index of the first suffix label, and whether it is private.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _extract_netloc
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def _extract_netloc(
self,
netloc: str,
include_psl_private_domains: bool | None,
session: requests.Session | None = None,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(