Skip to content

Commit bd2406e

Browse files
authored
Merge branch 'TheAlgorithms:master' into master
2 parents 1f1d3f7 + 791deb4 commit bd2406e

6 files changed

Lines changed: 13 additions & 15 deletions

File tree

.github/workflows/sphinx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- run: uv sync --group=docs
4242
- uses: actions/configure-pages@v6
4343
- run: uv run sphinx-build -c docs . docs/_build/html
44-
- uses: actions/upload-pages-artifact@v4
44+
- uses: actions/upload-pages-artifact@v5
4545
with:
4646
path: docs/_build/html
4747

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ repos:
1919
- id: auto-walrus
2020

2121
- repo: https://github.com/astral-sh/ruff-pre-commit
22-
rev: v0.15.4
22+
rev: v0.15.9
2323
hooks:
2424
- id: ruff-check
2525
- id: ruff-format
2626

2727
- repo: https://github.com/codespell-project/codespell
28-
rev: v2.4.1
28+
rev: v2.4.2
2929
hooks:
3030
- id: codespell
3131
additional_dependencies:
3232
- tomli
3333

3434
- repo: https://github.com/tox-dev/pyproject-fmt
35-
rev: v2.16.2
35+
rev: v2.21.0
3636
hooks:
3737
- id: pyproject-fmt
3838

hashes/hamming_code.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def emitter_converter(size_par, data):
118118
data_ord.append(None)
119119

120120
# Calculates parity
121-
qtd_bp = 0 # parity bit counter
122121
for bp in range(1, size_par + 1):
123122
# Bit counter one for a given parity
124123
cont_bo = 0
@@ -133,8 +132,6 @@ def emitter_converter(size_par, data):
133132
cont_bo += 1
134133
parity.append(cont_bo % 2)
135134

136-
qtd_bp += 1
137-
138135
# Mount the message
139136
cont_bp = 0 # parity bit counter
140137
for x in range(size_par + len(data)):
@@ -208,7 +205,6 @@ def receptor_converter(size_par, data):
208205
data_ord.append(None)
209206

210207
# Calculates parity
211-
qtd_bp = 0 # parity bit counter
212208
for bp in range(1, size_par + 1):
213209
# Bit counter one for a certain parity
214210
cont_bo = 0
@@ -222,8 +218,6 @@ def receptor_converter(size_par, data):
222218
cont_bo += 1
223219
parity.append(str(cont_bo % 2))
224220

225-
qtd_bp += 1
226-
227221
# Mount the message
228222
cont_bp = 0 # Parity bit counter
229223
for x in range(size_par + len(data_output)):

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ skip = """\
165165
nary.txt,strings/words.txt\
166166
"""
167167

168+
[tool.mypy]
169+
python_version = "3.14"
170+
168171
[tool.pytest]
169172
ini_options.markers = [
170173
"mat_ops: mark a test as utilizing matrix operations.",
@@ -182,9 +185,6 @@ report.omit = [
182185
]
183186
report.sort = "Cover"
184187

185-
[tool.mypy]
186-
python_version = "3.14"
187-
188188
[tool.sphinx-pyproject]
189189
copyright = "2014, TheAlgorithms"
190190
autoapi_dirs = [

sorts/pigeonhole_sort.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ def pigeonhole_sort(a):
1010
>>> pigeonhole_sort(a) # a destructive sort
1111
>>> a == b
1212
True
13+
14+
>>> pigeonhole_sort([])
1315
"""
16+
if not a:
17+
return
1418
# size of range of values in the list (ie, number of pigeonholes we need)
1519

1620
min_val = min(a) # min() finds the minimum value
@@ -38,7 +42,7 @@ def pigeonhole_sort(a):
3842
def main():
3943
a = [8, 3, 2, 7, 4, 6, 8]
4044
pigeonhole_sort(a)
41-
print("Sorted order is:", " ".join(a))
45+
print("Sorted order is:", *a)
4246

4347

4448
if __name__ == "__main__":

sorts/unknown_sort.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"""
77

88

9-
def merge_sort(collection):
9+
def merge_sort(collection: list) -> list:
1010
"""Pure implementation of the fastest merge sort algorithm in Python
1111
1212
:param collection: some mutable ordered collection with heterogeneous

0 commit comments

Comments
 (0)