Skip to content

Commit 2701dcd

Browse files
committed
Merge branch 'master' into fix-some-RUF012-per-file-ignores
2 parents 54cb87f + 804a8b7 commit 2701dcd

File tree

180 files changed

+4153
-754
lines changed

Some content is hidden

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

180 files changed

+4153
-754
lines changed

.devcontainer/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# https://github.com/microsoft/vscode-dev-containers/blob/main/containers/python-3/README.md
2-
ARG VARIANT=3.12-bookworm
2+
ARG VARIANT=3.13-bookworm
33
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}
44
COPY requirements.txt /tmp/pip-tmp/
55
RUN python3 -m pip install --upgrade pip \

.devcontainer/devcontainer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// Update 'VARIANT' to pick a Python version: 3, 3.11, 3.10, 3.9, 3.8
88
// Append -bullseye or -buster to pin to an OS version.
99
// Use -bullseye variants on local on arm64/Apple Silicon.
10-
"VARIANT": "3.12-bookworm",
10+
"VARIANT": "3.13-bookworm",
1111
}
1212
},
1313

.github/CODEOWNERS

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
/.* @cclauss
1111

12-
# /arithmetic_analysis/
13-
1412
# /backtracking/
1513

1614
# /bit_manipulation/

.github/workflows/build.yml

+13-11
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,25 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13+
- uses: astral-sh/setup-uv@v4
14+
with:
15+
enable-cache: true
16+
cache-dependency-glob: uv.lock
1317
- uses: actions/setup-python@v5
1418
with:
15-
python-version: 3.12
19+
python-version: 3.13
1620
allow-prereleases: true
17-
- uses: actions/cache@v4
18-
with:
19-
path: ~/.cache/pip
20-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip setuptools six wheel
24-
python -m pip install pytest-cov -r requirements.txt
21+
- run: uv sync --group=test
2522
- name: Run tests
2623
# TODO: #8818 Re-enable quantum tests
27-
run: pytest
28-
--ignore=quantum/q_fourier_transform.py
24+
run: uv run pytest
25+
--ignore=computer_vision/cnn_classification.py
26+
--ignore=docs/conf.py
27+
--ignore=dynamic_programming/k_means_clustering_tensorflow.py
28+
--ignore=machine_learning/lstm/lstm_prediction.py
29+
--ignore=neural_network/input_data.py
2930
--ignore=project_euler/
31+
--ignore=quantum/q_fourier_transform.py
3032
--ignore=scripts/validate_solutions.py
3133
--cov-report=term-missing:skip-covered
3234
--cov=. .

.github/workflows/project_euler.yml

+6-10
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,21 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18+
- uses: astral-sh/setup-uv@v4
1819
- uses: actions/setup-python@v5
1920
with:
2021
python-version: 3.x
21-
- name: Install pytest and pytest-cov
22-
run: |
23-
python -m pip install --upgrade pip
24-
python -m pip install --upgrade numpy pytest pytest-cov
25-
- run: pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
22+
- run: uv sync --group=euler-validate --group=test
23+
- run: uv run pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
2624
validate-solutions:
2725
runs-on: ubuntu-latest
2826
steps:
2927
- uses: actions/checkout@v4
28+
- uses: astral-sh/setup-uv@v4
3029
- uses: actions/setup-python@v5
3130
with:
3231
python-version: 3.x
33-
- name: Install pytest and requests
34-
run: |
35-
python -m pip install --upgrade pip
36-
python -m pip install --upgrade numpy pytest requests
37-
- run: pytest scripts/validate_solutions.py
32+
- run: uv sync --group=euler-validate --group=test
33+
- run: uv run pytest scripts/validate_solutions.py
3834
env:
3935
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ruff.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v4
15-
- run: pip install --user ruff
16-
- run: ruff check --output-format=github .
15+
- uses: astral-sh/setup-uv@v4
16+
- run: uvx ruff check --output-format=github .

.github/workflows/sphinx.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: sphinx
2+
3+
on:
4+
# Triggers the workflow on push or pull request events but only for the "master" branch
5+
push:
6+
branches: ["master"]
7+
pull_request:
8+
branches: ["master"]
9+
# Or manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
jobs:
25+
build_docs:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: astral-sh/setup-uv@v4
30+
- uses: actions/setup-python@v5
31+
with:
32+
python-version: 3.13
33+
allow-prereleases: true
34+
- run: uv sync --group=docs
35+
- uses: actions/configure-pages@v5
36+
- run: uv run sphinx-build -c docs . docs/_build/html
37+
- uses: actions/upload-pages-artifact@v3
38+
with:
39+
path: docs/_build/html
40+
41+
deploy_docs:
42+
environment:
43+
name: github-pages
44+
url: ${{ steps.deployment.outputs.page_url }}
45+
if: github.event_name != 'pull_request'
46+
needs: build_docs
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/deploy-pages@v4
50+
id: deployment

.pre-commit-config.yaml

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.6.0
3+
rev: v5.0.0
44
hooks:
55
- id: check-executables-have-shebangs
66
- id: check-toml
@@ -16,20 +16,20 @@ repos:
1616
- id: auto-walrus
1717

1818
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: v0.4.3
19+
rev: v0.8.3
2020
hooks:
2121
- id: ruff
2222
- id: ruff-format
2323

2424
- repo: https://github.com/codespell-project/codespell
25-
rev: v2.2.6
25+
rev: v2.3.0
2626
hooks:
2727
- id: codespell
2828
additional_dependencies:
2929
- tomli
3030

3131
- repo: https://github.com/tox-dev/pyproject-fmt
32-
rev: "1.8.0"
32+
rev: "v2.5.0"
3333
hooks:
3434
- id: pyproject-fmt
3535

@@ -42,15 +42,16 @@ repos:
4242
pass_filenames: false
4343

4444
- repo: https://github.com/abravalheri/validate-pyproject
45-
rev: v0.16
45+
rev: v0.23
4646
hooks:
4747
- id: validate-pyproject
4848

4949
- repo: https://github.com/pre-commit/mirrors-mypy
50-
rev: v1.10.0
50+
rev: v1.13.0
5151
hooks:
5252
- id: mypy
5353
args:
54+
- --explicit-package-bases
5455
- --ignore-missing-imports
5556
- --install-types # See mirrors-mypy README.md
5657
- --non-interactive

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pre-commit run --all-files --show-diff-on-failure
7777

7878
We want your work to be readable by others; therefore, we encourage you to note the following:
7979

80-
- Please write in Python 3.12+. For instance: `print()` is a function in Python 3 so `print "Hello"` will *not* work but `print("Hello")` will.
80+
- Please write in Python 3.13+. For instance: `print()` is a function in Python 3 so `print "Hello"` will *not* work but `print("Hello")` will.
8181
- Please focus hard on the naming of functions, classes, and variables. Help your reader by using __descriptive names__ that can help you to remove redundant comments.
8282
- Single letter variable names are *old school* so please avoid them unless their life only spans a few lines.
8383
- Expand acronyms because `gcd()` is hard to understand but `greatest_common_divisor()` is not.
@@ -96,7 +96,7 @@ We want your work to be readable by others; therefore, we encourage you to note
9696

9797
```bash
9898
python3 -m pip install ruff # only required the first time
99-
ruff .
99+
ruff check
100100
```
101101

102102
- Original code submission require docstrings or comments to describe your work.

DIRECTORY.md

+29-4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* [Rat In Maze](backtracking/rat_in_maze.py)
2323
* [Sudoku](backtracking/sudoku.py)
2424
* [Sum Of Subsets](backtracking/sum_of_subsets.py)
25+
* [Word Break](backtracking/word_break.py)
26+
* [Word Ladder](backtracking/word_ladder.py)
2527
* [Word Search](backtracking/word_search.py)
2628

2729
## Bit Manipulation
@@ -98,6 +100,7 @@
98100
* [Elgamal Key Generator](ciphers/elgamal_key_generator.py)
99101
* [Enigma Machine2](ciphers/enigma_machine2.py)
100102
* [Fractionated Morse Cipher](ciphers/fractionated_morse_cipher.py)
103+
* [Gronsfeld Cipher](ciphers/gronsfeld_cipher.py)
101104
* [Hill Cipher](ciphers/hill_cipher.py)
102105
* [Mixed Keyword Cypher](ciphers/mixed_keyword_cypher.py)
103106
* [Mono Alphabetic Ciphers](ciphers/mono_alphabetic_ciphers.py)
@@ -210,6 +213,7 @@
210213
* [Lazy Segment Tree](data_structures/binary_tree/lazy_segment_tree.py)
211214
* [Lowest Common Ancestor](data_structures/binary_tree/lowest_common_ancestor.py)
212215
* [Maximum Fenwick Tree](data_structures/binary_tree/maximum_fenwick_tree.py)
216+
* [Maximum Sum Bst](data_structures/binary_tree/maximum_sum_bst.py)
213217
* [Merge Two Binary Trees](data_structures/binary_tree/merge_two_binary_trees.py)
214218
* [Mirror Binary Tree](data_structures/binary_tree/mirror_binary_tree.py)
215219
* [Non Recursive Segment Tree](data_structures/binary_tree/non_recursive_segment_tree.py)
@@ -243,6 +247,15 @@
243247
* [Min Heap](data_structures/heap/min_heap.py)
244248
* [Randomized Heap](data_structures/heap/randomized_heap.py)
245249
* [Skew Heap](data_structures/heap/skew_heap.py)
250+
* Kd Tree
251+
* [Build Kdtree](data_structures/kd_tree/build_kdtree.py)
252+
* Example
253+
* [Example Usage](data_structures/kd_tree/example/example_usage.py)
254+
* [Hypercube Points](data_structures/kd_tree/example/hypercube_points.py)
255+
* [Kd Node](data_structures/kd_tree/kd_node.py)
256+
* [Nearest Neighbour Search](data_structures/kd_tree/nearest_neighbour_search.py)
257+
* Tests
258+
* [Test Kdtree](data_structures/kd_tree/tests/test_kdtree.py)
246259
* Linked List
247260
* [Circular Linked List](data_structures/linked_list/circular_linked_list.py)
248261
* [Deque Doubly](data_structures/linked_list/deque_doubly.py)
@@ -274,6 +287,7 @@
274287
* [Dijkstras Two Stack Algorithm](data_structures/stacks/dijkstras_two_stack_algorithm.py)
275288
* [Infix To Postfix Conversion](data_structures/stacks/infix_to_postfix_conversion.py)
276289
* [Infix To Prefix Conversion](data_structures/stacks/infix_to_prefix_conversion.py)
290+
* [Lexicographical Numbers](data_structures/stacks/lexicographical_numbers.py)
277291
* [Next Greater Element](data_structures/stacks/next_greater_element.py)
278292
* [Postfix Evaluation](data_structures/stacks/postfix_evaluation.py)
279293
* [Prefix Evaluation](data_structures/stacks/prefix_evaluation.py)
@@ -282,6 +296,13 @@
282296
* [Stack With Doubly Linked List](data_structures/stacks/stack_with_doubly_linked_list.py)
283297
* [Stack With Singly Linked List](data_structures/stacks/stack_with_singly_linked_list.py)
284298
* [Stock Span Problem](data_structures/stacks/stock_span_problem.py)
299+
* Suffix Tree
300+
* Example
301+
* [Example Usage](data_structures/suffix_tree/example/example_usage.py)
302+
* [Suffix Tree](data_structures/suffix_tree/suffix_tree.py)
303+
* [Suffix Tree Node](data_structures/suffix_tree/suffix_tree_node.py)
304+
* Tests
305+
* [Test Suffix Tree](data_structures/suffix_tree/tests/test_suffix_tree.py)
285306
* Trie
286307
* [Radix Tree](data_structures/trie/radix_tree.py)
287308
* [Trie](data_structures/trie/trie.py)
@@ -330,6 +351,9 @@
330351
* [Power](divide_and_conquer/power.py)
331352
* [Strassen Matrix Multiplication](divide_and_conquer/strassen_matrix_multiplication.py)
332353

354+
## Docs
355+
* [Conf](docs/conf.py)
356+
333357
## Dynamic Programming
334358
* [Abbreviation](dynamic_programming/abbreviation.py)
335359
* [All Construct](dynamic_programming/all_construct.py)
@@ -540,8 +564,7 @@
540564
* [Lu Decomposition](linear_algebra/lu_decomposition.py)
541565
* Src
542566
* [Conjugate Gradient](linear_algebra/src/conjugate_gradient.py)
543-
* Gaussian Elimination Pivoting
544-
* [Gaussian Elimination Pivoting](linear_algebra/src/gaussian_elimination_pivoting/gaussian_elimination_pivoting.py)
567+
* [Gaussian Elimination Pivoting](linear_algebra/src/gaussian_elimination_pivoting.py)
545568
* [Lib](linear_algebra/src/lib.py)
546569
* [Polynom For Points](linear_algebra/src/polynom_for_points.py)
547570
* [Power Iteration](linear_algebra/src/power_iteration.py)
@@ -661,7 +684,6 @@
661684
* [Manhattan Distance](maths/manhattan_distance.py)
662685
* [Matrix Exponentiation](maths/matrix_exponentiation.py)
663686
* [Max Sum Sliding Window](maths/max_sum_sliding_window.py)
664-
* [Median Of Two Arrays](maths/median_of_two_arrays.py)
665687
* [Minkowski Distance](maths/minkowski_distance.py)
666688
* [Mobius Function](maths/mobius_function.py)
667689
* [Modular Division](maths/modular_division.py)
@@ -772,6 +794,7 @@
772794
* [Cramers Rule 2X2](matrix/cramers_rule_2x2.py)
773795
* [Inverse Of Matrix](matrix/inverse_of_matrix.py)
774796
* [Largest Square Area In Matrix](matrix/largest_square_area_in_matrix.py)
797+
* [Matrix Based Game](matrix/matrix_based_game.py)
775798
* [Matrix Class](matrix/matrix_class.py)
776799
* [Matrix Equalization](matrix/matrix_equalization.py)
777800
* [Matrix Multiplication Recursion](matrix/matrix_multiplication_recursion.py)
@@ -864,6 +887,7 @@
864887
* [Newtons Second Law Of Motion](physics/newtons_second_law_of_motion.py)
865888
* [Photoelectric Effect](physics/photoelectric_effect.py)
866889
* [Potential Energy](physics/potential_energy.py)
890+
* [Rainfall Intensity](physics/rainfall_intensity.py)
867891
* [Reynolds Number](physics/reynolds_number.py)
868892
* [Rms Speed Of Molecule](physics/rms_speed_of_molecule.py)
869893
* [Shear Stress](physics/shear_stress.py)
@@ -1185,6 +1209,7 @@
11851209
* [Binary Tree Traversal](searches/binary_tree_traversal.py)
11861210
* [Double Linear Search](searches/double_linear_search.py)
11871211
* [Double Linear Search Recursion](searches/double_linear_search_recursion.py)
1212+
* [Exponential Search](searches/exponential_search.py)
11881213
* [Fibonacci Search](searches/fibonacci_search.py)
11891214
* [Hill Climbing](searches/hill_climbing.py)
11901215
* [Interpolation Search](searches/interpolation_search.py)
@@ -1260,6 +1285,7 @@
12601285
* [Can String Be Rearranged As Palindrome](strings/can_string_be_rearranged_as_palindrome.py)
12611286
* [Capitalize](strings/capitalize.py)
12621287
* [Check Anagrams](strings/check_anagrams.py)
1288+
* [Count Vowels](strings/count_vowels.py)
12631289
* [Credit Card Validator](strings/credit_card_validator.py)
12641290
* [Damerau Levenshtein Distance](strings/damerau_levenshtein_distance.py)
12651291
* [Detecting English Programmatically](strings/detecting_english_programmatically.py)
@@ -1327,7 +1353,6 @@
13271353
* [Get Ip Geolocation](web_programming/get_ip_geolocation.py)
13281354
* [Get Top Billionaires](web_programming/get_top_billionaires.py)
13291355
* [Get Top Hn Posts](web_programming/get_top_hn_posts.py)
1330-
* [Get User Tweets](web_programming/get_user_tweets.py)
13311356
* [Giphy](web_programming/giphy.py)
13321357
* [Instagram Crawler](web_programming/instagram_crawler.py)
13331358
* [Instagram Pic](web_programming/instagram_pic.py)

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
MIT License
1+
## MIT License
22

33
Copyright (c) 2016-2022 TheAlgorithms and contributors
44

0 commit comments

Comments
 (0)