Skip to content

Commit bda1d8c

Browse files
authored
Merge branch 'master' into master
2 parents c5ff411 + ae429ad commit bda1d8c

77 files changed

Lines changed: 1386 additions & 1614 deletions

File tree

Some content is hidden

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

‎.devcontainer/devcontainer.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
//
1010
// This repo tracks the latest-and-greatest CPython on the newest stable
1111
// Debian. Images are published per CPython minor version on Debian 13
12-
// "Trixie" (3.11-trixie ... 3.14-trixie); bump this to the newest available
12+
// "Trixie" (3.11-trixie ... 3.15-trixie); bump this to the newest available
1313
// when a new stable CPython ships.
14-
// NOTE: these images do not publish free-threaded (`t`) variants, so 3.14t
14+
// NOTE: these images do not publish free-threaded (`t`) variants, so 3.15t
1515
// cannot be selected via the tag alone -- but the repo's `.python-version`
16-
// pins 3.14t, and `uv run`/`uv sync` in the container honor it, so uv gives
17-
// contributors free-threaded 3.14t regardless of the base tag.
16+
// pins 3.15t, and `uv run`/`uv sync` in the container honor it, so uv gives
17+
// contributors free-threaded 3.15t regardless of the base tag.
1818
"image": "mcr.microsoft.com/devcontainers/python:latest",
1919

2020
// Install the tools post_install and CI expect (pre-commit + ruff), plus uv

‎.github/workflows/build.yml‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,15 @@ jobs:
2222
allow-prereleases: true
2323
- run: uv sync --group=test
2424
- name: Run tests
25-
# opencv-python is gated out on 3.14t (no cp314t wheel yet), so skip the
25+
# opencv-python is gated out on 3.15t (no cp315t wheel yet), so skip the
2626
# files that import cv2. Pure-Python algorithms in computer_vision/ and
2727
# data_compression/ still run; digital_image_processing/ is almost entirely
28-
# cv2-based so it is skipped as a tree. Re-enable when a cp314t wheel ships.
28+
# cv2-based so it is skipped as a tree. Re-enable when a cp315t wheel ships.
2929
# --ignore-gil-enabled: some compiled deps (sklearn, xgboost, ...) don't
3030
# yet ship the Py_mod_gil slot, so importing them re-enables the GIL under
31-
# 3.14t. That's an upstream-wheel gap, not our code; the flag lets the suite
31+
# 3.15t. That's an upstream-wheel gap, not our code; the flag lets the suite
3232
# run anyway and pytest-run-parallel still reports which tests are not
3333
# thread-safe. Drop the flag once the scientific stack ships free-threaded wheels.
34-
# qiskit is likewise gated out of the 3.14t deps (Qiskit/qiskit#16893), so the
35-
# single file that imports it (quantum/q_fourier_transform.py) is skipped too.
3634
run: uv run --with=pytest-run-parallel pytest
3735
--iterations=8 --parallel-threads=auto --ignore-gil-enabled
3836
--ignore=computer_vision/flip_augmentation.py
@@ -42,7 +40,6 @@ jobs:
4240
--ignore=digital_image_processing/
4341
--ignore=docs/conf.py
4442
--ignore=project_euler/
45-
--ignore=quantum/q_fourier_transform.py
4643
--ignore=scripts/validate_solutions.py
4744
--ignore=web_programming/current_stock_price.py
4845
--ignore=web_programming/fetch_anime_and_play.py

‎.github/workflows/ty.yml‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ jobs:
2828
# [build-system], so uv treats the project as virtual and installs only
2929
# its dependencies -- no "Multiple top-level packages discovered in a
3030
# flat-layout" error and no need for a src-layout. (`uv pip install .`
31-
# would force that wheel build and fail.) Pin a regular GIL 3.14 so typed
32-
# third-party dependencies resolve; the free-threaded 3.14t interpreter the
31+
# would force that wheel build and fail.) Pin a regular GIL 3.15 so typed
32+
# third-party dependencies resolve; the free-threaded 3.15t interpreter the
3333
# test matrix uses lacks wheels for several of them. ty itself is pulled in
3434
# ephemerally with `--with` so it needn't be added to the lockfile.
35-
- run: uv sync --python 3.14
36-
# Pin the *run* to the same regular-GIL 3.14 too. Without `--python 3.14`
35+
- run: uv sync --python 3.15
36+
# Pin the *run* to the same regular-GIL 3.15 too. Without `--python 3.15`
3737
# here, `uv run` re-resolved the project's default interpreter -- the
38-
# free-threaded 3.14t used by the test matrix -- so ty type-checked against
38+
# free-threaded 3.15t used by the test matrix -- so ty type-checked against
3939
# an env where many third-party stubs don't resolve, drowning real findings
40-
# in `unresolved-import` / `unresolved-attribute` noise. Pinning 3.14 lets
40+
# in `unresolved-import` / `unresolved-attribute` noise. Pinning 3.15 lets
4141
# ty see the synced dependencies, so the `[tool.ty.rules]` severities in
4242
# pyproject.toml apply to a meaningful baseline.
4343
#
@@ -50,4 +50,4 @@ jobs:
5050
# to make ty a required gate once the [tool.ty] baseline is clean.
5151
# `continue-on-error: true` above stays as a belt-and-suspenders guard so a
5252
# ty *crash* (not a diagnostic) can never block a merge either.
53-
- run: uv run --python 3.14 --with ty ty check --output-format=github --exit-zero
53+
- run: uv run --python 3.15 --with ty ty check --output-format=github --exit-zero

‎.pre-commit-config.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,9 @@ repos:
6363
rev: "0.26"
6464
hooks:
6565
- id: validate-pyproject
66+
67+
- repo: https://github.com/15r10nk/matchify
68+
rev: v0.2.0
69+
hooks:
70+
- id: matchify
71+
exclude: ^data_structures/linked_list/doubly_linked_list\.py$

‎.python-version‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.14t
1+
3.15t

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pre-commit run --all-files --show-diff-on-failure
100100

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

103-
- Please write in free-threaded Python 3.14t+. For instance: `print()` is a function in Python 3, so `print "Hello"` will *not* work, but `print("Hello")` will.
103+
- Please write in free-threaded Python 3.15t+. For instance: `print()` is a function in Python 3, so `print "Hello"` will *not* work, but `print("Hello")` will.
104104

105105
- 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.
106106
- Single-letter variable names are *old school*, so please avoid them unless their life only spans a few lines.

‎DIRECTORY.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,6 @@
14801480
* [Sol1](project_euler/problem_800/sol1.py)
14811481

14821482
## [Quantum](quantum)
1483-
* [Q Fourier Transform](quantum/q_fourier_transform.py)
14841483
* [Shor Algorithm](quantum/shor_algorithm.py)
14851484

14861485
## [Scheduling](scheduling)

‎ciphers/autokey.py‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,13 @@ def decrypt(ciphertext: str, key: str) -> str:
139139

140140
doctest.testmod()
141141
operation = int(input("Type 1 to encrypt or 2 to decrypt:"))
142-
if operation == 1:
143-
plaintext = input("Typeplaintext to be encrypted:\n")
144-
key = input("Type the key:\n")
145-
print(encrypt(plaintext, key))
146-
elif operation == 2:
147-
ciphertext = input("Type the ciphertext to be decrypted:\n")
148-
key = input("Type the key:\n")
149-
print(decrypt(ciphertext, key))
142+
match operation:
143+
case 1:
144+
plaintext = input("Typeplaintext to be encrypted:\n")
145+
key = input("Type the key:\n")
146+
print(encrypt(plaintext, key))
147+
case 2:
148+
ciphertext = input("Type the ciphertext to be decrypted:\n")
149+
key = input("Type the key:\n")
150+
print(decrypt(ciphertext, key))
150151
decrypt("jsqqs avvwo", "coffee")

‎ciphers/des_ecb.py‎

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -537,21 +537,26 @@ def decrypt(key: str, cipher_text: str) -> str:
537537
if mode not in ["e", "d", "k", "q"]:
538538
print("Invalid option. Please try again.")
539539
continue
540-
if mode == "q":
541-
break
542-
elif mode == "k":
543-
print(f"Generated key: {Des.generate_key()}")
544-
elif mode == "e":
545-
key = input("Enter the key: ").strip()
546-
if len(key) != 16 and not all(char in "0123456789abcdef" for char in key):
547-
print("Invalid key. Please try again.")
548-
continue
549-
input_string = input("Enter the string to encrypt: ").strip()
550-
print(f"Encrypted string: {Des.encrypt(key, input_string)}")
551-
elif mode == "d":
552-
key = input("Enter the key: ").strip()
553-
if len(key) != 16 and not all(char in "0123456789abcdef" for char in key):
554-
print("Invalid key. Please try again.")
555-
continue
556-
cipher_text = input("Enter the cipher text to decrypt: ").strip()
557-
print(f"Decrypted string: {Des.decrypt(key, cipher_text)}")
540+
match mode:
541+
case "q":
542+
break
543+
case "k":
544+
print(f"Generated key: {Des.generate_key()}")
545+
case "e":
546+
key = input("Enter the key: ").strip()
547+
if len(key) != 16 and not all(
548+
char in "0123456789abcdef" for char in key
549+
):
550+
print("Invalid key. Please try again.")
551+
continue
552+
input_string = input("Enter the string to encrypt: ").strip()
553+
print(f"Encrypted string: {Des.encrypt(key, input_string)}")
554+
case "d":
555+
key = input("Enter the key: ").strip()
556+
if len(key) != 16 and not all(
557+
char in "0123456789abcdef" for char in key
558+
):
559+
print("Invalid key. Please try again.")
560+
continue
561+
cipher_text = input("Enter the cipher text to decrypt: ").strip()
562+
print(f"Decrypted string: {Des.decrypt(key, cipher_text)}")

‎ciphers/hill_cipher.py‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,15 @@ def main() -> None:
203203

204204
print("Would you like to encrypt or decrypt some text? (1 or 2)")
205205
option = input("\n1. Encrypt\n2. Decrypt\n")
206-
if option == "1":
207-
text_e = input("What text would you like to encrypt?: ")
208-
print("Your encrypted text is:")
209-
print(hc.encrypt(text_e))
210-
elif option == "2":
211-
text_d = input("What text would you like to decrypt?: ")
212-
print("Your decrypted text is:")
213-
print(hc.decrypt(text_d))
206+
match option:
207+
case "1":
208+
text_e = input("What text would you like to encrypt?: ")
209+
print("Your encrypted text is:")
210+
print(hc.encrypt(text_e))
211+
case "2":
212+
text_d = input("What text would you like to decrypt?: ")
213+
print("Your decrypted text is:")
214+
print(hc.decrypt(text_d))
214215

215216

216217
if __name__ == "__main__":

0 commit comments

Comments
 (0)