Skip to content

Commit e035566

Browse files
authored
Merge branch 'master' into add-next-greater-element
2 parents 8749385 + 791deb4 commit e035566

66 files changed

Lines changed: 1342 additions & 182 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,8 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- run:
13-
sudo apt-get update && sudo apt-get install -y libtiff5-dev libjpeg8-dev libopenjp2-7-dev
14-
zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
15-
libharfbuzz-dev libfribidi-dev libxcb1-dev
16-
libxml2-dev libxslt-dev
17-
libhdf5-dev
18-
libopenblas-dev
19-
- uses: actions/checkout@v5
12+
- run: sudo apt-get update && sudo apt-get install -y libhdf5-dev
13+
- uses: actions/checkout@v6
2014
- uses: astral-sh/setup-uv@v7
2115
with:
2216
enable-cache: true
@@ -28,10 +22,12 @@ jobs:
2822
- run: uv sync --group=test
2923
- name: Run tests
3024
# TODO: #8818 Re-enable quantum tests
31-
run: uv run pytest
25+
run: uv run --with=pytest-run-parallel pytest
26+
--iterations=8 --parallel-threads=auto
3227
--ignore=computer_vision/cnn_classification.py
3328
--ignore=docs/conf.py
3429
--ignore=dynamic_programming/k_means_clustering_tensorflow.py
30+
--ignore=machine_learning/local_weighted_learning/local_weighted_learning.py
3531
--ignore=machine_learning/lstm/lstm_prediction.py
3632
--ignore=neural_network/input_data.py
3733
--ignore=project_euler/

.github/workflows/devcontainer_ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v5
15+
- uses: actions/checkout@v6
1616
- uses: devcontainers/ci@v0.3
1717
with:
1818
push: never

.github/workflows/directory_writer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
directory_writer:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v5
9+
- uses: actions/checkout@v6
1010
with:
1111
fetch-depth: 0
1212
- uses: actions/setup-python@v6

.github/workflows/project_euler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
libxml2-dev libxslt-dev
2222
libhdf5-dev
2323
libopenblas-dev
24-
- uses: actions/checkout@v5
24+
- uses: actions/checkout@v6
2525
- uses: astral-sh/setup-uv@v7
2626
- uses: actions/setup-python@v6
2727
with:
@@ -39,7 +39,7 @@ jobs:
3939
libxml2-dev libxslt-dev
4040
libhdf5-dev
4141
libopenblas-dev
42-
- uses: actions/checkout@v5
42+
- uses: actions/checkout@v6
4343
- uses: astral-sh/setup-uv@v7
4444
- uses: actions/setup-python@v6
4545
with:

.github/workflows/ruff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
ruff:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v5
14+
- uses: actions/checkout@v6
1515
- uses: astral-sh/setup-uv@v7
1616
- run: uvx ruff check --output-format=github .

.github/workflows/sphinx.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ jobs:
3232
libxml2-dev libxslt-dev
3333
libhdf5-dev
3434
libopenblas-dev
35-
- uses: actions/checkout@v5
35+
- uses: actions/checkout@v6
3636
- uses: astral-sh/setup-uv@v7
3737
- uses: actions/setup-python@v6
3838
with:
3939
python-version: 3.14
4040
allow-prereleases: true
4141
- run: uv sync --group=docs
42-
- uses: actions/configure-pages@v5
42+
- 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

@@ -53,5 +53,5 @@ jobs:
5353
needs: build_docs
5454
runs-on: ubuntu-latest
5555
steps:
56-
- uses: actions/deploy-pages@v4
56+
- uses: actions/deploy-pages@v5
5757
id: deployment

.pre-commit-config.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,25 @@ repos:
1414
- id: requirements-txt-fixer
1515

1616
- repo: https://github.com/MarcoGorelli/auto-walrus
17-
rev: 0.3.4
17+
rev: 0.4.1
1818
hooks:
1919
- id: auto-walrus
2020

2121
- repo: https://github.com/astral-sh/ruff-pre-commit
22-
rev: v0.13.3
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.7.0
35+
rev: v2.21.0
3636
hooks:
3737
- id: pyproject-fmt
3838

@@ -45,19 +45,19 @@ repos:
4545
pass_filenames: false
4646

4747
- repo: https://github.com/abravalheri/validate-pyproject
48-
rev: v0.24.1
48+
rev: v0.25
4949
hooks:
5050
- id: validate-pyproject
5151

52-
- repo: https://github.com/pre-commit/mirrors-mypy
53-
rev: v1.18.2
54-
hooks:
55-
- id: mypy
56-
args:
57-
- --explicit-package-bases
58-
- --ignore-missing-imports
59-
- --install-types
60-
- --non-interactive
52+
# - repo: https://github.com/pre-commit/mirrors-mypy
53+
# rev: v1.20.0
54+
# hooks:
55+
# - id: mypy
56+
# args:
57+
# - --explicit-package-bases
58+
# - --ignore-missing-imports
59+
# - --install-types
60+
# - --non-interactive
6161

6262
- repo: https://github.com/pre-commit/mirrors-prettier
6363
rev: v4.0.0-alpha.8

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ We want your work to be readable by others; therefore, we encourage you to note
9999
ruff check
100100
```
101101

102-
- Original code submission require docstrings or comments to describe your work.
102+
- Original code submissions require docstrings or comments to describe your work.
103103

104104
- More on docstrings and comments:
105105

@@ -159,7 +159,7 @@ We want your work to be readable by others; therefore, we encourage you to note
159159
starting_value = int(input("Please enter a starting value: ").strip())
160160
```
161161

162-
The use of [Python type hints](https://docs.python.org/3/library/typing.html) is encouraged for function parameters and return values. Our automated testing will run [mypy](http://mypy-lang.org) so run that locally before making your submission.
162+
The use of [Python type hints](https://docs.python.org/3/library/typing.html) is encouraged for function parameters and return values. Our automated testing will run [mypy](https://mypy-lang.org) so run that locally before making your submission.
163163

164164
```python
165165
def sum_ab(a: int, b: int) -> int:

DIRECTORY.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@
398398
* [Minimum Squares To Represent A Number](dynamic_programming/minimum_squares_to_represent_a_number.py)
399399
* [Minimum Steps To One](dynamic_programming/minimum_steps_to_one.py)
400400
* [Minimum Tickets Cost](dynamic_programming/minimum_tickets_cost.py)
401+
* [Narcissistic Number](dynamic_programming/narcissistic_number.py)
401402
* [Optimal Binary Search Tree](dynamic_programming/optimal_binary_search_tree.py)
402403
* [Palindrome Partitioning](dynamic_programming/palindrome_partitioning.py)
403404
* [Range Sum Query](dynamic_programming/range_sum_query.py)
@@ -468,6 +469,11 @@
468469

469470
## Geometry
470471
* [Geometry](geometry/geometry.py)
472+
* [Graham Scan](geometry/graham_scan.py)
473+
* [Jarvis March](geometry/jarvis_march.py)
474+
* Tests
475+
* [Test Graham Scan](geometry/tests/test_graham_scan.py)
476+
* [Test Jarvis March](geometry/tests/test_jarvis_march.py)
471477

472478
## Graphics
473479
* [Bezier Curve](graphics/bezier_curve.py)
@@ -624,6 +630,7 @@
624630
* [Sequential Minimum Optimization](machine_learning/sequential_minimum_optimization.py)
625631
* [Similarity Search](machine_learning/similarity_search.py)
626632
* [Support Vector Machines](machine_learning/support_vector_machines.py)
633+
* [T Stochastic Neighbour Embedding](machine_learning/t_stochastic_neighbour_embedding.py)
627634
* [Word Frequency Functions](machine_learning/word_frequency_functions.py)
628635
* [Xgboost Classifier](machine_learning/xgboost_classifier.py)
629636
* [Xgboost Regressor](machine_learning/xgboost_regressor.py)
@@ -879,6 +886,7 @@
879886
* [Quine](other/quine.py)
880887
* [Scoring Algorithm](other/scoring_algorithm.py)
881888
* [Sdes](other/sdes.py)
889+
* [Sliding Window Maximum](other/sliding_window_maximum.py)
882890
* [Tower Of Hanoi](other/tower_of_hanoi.py)
883891
* [Word Search](other/word_search.py)
884892

@@ -978,6 +986,7 @@
978986
* [Sol2](project_euler/problem_014/sol2.py)
979987
* Problem 015
980988
* [Sol1](project_euler/problem_015/sol1.py)
989+
* [Sol2](project_euler/problem_015/sol2.py)
981990
* Problem 016
982991
* [Sol1](project_euler/problem_016/sol1.py)
983992
* [Sol2](project_euler/problem_016/sol2.py)

backtracking/coloring.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ def color(graph: list[list[int]], max_colors: int) -> list[int]:
104104
>>> max_colors = 2
105105
>>> color(graph, max_colors)
106106
[]
107+
>>> color([], 2) # empty graph
108+
[]
109+
>>> color([[0]], 1) # single node, 1 color
110+
[0]
111+
>>> color([[0, 1], [1, 0]], 1) # 2 nodes, 1 color (impossible)
112+
[]
113+
>>> color([[0, 1], [1, 0]], 2) # 2 nodes, 2 colors (possible)
114+
[0, 1]
107115
"""
108116
colored_vertices = [-1] * len(graph)
109117

0 commit comments

Comments
 (0)