scripts/updatedata.py
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Open
Open
assert len(status) == 1 and status in ["A", "C"], f"Invalid status: {status!r}"
- Exclude checks
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Open
Open
assert len(province) == 2, f"Invalid province: {province!r}"
- Exclude checks
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Open
Open
assert name != "", f"Invalid name: {name!r}"
- Exclude checks
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Open
Open
assert code == "ND" or len(code) == 4, f"Invalid code: {code!r}"
- Exclude checks
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Open
Open
assert name != "", f"Invalid name: {name}"
- Exclude checks
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Open
Open
assert (
not missing_keys
), f"Invalid keys, missing one or more expected keys {missing_keys}."
- Exclude checks
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Open
Open
assert len(code) == 4, f"Invalid code: {code!r}"
- Exclude checks
Function _update_countries_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def _update_countries_data() -> None:
# https://www.anagrafenazionale.interno.it/area-tecnica/tabelle-di-decodifica/
data_url = (
"https://www.anagrafenazionale.interno.it"
"/wp-content/uploads/2022/10/tabella_2_statiesteri.xlsx"
- 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 _update_municipalities_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def _update_municipalities_data() -> None:
# https://www.anagrafenazionale.interno.it/area-tecnica/tabelle-di-decodifica/
data_url = (
"https://www.anagrafenazionale.interno.it"
"/wp-content/uploads/ANPR_archivio_comuni.csv"
- 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"