Skip to content

Commit fd27953

Browse files
Reenable files when TensorFlow supports the current Python (#11318)
* Remove python_version < '3.12' for tensorflow * Reenable dynamic_programming/k_means_clustering_tensorflow.py * updating DIRECTORY.md * Try to fix ruff * Try to fix ruff * Try to fix ruff * Try to fix ruff * Try to fix ruff * Reenable machine_learning/lstm/lstm_prediction.py * updating DIRECTORY.md * Try to fix ruff * Reenable computer_vision/cnn_classification.py * updating DIRECTORY.md * Reenable neural_network/input_data.py * updating DIRECTORY.md * Try to fix ruff * Try to fix ruff * Try to fix mypy * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Try to fix ruff * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: MaximSmolskiy <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent c6ca194 commit fd27953

File tree

8 files changed

+27
-19
lines changed

8 files changed

+27
-19
lines changed

Diff for: DIRECTORY.md

+5
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@
134134
* [Run Length Encoding](compression/run_length_encoding.py)
135135

136136
## Computer Vision
137+
* [Cnn Classification](computer_vision/cnn_classification.py)
137138
* [Flip Augmentation](computer_vision/flip_augmentation.py)
138139
* [Haralick Descriptors](computer_vision/haralick_descriptors.py)
139140
* [Harris Corner](computer_vision/harris_corner.py)
@@ -344,6 +345,7 @@
344345
* [Floyd Warshall](dynamic_programming/floyd_warshall.py)
345346
* [Integer Partition](dynamic_programming/integer_partition.py)
346347
* [Iterating Through Submasks](dynamic_programming/iterating_through_submasks.py)
348+
* [K Means Clustering Tensorflow](dynamic_programming/k_means_clustering_tensorflow.py)
347349
* [Knapsack](dynamic_programming/knapsack.py)
348350
* [Largest Divisible Subset](dynamic_programming/largest_divisible_subset.py)
349351
* [Longest Common Subsequence](dynamic_programming/longest_common_subsequence.py)
@@ -571,6 +573,8 @@
571573
* [Local Weighted Learning](machine_learning/local_weighted_learning/local_weighted_learning.py)
572574
* [Logistic Regression](machine_learning/logistic_regression.py)
573575
* [Loss Functions](machine_learning/loss_functions.py)
576+
* Lstm
577+
* [Lstm Prediction](machine_learning/lstm/lstm_prediction.py)
574578
* [Mfcc](machine_learning/mfcc.py)
575579
* [Multilayer Perceptron Classifier](machine_learning/multilayer_perceptron_classifier.py)
576580
* [Polynomial Regression](machine_learning/polynomial_regression.py)
@@ -801,6 +805,7 @@
801805
* [Swish](neural_network/activation_functions/swish.py)
802806
* [Back Propagation Neural Network](neural_network/back_propagation_neural_network.py)
803807
* [Convolution Neural Network](neural_network/convolution_neural_network.py)
808+
* [Input Data](neural_network/input_data.py)
804809
* [Simple Neural Network](neural_network/simple_neural_network.py)
805810

806811
## Other

Diff for: ciphers/rsa_cipher.py

+7-10
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,9 @@ def encrypt_and_write_to_file(
7676
key_size, n, e = read_key_file(key_filename)
7777
if key_size < block_size * 8:
7878
sys.exit(
79-
"ERROR: Block size is {} bits and key size is {} bits. The RSA cipher "
80-
"requires the block size to be equal to or greater than the key size. "
81-
"Either decrease the block size or use different keys.".format(
82-
block_size * 8, key_size
83-
)
79+
f"ERROR: Block size is {block_size * 8} bits and key size is {key_size} "
80+
"bits. The RSA cipher requires the block size to be equal to or greater "
81+
"than the key size. Either decrease the block size or use different keys."
8482
)
8583

8684
encrypted_blocks = [str(i) for i in encrypt_message(message, (n, e), block_size)]
@@ -102,11 +100,10 @@ def read_from_file_and_decrypt(message_filename: str, key_filename: str) -> str:
102100

103101
if key_size < block_size * 8:
104102
sys.exit(
105-
"ERROR: Block size is {} bits and key size is {} bits. The RSA cipher "
106-
"requires the block size to be equal to or greater than the key size. "
107-
"Did you specify the correct key file and encrypted file?".format(
108-
block_size * 8, key_size
109-
)
103+
f"ERROR: Block size is {block_size * 8} bits and key size is {key_size} "
104+
"bits. The RSA cipher requires the block size to be equal to or greater "
105+
"than the key size. Did you specify the correct key file and encrypted "
106+
"file?"
110107
)
111108

112109
encrypted_blocks = []

Diff for: machine_learning/lstm/lstm_prediction.py.DISABLED.txt renamed to machine_learning/lstm/lstm_prediction.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
make sure you set the price column on line number 21. Here we
1818
use a dataset which have the price on 3rd column.
1919
"""
20-
df = pd.read_csv("sample_data.csv", header=None)
21-
len_data = df.shape[:1][0]
20+
sample_data = pd.read_csv("sample_data.csv", header=None)
21+
len_data = sample_data.shape[:1][0]
2222
# If you're using some other dataset input the target column
23-
actual_data = df.iloc[:, 1:2]
24-
actual_data = actual_data.values.reshape(len_data, 1)
23+
actual_data = sample_data.iloc[:, 1:2]
24+
actual_data = actual_data.to_numpy().reshape(len_data, 1)
2525
actual_data = MinMaxScaler().fit_transform(actual_data)
2626
look_back = 10
2727
forward_days = 5

Diff for: neural_network/input_data.py.DEPRECATED.txt renamed to neural_network/input_data.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,22 @@
1818
"""
1919

2020

21-
import collections
2221
import gzip
2322
import os
23+
import typing
2424
import urllib
2525

2626
import numpy
2727
from tensorflow.python.framework import dtypes, random_seed
2828
from tensorflow.python.platform import gfile
2929
from tensorflow.python.util.deprecation import deprecated
3030

31-
_Datasets = collections.namedtuple("_Datasets", ["train", "validation", "test"])
31+
32+
class _Datasets(typing.NamedTuple):
33+
train: "_DataSet"
34+
validation: "_DataSet"
35+
test: "_DataSet"
36+
3237

3338
# CVDF mirror of http://yann.lecun.com/exdb/mnist/
3439
DEFAULT_SOURCE_URL = "https://storage.googleapis.com/cvdf-datasets/mnist/"

Diff for: other/lfu_cache.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ def __init__(self, key: T | None, val: U | None):
2424
self.prev: DoubleLinkedListNode[T, U] | None = None
2525

2626
def __repr__(self) -> str:
27-
return "Node: key: {}, val: {}, freq: {}, has next: {}, has prev: {}".format(
28-
self.key, self.val, self.freq, self.next is not None, self.prev is not None
27+
return (
28+
f"Node: key: {self.key}, val: {self.val}, freq: {self.freq}, "
29+
f"has next: {self.next is not None}, has prev: {self.prev is not None}"
2930
)
3031

3132

Diff for: requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ rich
1717
scikit-learn
1818
statsmodels
1919
sympy
20-
tensorflow ; python_version < '3.12'
20+
tensorflow
2121
tweepy
2222
# yulewalker # uncomment once audio_filters/equal_loudness_filter.py is fixed
2323
typing_extensions

0 commit comments

Comments
 (0)