From 756bb268eb22199534fc8d6478cf0e006f02b56b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Oct 2022 22:00:45 +0200 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#6629) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/psf/black: 22.6.0 → 22.8.0](https://github.com/psf/black/compare/22.6.0...22.8.0) - [github.com/asottile/pyupgrade: v2.37.0 → v2.38.2](https://github.com/asottile/pyupgrade/compare/v2.37.0...v2.38.2) - https://gitlab.com/pycqa/flake8 → https://github.com/PyCQA/flake8 - [github.com/PyCQA/flake8: 3.9.2 → 5.0.4](https://github.com/PyCQA/flake8/compare/3.9.2...5.0.4) - [github.com/pre-commit/mirrors-mypy: v0.961 → v0.981](https://github.com/pre-commit/mirrors-mypy/compare/v0.961...v0.981) - [github.com/codespell-project/codespell: v2.1.0 → v2.2.1](https://github.com/codespell-project/codespell/compare/v2.1.0...v2.2.1) * Fix a long line * Update sol1.py * Update sol1.py * lambda_ * Update multi_level_feedback_queue.py * Update double_ended_queue.py * Update sequential_minimum_optimization.py * Update .pre-commit-config.yaml Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss --- .pre-commit-config.yaml | 14 +++++++------- data_structures/queue/double_ended_queue.py | 2 +- linear_algebra/src/power_iteration.py | 12 ++++++------ .../sequential_minimum_optimization.py | 2 +- project_euler/problem_045/sol1.py | 2 +- project_euler/problem_113/sol1.py | 2 +- scheduling/multi_level_feedback_queue.py | 2 +- .../download_images_from_google_query.py | 3 ++- 8 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 325063c3b..a2fcf12c9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: - id: requirements-txt-fixer - repo: https://github.com/psf/black - rev: 22.6.0 + rev: 22.8.0 hooks: - id: black @@ -26,14 +26,14 @@ repos: - --profile=black - repo: https://github.com/asottile/pyupgrade - rev: v2.37.0 + rev: v2.38.2 hooks: - id: pyupgrade args: - --py310-plus - - repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.2 + - repo: https://github.com/PyCQA/flake8 + rev: 5.0.4 hooks: - id: flake8 args: @@ -42,7 +42,7 @@ repos: - --max-line-length=88 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.961 + rev: v0.981 hooks: - id: mypy args: @@ -52,11 +52,11 @@ repos: additional_dependencies: [types-requests] - repo: https://github.com/codespell-project/codespell - rev: v2.1.0 + rev: v2.2.1 hooks: - id: codespell args: - - --ignore-words-list=ans,crate,fo,followings,hist,iff,mater,secant,som,sur,tim + - --ignore-words-list=ans,crate,damon,fo,followings,hist,iff,mater,secant,som,sur,tim,zar - --skip="./.*,./strings/dictionary.txt,./strings/words.txt,./project_euler/problem_022/p022_names.txt" exclude: | (?x)^( diff --git a/data_structures/queue/double_ended_queue.py b/data_structures/queue/double_ended_queue.py index 1603e50bc..f38874788 100644 --- a/data_structures/queue/double_ended_queue.py +++ b/data_structures/queue/double_ended_queue.py @@ -377,7 +377,7 @@ class Deque: me = self._front oth = other._front - # if the length of the deques are not the same, they are not equal + # if the length of the dequeues are not the same, they are not equal if len(self) != len(other): return False diff --git a/linear_algebra/src/power_iteration.py b/linear_algebra/src/power_iteration.py index 4c6525b6e..4b866331b 100644 --- a/linear_algebra/src/power_iteration.py +++ b/linear_algebra/src/power_iteration.py @@ -52,7 +52,7 @@ def power_iteration( # or when we have small changes from one iteration to next. convergence = False - lamda_previous = 0 + lambda_previous = 0 iterations = 0 error = 1e12 @@ -64,21 +64,21 @@ def power_iteration( # Find rayleigh quotient # (faster than usual b/c we know vector is normalized already) vectorH = vector.conj().T if is_complex else vector.T - lamda = np.dot(vectorH, np.dot(input_matrix, vector)) + lambda_ = np.dot(vectorH, np.dot(input_matrix, vector)) # Check convergence. - error = np.abs(lamda - lamda_previous) / lamda + error = np.abs(lambda_ - lambda_previous) / lambda_ iterations += 1 if error <= error_tol or iterations >= max_iterations: convergence = True - lamda_previous = lamda + lambda_previous = lambda_ if is_complex: - lamda = np.real(lamda) + lambda_ = np.real(lambda_) - return lamda, vector + return lambda_, vector def test_power_iteration() -> None: diff --git a/machine_learning/sequential_minimum_optimization.py b/machine_learning/sequential_minimum_optimization.py index c217a370a..cc7868d0f 100644 --- a/machine_learning/sequential_minimum_optimization.py +++ b/machine_learning/sequential_minimum_optimization.py @@ -145,7 +145,7 @@ class SmoSVM: if self._is_unbound(i2): self._error[i2] = 0 - # Predict test samles + # Predict test samples def predict(self, test_samples, classify=True): if test_samples.shape[1] > self.samples.shape[1]: diff --git a/project_euler/problem_045/sol1.py b/project_euler/problem_045/sol1.py index cdf5c14cf..d921b2802 100644 --- a/project_euler/problem_045/sol1.py +++ b/project_euler/problem_045/sol1.py @@ -8,7 +8,7 @@ Hexagonal H(n) = n * (2 * n − 1) 1, 6, 15, 28, 45, ... It can be verified that T(285) = P(165) = H(143) = 40755. Find the next triangle number that is also pentagonal and hexagonal. -All trinagle numbers are hexagonal numbers. +All triangle numbers are hexagonal numbers. T(2n-1) = n * (2 * n - 1) = H(n) So we shall check only for hexagonal numbers which are also pentagonal. """ diff --git a/project_euler/problem_113/sol1.py b/project_euler/problem_113/sol1.py index 951d9b49c..2077c0fa6 100644 --- a/project_euler/problem_113/sol1.py +++ b/project_euler/problem_113/sol1.py @@ -62,7 +62,7 @@ def non_bouncy_upto(n: int) -> int: def solution(num_digits: int = 100) -> int: """ - Caclulate the number of non-bouncy numbers less than a googol. + Calculate the number of non-bouncy numbers less than a googol. >>> solution(6) 12951 >>> solution(10) diff --git a/scheduling/multi_level_feedback_queue.py b/scheduling/multi_level_feedback_queue.py index 95ca827e0..b54cc8719 100644 --- a/scheduling/multi_level_feedback_queue.py +++ b/scheduling/multi_level_feedback_queue.py @@ -307,6 +307,6 @@ if __name__ == "__main__": ) # print sequence of finished processes print( - f"sequnece of finished processes:\ + f"sequence of finished processes:\ {mlfq.calculate_sequence_of_finish_queue()}" ) diff --git a/web_programming/download_images_from_google_query.py b/web_programming/download_images_from_google_query.py index b11a7f883..9c0c21dc8 100644 --- a/web_programming/download_images_from_google_query.py +++ b/web_programming/download_images_from_google_query.py @@ -14,7 +14,8 @@ headers = { def download_images_from_google_query(query: str = "dhaka", max_images: int = 5) -> int: - """Searches google using the provided query term and downloads the images in a folder. + """ + Searches google using the provided query term and downloads the images in a folder. Args: query : The image search term to be provided by the user. Defaults to