[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2026-03-02 18:33:47 +00:00
parent 98fceea2d4
commit 174a083157
13 changed files with 29 additions and 30 deletions

View File

@@ -19,7 +19,7 @@ def get_neighbors_pixel(
try:
return int(image[x_coordinate][y_coordinate] >= center)
except (IndexError, TypeError):
except IndexError, TypeError:
return 0

View File

@@ -124,7 +124,7 @@ def _construct_points(
else:
try:
points.append(Point(p[0], p[1]))
except (IndexError, TypeError):
except IndexError, TypeError:
print(
f"Ignoring deformed point {p}. All points"
" must have at least 2 coordinates."

View File

@@ -71,7 +71,7 @@ if __name__ == "__main__":
print(f"The Catalan numbers from 0 through {N} are:")
print(catalan_numbers(N))
print("Try another upper limit for the sequence: ", end="")
except (NameError, ValueError):
except NameError, ValueError:
print("\n********* Invalid input, goodbye! ************\n")
import doctest

View File

@@ -69,7 +69,7 @@ def main():
f"{greatest_common_divisor(num_1, num_2)}"
)
print(f"By iterative gcd({num_1}, {num_2}) = {gcd_by_iterative(num_1, num_2)}")
except (IndexError, UnboundLocalError, ValueError):
except IndexError, UnboundLocalError, ValueError:
print("Wrong input")

View File

@@ -56,7 +56,7 @@ def solution(n: int = 4000000) -> int:
try:
n = int(n)
except (TypeError, ValueError):
except TypeError, ValueError:
raise TypeError("Parameter n must be int or castable to int.")
if n <= 0:
raise ValueError("Parameter n must be greater than or equal to one.")

View File

@@ -80,7 +80,7 @@ def solution(n: int = 600851475143) -> int:
try:
n = int(n)
except (TypeError, ValueError):
except TypeError, ValueError:
raise TypeError("Parameter n must be int or castable to int.")
if n <= 0:
raise ValueError("Parameter n must be greater than or equal to one.")

View File

@@ -44,7 +44,7 @@ def solution(n: int = 600851475143) -> int:
try:
n = int(n)
except (TypeError, ValueError):
except TypeError, ValueError:
raise TypeError("Parameter n must be int or castable to int.")
if n <= 0:
raise ValueError("Parameter n must be greater than or equal to one.")

View File

@@ -44,7 +44,7 @@ def solution(n: int = 600851475143) -> int:
try:
n = int(n)
except (TypeError, ValueError):
except TypeError, ValueError:
raise TypeError("Parameter n must be int or castable to int.")
if n <= 0:
raise ValueError("Parameter n must be greater than or equal to one.")

View File

@@ -47,7 +47,7 @@ def solution(n: int = 20) -> int:
try:
n = int(n)
except (TypeError, ValueError):
except TypeError, ValueError:
raise TypeError("Parameter n must be int or castable to int.")
if n <= 0:
raise ValueError("Parameter n must be greater than or equal to one.")

View File

@@ -87,7 +87,7 @@ def solution(nth: int = 10001) -> int:
try:
nth = int(nth)
except (TypeError, ValueError):
except TypeError, ValueError:
raise TypeError("Parameter nth must be int or castable to int.") from None
if nth <= 0:
raise ValueError("Parameter nth must be greater than or equal to one.")

View File

@@ -37,7 +37,6 @@ test = [
"pytest>=8.4.1",
"pytest-cov>=6",
]
docs = [
"myst-parser>=4",
"sphinx-autoapi>=3.4",
@@ -50,7 +49,6 @@ euler-validate = [
[tool.ruff]
target-version = "py314"
output-format = "full"
lint.select = [
# https://beta.ruff.rs/docs/rules
@@ -128,7 +126,6 @@ lint.ignore = [
"SLF001", # Private member accessed: `_Iterator` -- FIX ME
"UP037", # FIX ME
]
lint.per-file-ignores."data_structures/hashing/tests/test_hash_map.py" = [
"BLE001",
]
@@ -150,37 +147,40 @@ lint.per-file-ignores."project_euler/problem_099/sol1.py" = [
lint.per-file-ignores."sorts/external_sort.py" = [
"SIM115",
]
lint.mccabe.max-complexity = 17 # default: 10
lint.mccabe.max-complexity = 17 # default: 10
lint.pylint.allow-magic-value-types = [
"float",
"int",
"str",
]
lint.pylint.max-args = 10 # default: 5
lint.pylint.max-branches = 20 # default: 12
lint.pylint.max-returns = 8 # default: 6
lint.pylint.max-statements = 88 # default: 50
lint.pylint.max-args = 10 # default: 5
lint.pylint.max-branches = 20 # default: 12
lint.pylint.max-returns = 8 # default: 6
lint.pylint.max-statements = 88 # default: 50
[tool.codespell]
ignore-words-list = "3rt,abd,aer,ans,bitap,crate,damon,fo,followings,hist,iff,kwanza,manuel,mater,secant,som,sur,tim,toi,zar"
skip = "./.*,*.json,*.lock,ciphers/prehistoric_men.txt,project_euler/problem_022/p022_names.txt,pyproject.toml,strings/dictionary.txt,strings/words.txt"
skip = """\
./.*,*.json,*.lock,ciphers/prehistoric_men.txt,project_euler/problem_022/p022_names.txt,pyproject.toml,strings/dictio\
nary.txt,strings/words.txt\
"""
[tool.pytest.ini_options]
markers = [
[tool.pytest]
ini_options.markers = [
"mat_ops: mark a test as utilizing matrix operations.",
]
addopts = [
ini_options.addopts = [
"--durations=10",
"--doctest-modules",
"--showlocals",
]
[tool.coverage.report]
omit = [
[tool.coverage]
report.omit = [
".env/*",
"project_euler/*",
]
sort = "Cover"
report.sort = "Cover"
[tool.sphinx-pyproject]
copyright = "2014, TheAlgorithms"
@@ -261,7 +261,6 @@ myst_fence_as_directive = [
"include",
]
templates_path = [ "_templates" ]
[tool.sphinx-pyproject.source_suffix]
".rst" = "restructuredtext"
source_suffix.".rst" = "restructuredtext"
# ".txt" = "markdown"
".md" = "markdown"
source_suffix.".md" = "markdown"

View File

@@ -67,7 +67,7 @@ def fetch_pharmacy_and_price_list(drug_name: str, zip_code: str) -> list | None:
return pharmacy_price_list
except (httpx.HTTPError, ValueError):
except httpx.HTTPError, ValueError:
return None

View File

@@ -53,7 +53,7 @@ class InstagramUser:
scripts = BeautifulSoup(html, "html.parser").find_all("script")
try:
return extract_user_profile(scripts[4])
except (json.decoder.JSONDecodeError, KeyError):
except json.decoder.JSONDecodeError, KeyError:
return extract_user_profile(scripts[3])
def __repr__(self) -> str: