Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- id: auto-walrus

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.14
rev: v0.15.4
hooks:
- id: ruff-check
- id: ruff-format
Expand All @@ -32,7 +32,7 @@ repos:
- tomli

- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.12.1
rev: v2.16.2
hooks:
- id: pyproject-fmt

Expand All @@ -45,7 +45,7 @@ repos:
pass_filenames: false

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.24.1
rev: v0.25
hooks:
- id: validate-pyproject

Expand Down
2 changes: 1 addition & 1 deletion digital_image_processing/filters/local_binary_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion divide_and_conquer/convex_hull.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion dynamic_programming/catalan_numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def catalan_numbers(upper_limit: int) -> "list[int]":
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
Expand Down
2 changes: 1 addition & 1 deletion maths/greatest_common_divisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")


Expand Down
2 changes: 1 addition & 1 deletion project_euler/problem_002/sol4.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion project_euler/problem_003/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion project_euler/problem_003/sol2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion project_euler/problem_003/sol3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion project_euler/problem_005/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion project_euler/problem_007/sol2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
35 changes: 17 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ test = [
"pytest>=8.4.1",
"pytest-cov>=6",
]

docs = [
"myst-parser>=4",
"sphinx-autoapi>=3.4",
Expand All @@ -50,7 +49,6 @@ euler-validate = [

[tool.ruff]
target-version = "py314"

output-format = "full"
lint.select = [
# https://beta.ruff.rs/docs/rules
Expand Down Expand Up @@ -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",
]
Expand All @@ -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"
Expand Down Expand Up @@ -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"
2 changes: 1 addition & 1 deletion web_programming/fetch_well_rx_price.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion web_programming/instagram_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_json(self) -> dict:
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:
Expand Down