Skip to content

Commit 0f4e512

Browse files
cclaussgithub-actions
and
github-actions
authored
Upgrade to Python 3.12 (TheAlgorithms#9576)
* DRAFT: GitHub Actions: Test on Python 3.12 Repeats TheAlgorithms#8777 * TheAlgorithms#8777 Some of our dependencies will not be ready yet. * Python 3.12: Disable qiskit and tensorflow algorithms * updating DIRECTORY.md --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent f964dcb commit 0f4e512

21 files changed

+15
-31
lines changed

.github/workflows/build.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1313
- uses: actions/setup-python@v4
1414
with:
15-
python-version: 3.11
15+
python-version: 3.12
16+
allow-prereleases: true
1617
- uses: actions/cache@v3
1718
with:
1819
path: ~/.cache/pip

.github/workflows/ruff.yml

+1-1
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@v3
14+
- uses: actions/checkout@v4
1515
- run: pip install --user ruff
1616
- run: ruff --output-format=github .

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pre-commit run --all-files --show-diff-on-failure
7373

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

76-
- Please write in Python 3.11+. For instance: `print()` is a function in Python 3 so `print "Hello"` will *not* work but `print("Hello")` will.
76+
- 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.
7777
- 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.
7878
- Single letter variable names are *old school* so please avoid them unless their life only spans a few lines.
7979
- Expand acronyms because `gcd()` is hard to understand but `greatest_common_divisor()` is not.

DIRECTORY.md

-19
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
* [Hamiltonian Cycle](backtracking/hamiltonian_cycle.py)
2727
* [Knight Tour](backtracking/knight_tour.py)
2828
* [Minimax](backtracking/minimax.py)
29-
* [Minmax](backtracking/minmax.py)
3029
* [N Queens](backtracking/n_queens.py)
3130
* [N Queens Math](backtracking/n_queens_math.py)
3231
* [Power Sum](backtracking/power_sum.py)
@@ -133,7 +132,6 @@
133132
* [Run Length Encoding](compression/run_length_encoding.py)
134133

135134
## Computer Vision
136-
* [Cnn Classification](computer_vision/cnn_classification.py)
137135
* [Flip Augmentation](computer_vision/flip_augmentation.py)
138136
* [Haralick Descriptors](computer_vision/haralick_descriptors.py)
139137
* [Harris Corner](computer_vision/harris_corner.py)
@@ -321,7 +319,6 @@
321319
* [Floyd Warshall](dynamic_programming/floyd_warshall.py)
322320
* [Integer Partition](dynamic_programming/integer_partition.py)
323321
* [Iterating Through Submasks](dynamic_programming/iterating_through_submasks.py)
324-
* [K Means Clustering Tensorflow](dynamic_programming/k_means_clustering_tensorflow.py)
325322
* [Knapsack](dynamic_programming/knapsack.py)
326323
* [Longest Common Subsequence](dynamic_programming/longest_common_subsequence.py)
327324
* [Longest Common Substring](dynamic_programming/longest_common_substring.py)
@@ -384,9 +381,6 @@
384381
* [Mandelbrot](fractals/mandelbrot.py)
385382
* [Sierpinski Triangle](fractals/sierpinski_triangle.py)
386383

387-
## Fuzzy Logic
388-
* [Fuzzy Operations](fuzzy_logic/fuzzy_operations.py)
389-
390384
## Genetic Algorithm
391385
* [Basic String](genetic_algorithm/basic_string.py)
392386

@@ -517,8 +511,6 @@
517511
* Local Weighted Learning
518512
* [Local Weighted Learning](machine_learning/local_weighted_learning/local_weighted_learning.py)
519513
* [Logistic Regression](machine_learning/logistic_regression.py)
520-
* Lstm
521-
* [Lstm Prediction](machine_learning/lstm/lstm_prediction.py)
522514
* [Mfcc](machine_learning/mfcc.py)
523515
* [Multilayer Perceptron Classifier](machine_learning/multilayer_perceptron_classifier.py)
524516
* [Polynomial Regression](machine_learning/polynomial_regression.py)
@@ -613,7 +605,6 @@
613605
* [Matrix Exponentiation](maths/matrix_exponentiation.py)
614606
* [Max Sum Sliding Window](maths/max_sum_sliding_window.py)
615607
* [Median Of Two Arrays](maths/median_of_two_arrays.py)
616-
* [Miller Rabin](maths/miller_rabin.py)
617608
* [Mobius Function](maths/mobius_function.py)
618609
* [Modular Exponential](maths/modular_exponential.py)
619610
* [Monte Carlo](maths/monte_carlo.py)
@@ -1071,17 +1062,7 @@
10711062
* [Sol1](project_euler/problem_800/sol1.py)
10721063

10731064
## Quantum
1074-
* [Bb84](quantum/bb84.py)
1075-
* [Deutsch Jozsa](quantum/deutsch_jozsa.py)
1076-
* [Half Adder](quantum/half_adder.py)
1077-
* [Not Gate](quantum/not_gate.py)
10781065
* [Q Fourier Transform](quantum/q_fourier_transform.py)
1079-
* [Q Full Adder](quantum/q_full_adder.py)
1080-
* [Quantum Entanglement](quantum/quantum_entanglement.py)
1081-
* [Quantum Teleportation](quantum/quantum_teleportation.py)
1082-
* [Ripple Adder Classic](quantum/ripple_adder_classic.py)
1083-
* [Single Qubit Measure](quantum/single_qubit_measure.py)
1084-
* [Superdense Coding](quantum/superdense_coding.py)
10851066

10861067
## Scheduling
10871068
* [First Come First Served](scheduling/first_come_first_served.py)

backtracking/combination_sum.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def combination_sum(candidates: list, target: int) -> list:
4747
>>> combination_sum([-8, 2.3, 0], 1)
4848
Traceback (most recent call last):
4949
...
50-
RecursionError: maximum recursion depth exceeded in comparison
50+
RecursionError: maximum recursion depth exceeded
5151
"""
5252
path = [] # type: list[int]
5353
answer = [] # type: list[int]

maths/maclaurin_series.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ def maclaurin_sin(theta: float, accuracy: int = 30) -> float:
1717
>>> all(isclose(maclaurin_sin(x, 50), sin(x)) for x in range(-25, 25))
1818
True
1919
>>> maclaurin_sin(10)
20-
-0.544021110889369
20+
-0.5440211108893691
2121
>>> maclaurin_sin(-10)
22-
0.5440211108893703
22+
0.5440211108893704
2323
>>> maclaurin_sin(10, 15)
2424
-0.5440211108893689
2525
>>> maclaurin_sin(-10, 15)
@@ -69,9 +69,9 @@ def maclaurin_cos(theta: float, accuracy: int = 30) -> float:
6969
>>> all(isclose(maclaurin_cos(x, 50), cos(x)) for x in range(-25, 25))
7070
True
7171
>>> maclaurin_cos(5)
72-
0.28366218546322675
72+
0.2836621854632268
7373
>>> maclaurin_cos(-5)
74-
0.2836621854632266
74+
0.2836621854632265
7575
>>> maclaurin_cos(10, 15)
7676
-0.8390715290764525
7777
>>> maclaurin_cos(-10, 15)
File renamed without changes.

quantum/deutsch_jozsa.py renamed to quantum/deutsch_jozsa.py.DISABLED.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# DISABLED!!
12
#!/usr/bin/env python3
23
"""
34
Deutsch-Jozsa Algorithm is one of the first examples of a quantum

quantum/half_adder.py renamed to quantum/half_adder.py.DISABLED.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# DISABLED!!
12
#!/usr/bin/env python3
23
"""
34
Build a half-adder quantum circuit that takes two bits as input,
File renamed without changes.
File renamed without changes.

requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ opencv-python
99
pandas
1010
pillow
1111
projectq
12-
qiskit
13-
qiskit-aer
12+
qiskit ; python_version < '3.12'
13+
qiskit-aer ; python_version < '3.12'
1414
requests
1515
rich
1616
scikit-fuzzy
1717
scikit-learn
1818
statsmodels
1919
sympy
20-
tensorflow
20+
tensorflow ; python_version < '3.12'
2121
texttable
2222
tweepy
2323
xgboost

0 commit comments

Comments
 (0)