From 1b381c75aafc886d869ab28d697c1dd1007648c7 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Sun, 20 Aug 2023 12:43:03 +0000 Subject: [PATCH 1/6] updating DIRECTORY.md --- DIRECTORY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/DIRECTORY.md b/DIRECTORY.md index 653c1831d820..d0d7726c4b5f 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -155,6 +155,7 @@ * [Hexadecimal To Decimal](conversions/hexadecimal_to_decimal.py) * [Length Conversion](conversions/length_conversion.py) * [Molecular Chemistry](conversions/molecular_chemistry.py) + * [Octal To Binary](conversions/octal_to_binary.py) * [Octal To Decimal](conversions/octal_to_decimal.py) * [Prefix Conversions](conversions/prefix_conversions.py) * [Prefix Conversions String](conversions/prefix_conversions_string.py) From 9ab78e190d314b6232416fb91ff9d5ec04f9d42c Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Wed, 6 Sep 2023 18:37:31 +0000 Subject: [PATCH 2/6] updating DIRECTORY.md --- DIRECTORY.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DIRECTORY.md b/DIRECTORY.md index 43da91cb818e..272cfd28fafc 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -133,6 +133,7 @@ ## Computer Vision * [Cnn Classification](computer_vision/cnn_classification.py) * [Flip Augmentation](computer_vision/flip_augmentation.py) + * [Haralick Descriptors](computer_vision/haralick_descriptors.py) * [Harris Corner](computer_vision/harris_corner.py) * [Horn Schunck](computer_vision/horn_schunck.py) * [Mean Threshold](computer_vision/mean_threshold.py) @@ -586,6 +587,7 @@ * [Greedy Coin Change](maths/greedy_coin_change.py) * [Hamming Numbers](maths/hamming_numbers.py) * [Hardy Ramanujanalgo](maths/hardy_ramanujanalgo.py) + * [Harshad Numbers](maths/harshad_numbers.py) * [Hexagonal Number](maths/hexagonal_number.py) * [Integration By Simpson Approx](maths/integration_by_simpson_approx.py) * [Interquartile Range](maths/interquartile_range.py) From 3ec65c9c4b7f91c5dfb95033a7cf15b301022e5b Mon Sep 17 00:00:00 2001 From: Tianyi Zheng Date: Sat, 16 Sep 2023 14:57:27 -0400 Subject: [PATCH 3/6] Delete empty junk file --- arithmetic_analysis/junk.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 arithmetic_analysis/junk.py diff --git a/arithmetic_analysis/junk.py b/arithmetic_analysis/junk.py deleted file mode 100644 index e69de29bb2d1..000000000000 From 6b3469f5ba451799957e957d0044e9ef58457e42 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Sat, 16 Sep 2023 18:57:43 +0000 Subject: [PATCH 4/6] updating DIRECTORY.md --- DIRECTORY.md | 1 - 1 file changed, 1 deletion(-) diff --git a/DIRECTORY.md b/DIRECTORY.md index 1b802564f939..d81e4ec1ee83 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -5,7 +5,6 @@ * [In Static Equilibrium](arithmetic_analysis/in_static_equilibrium.py) * [Intersection](arithmetic_analysis/intersection.py) * [Jacobi Iteration Method](arithmetic_analysis/jacobi_iteration_method.py) - * [Junk](arithmetic_analysis/junk.py) * [Lu Decomposition](arithmetic_analysis/lu_decomposition.py) * [Newton Forward Interpolation](arithmetic_analysis/newton_forward_interpolation.py) * [Newton Method](arithmetic_analysis/newton_method.py) From 0f6c3450b7dd820204e974e4095727e33cc1906a Mon Sep 17 00:00:00 2001 From: Tianyi Zheng Date: Sat, 16 Sep 2023 15:50:28 -0400 Subject: [PATCH 5/6] Fix ruff errors --- computer_vision/haralick_descriptors.py | 8 +++++--- conversions/convert_number_to_words.py | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/computer_vision/haralick_descriptors.py b/computer_vision/haralick_descriptors.py index 1a86d84ea14b..413cea304f6c 100644 --- a/computer_vision/haralick_descriptors.py +++ b/computer_vision/haralick_descriptors.py @@ -100,7 +100,9 @@ def binarize(image: np.ndarray, threshold: float = 127.0) -> np.ndarray: return np.where(image > threshold, 1, 0) -def transform(image: np.ndarray, kind: str, kernel: np.ndarray = None) -> np.ndarray: +def transform( + image: np.ndarray, kind: str, kernel: np.ndarray | None = None +) -> np.ndarray: """ Simple image transformation using one of two available filter functions: Erosion and Dilation. @@ -154,7 +156,7 @@ def transform(image: np.ndarray, kind: str, kernel: np.ndarray = None) -> np.nda return transformed -def opening_filter(image: np.ndarray, kernel: np.ndarray = None) -> np.ndarray: +def opening_filter(image: np.ndarray, kernel: np.ndarray | None = None) -> np.ndarray: """ Opening filter, defined as the sequence of erosion and then a dilation filter on the same image. @@ -172,7 +174,7 @@ def opening_filter(image: np.ndarray, kernel: np.ndarray = None) -> np.ndarray: return transform(transform(image, "dilation", kernel), "erosion", kernel) -def closing_filter(image: np.ndarray, kernel: np.ndarray = None) -> np.ndarray: +def closing_filter(image: np.ndarray, kernel: np.ndarray | None = None) -> np.ndarray: """ Opening filter, defined as the sequence of dilation and then erosion filter on the same image. diff --git a/conversions/convert_number_to_words.py b/conversions/convert_number_to_words.py index 0e4405319f1f..0c428928b31d 100644 --- a/conversions/convert_number_to_words.py +++ b/conversions/convert_number_to_words.py @@ -54,7 +54,7 @@ def max_value(cls, system: str) -> int: class NumberWords(Enum): - ONES: ClassVar = { + ONES: ClassVar[dict[int, str]] = { 0: "", 1: "one", 2: "two", @@ -67,7 +67,7 @@ class NumberWords(Enum): 9: "nine", } - TEENS: ClassVar = { + TEENS: ClassVar[dict[int, str]] = { 0: "ten", 1: "eleven", 2: "twelve", @@ -80,7 +80,7 @@ class NumberWords(Enum): 9: "nineteen", } - TENS: ClassVar = { + TENS: ClassVar[dict[int, str]] = { 2: "twenty", 3: "thirty", 4: "forty", From a5fe24625c6bf8d57d4041e18c9c41c7a0f5d6ee Mon Sep 17 00:00:00 2001 From: Tianyi Zheng Date: Sat, 16 Sep 2023 15:53:16 -0400 Subject: [PATCH 6/6] Fix more ruff errors --- graphs/tarjans_scc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphs/tarjans_scc.py b/graphs/tarjans_scc.py index 30f8ca8a204f..dfd2e52704d5 100644 --- a/graphs/tarjans_scc.py +++ b/graphs/tarjans_scc.py @@ -77,7 +77,7 @@ def create_graph(n, edges): n_vertices = 7 source = [0, 0, 1, 2, 3, 3, 4, 4, 6] target = [1, 3, 2, 0, 1, 4, 5, 6, 5] - edges = [(u, v) for u, v in zip(source, target)] + edges = list(zip(source, target)) g = create_graph(n_vertices, edges) assert [[5], [6], [4], [3, 2, 1, 0]] == tarjan(g)