From ac7e70f6bd74be3c5bbd149a12ce79397e07768e Mon Sep 17 00:00:00 2001 From: MaximSmolskiy Date: Mon, 22 Apr 2024 23:11:53 +0300 Subject: [PATCH 1/5] Fix some ARG002 per file ignores --- audio_filters/show_response.py | 2 +- data_structures/hashing/hash_table.py | 4 ++-- data_structures/hashing/quadratic_probing.py | 2 +- pyproject.toml | 3 --- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/audio_filters/show_response.py b/audio_filters/show_response.py index 097b8152b4e6..c181a31dda5b 100644 --- a/audio_filters/show_response.py +++ b/audio_filters/show_response.py @@ -8,7 +8,7 @@ class FilterType(Protocol): - def process(self, sample: float) -> float: + def process(self, sample: float) -> float: # noqa: ARG002 """ Calculate y[n] diff --git a/data_structures/hashing/hash_table.py b/data_structures/hashing/hash_table.py index 7fe57068f6a3..08c0aeab96e9 100644 --- a/data_structures/hashing/hash_table.py +++ b/data_structures/hashing/hash_table.py @@ -173,7 +173,7 @@ def _set_value(self, key, data): self.values[key] = data self._keys[key] = data - def _collision_resolution(self, key, data=None): + def _collision_resolution(self, key): """ This method is a type of open addressing which is used for handling collision. @@ -266,7 +266,7 @@ def insert_data(self, data): pass else: - collision_resolution = self._collision_resolution(key, data) + collision_resolution = self._collision_resolution(key) if collision_resolution is not None: self._set_value(collision_resolution, data) else: diff --git a/data_structures/hashing/quadratic_probing.py b/data_structures/hashing/quadratic_probing.py index 2f3401ec8918..5f15f1a77c59 100644 --- a/data_structures/hashing/quadratic_probing.py +++ b/data_structures/hashing/quadratic_probing.py @@ -11,7 +11,7 @@ class QuadraticProbing(HashTable): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - def _collision_resolution(self, key, data=None): + def _collision_resolution(self, key): """ Quadratic probing is an open addressing scheme used for resolving collisions in hash table. diff --git a/pyproject.toml b/pyproject.toml index 1134b773308e..cc2c4fb36444 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,11 +76,8 @@ max-complexity = 17 # default: 10 [tool.ruff.lint.per-file-ignores] "arithmetic_analysis/newton_raphson.py" = ["PGH001"] -"audio_filters/show_response.py" = ["ARG002"] "data_structures/binary_tree/binary_search_tree_recursive.py" = ["BLE001"] "data_structures/binary_tree/treap.py" = ["SIM114"] -"data_structures/hashing/hash_table.py" = ["ARG002"] -"data_structures/hashing/quadratic_probing.py" = ["ARG002"] "data_structures/hashing/tests/test_hash_map.py" = ["BLE001"] "data_structures/heap/max_heap.py" = ["SIM114"] "graphs/minimum_spanning_tree_prims.py" = ["SIM114"] From 0570aff312bf513826776de1af1627664d665ee1 Mon Sep 17 00:00:00 2001 From: MaximSmolskiy Date: Mon, 22 Apr 2024 23:22:23 +0300 Subject: [PATCH 2/5] Fix --- data_structures/hashing/hash_table.py | 4 ++-- data_structures/hashing/quadratic_probing.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data_structures/hashing/hash_table.py b/data_structures/hashing/hash_table.py index 08c0aeab96e9..3af25d4fe953 100644 --- a/data_structures/hashing/hash_table.py +++ b/data_structures/hashing/hash_table.py @@ -173,7 +173,7 @@ def _set_value(self, key, data): self.values[key] = data self._keys[key] = data - def _collision_resolution(self, key): + def _collision_resolution(self, key, data=None): # noqa: ARG002 """ This method is a type of open addressing which is used for handling collision. @@ -266,7 +266,7 @@ def insert_data(self, data): pass else: - collision_resolution = self._collision_resolution(key) + collision_resolution = self._collision_resolution(key, data) if collision_resolution is not None: self._set_value(collision_resolution, data) else: diff --git a/data_structures/hashing/quadratic_probing.py b/data_structures/hashing/quadratic_probing.py index 5f15f1a77c59..56d4926eee9b 100644 --- a/data_structures/hashing/quadratic_probing.py +++ b/data_structures/hashing/quadratic_probing.py @@ -11,7 +11,7 @@ class QuadraticProbing(HashTable): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - def _collision_resolution(self, key): + def _collision_resolution(self, key, data=None): # noqa: ARG002 """ Quadratic probing is an open addressing scheme used for resolving collisions in hash table. From c03f16dc4c823f7a18340a45105dd40424cbe1bf Mon Sep 17 00:00:00 2001 From: MaximSmolskiy Date: Wed, 1 May 2024 18:58:38 +0000 Subject: [PATCH 3/5] updating DIRECTORY.md --- DIRECTORY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/DIRECTORY.md b/DIRECTORY.md index f6d6cb463faa..4a053a3f1b7f 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -773,6 +773,7 @@ * [Inverse Of Matrix](matrix/inverse_of_matrix.py) * [Largest Square Area In Matrix](matrix/largest_square_area_in_matrix.py) * [Matrix Class](matrix/matrix_class.py) + * [Matrix Equalization](matrix/matrix_equalization.py) * [Matrix Multiplication Recursion](matrix/matrix_multiplication_recursion.py) * [Matrix Operation](matrix/matrix_operation.py) * [Max Area Of Island](matrix/max_area_of_island.py) From 2c9b0cff1a53d6c4b1905bcc131b7e845f455a62 Mon Sep 17 00:00:00 2001 From: MaximSmolskiy Date: Wed, 1 May 2024 22:05:54 +0300 Subject: [PATCH 4/5] Fix review issue --- audio_filters/show_response.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/audio_filters/show_response.py b/audio_filters/show_response.py index c181a31dda5b..f9c9537c047c 100644 --- a/audio_filters/show_response.py +++ b/audio_filters/show_response.py @@ -1,5 +1,6 @@ from __future__ import annotations +from abc import abstractmethod from math import pi from typing import Protocol @@ -8,14 +9,14 @@ class FilterType(Protocol): - def process(self, sample: float) -> float: # noqa: ARG002 + @abstractmethod + def process(self, sample: float) -> float: """ Calculate y[n] >>> issubclass(FilterType, Protocol) True """ - return 0.0 def get_bounds( From 916c130655078a6c8a6cb2e27fcb03e0e160442b Mon Sep 17 00:00:00 2001 From: MaximSmolskiy Date: Wed, 1 May 2024 22:19:38 +0300 Subject: [PATCH 5/5] Fix review issue --- data_structures/hashing/hash_table.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/data_structures/hashing/hash_table.py b/data_structures/hashing/hash_table.py index 3af25d4fe953..40fcad9a3dab 100644 --- a/data_structures/hashing/hash_table.py +++ b/data_structures/hashing/hash_table.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +from abc import abstractmethod + from .number_theory.prime_numbers import next_prime @@ -173,7 +175,8 @@ def _set_value(self, key, data): self.values[key] = data self._keys[key] = data - def _collision_resolution(self, key, data=None): # noqa: ARG002 + @abstractmethod + def _collision_resolution(self, key, data=None): """ This method is a type of open addressing which is used for handling collision.