Commit Graph

78 Commits

Author SHA1 Message Date
Maxim Smolskiy
e3fa014a5a
Fix ruff (#11527)
* updating DIRECTORY.md

* Fix ruff

* Fix

* Fix

* Fix

* Revert "Fix"

This reverts commit 5bc3bf3422.

* find_max.py: noqa: PLR1730

---------

Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2024-08-25 17:33:11 +02:00
Maxim Smolskiy
c599f6c910
Fix some SIM114 per file ignores (#11395)
* updating DIRECTORY.md

* Fix some SIM114 per file ignores

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix review issue

---------

Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-10 21:59:53 +02:00
Margaret
c026b1952f
adding a matrix equalization algorithm (#11360)
* adding a matrix equalization algorithm

* Adding url for more details

* Implementing suggestions
2024-05-01 12:42:54 +02:00
Maxim Smolskiy
4700297b3e
Enable ruff RUF002 rule (#11377)
* Enable ruff RUF002 rule

* Fix

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2024-04-22 21:51:47 +02:00
Maxim Smolskiy
53b2926704
Enable ruff PGH003 rule (#11345)
* Enable ruff PGH003 rule

* Fix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-02 21:29:34 +02:00
Maxim Smolskiy
516a3028d1
Enable ruff PLR5501 rule (#11332)
* Enable ruff PLR5501 rule

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-03-28 18:25:41 +01:00
pre-commit-ci[bot]
bc8df6de31
[pre-commit.ci] pre-commit autoupdate (#11322)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.2.2 → v0.3.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.2...v0.3.2)
- [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.8.0...v1.9.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-03-13 07:52:41 +01:00
pre-commit-ci[bot]
8b39a0fb54
[pre-commit.ci] pre-commit autoupdate (#11154)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.6)
- [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0)
- [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](https://github.com/tox-dev/pyproject-fmt/compare/1.4.1...1.5.1)
- [github.com/pre-commit/mirrors-mypy: v1.6.1 → v1.7.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.6.1...v1.7.0)

* updating DIRECTORY.md

* Update spiral_print.py

* Update matrix/spiral_print.py

* Update matrix/spiral_print.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-11-25 14:53:18 +01:00
Akshar Goyal
b072ba657f
Added tests for validate_sudoku_board.py (#11108) 2023-10-31 01:00:48 +01:00
ojas wani
ac3bd1032c
Add matrix_multiplication (#10045)
* added laplacian_filter file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated laplacian.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated laplacian_py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* required changes to laplacian file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* changed laplacian_filter.py

* changed laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* changed laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* changed laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update laplacian_filter.py

* update laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* changed laplacian_filter.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* changed laplacian_filter.py

* changed laplacian_filter.py

* changed laplacian_filter.py

* add matrix_multiplication.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update matrix_multiplication

* update matrix_multiplication

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* make changes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update

* update

* updates

* resolve conflict

* add doctest

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* make changes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update laplacian.py

* add doctests

* more doctest added

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* try to resolve ruff error

* try to reslve ruff error

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update doctest

* attemp - resolve ruff error

* resolve build error

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* resolve build issue

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update build

* doctest update

* update doctest

* update doctest

* update doctest

* fix ruff error

* file location changed

* Delete digital_image_processing/filters/laplacian_filter.py

* Create laplacian_filter.py

* Update matrix_multiplication_recursion.py

* Update matrix_multiplication_recursion.py

* Update matrix_multiplication_recursion.py

* Update matrix_multiplication_recursion.py

* Update matrix_multiplication_recursion.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-17 11:25:25 +02:00
Dean Bring
212cdfe36c
Added validate sudoku board function (#9881)
* Added algorithm to deeply clone a graph

* Fixed file name and removed a function call

* Removed nested function and fixed class parameter types

* Fixed doctests

* bug fix

* Added class decorator

* Updated doctests and fixed precommit errors

* Cleaned up code

* Simplified doctest

* Added doctests

* Code simplification

* Created function which validates sudoku boards

* Update matrix/validate_sudoku_board.py

* Fixed precommit errors

* Removed file accidentally included

* Improved readability and simplicity

* Add timeit benchmarks

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update validate_sudoku_board.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-14 17:35:12 +02:00
Christian Clauss
3f094fe49d
Ruff pandas vet (#10281)
* Python linting: Add ruff rules for Pandas-vet and Pytest-style

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-11 14:30:02 -04:00
Bama Charan Chhandogi
922d6a88b3
add median of matrix (#9363)
* add median of matrix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix formating

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Apply suggestions from code review

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-04 19:21:46 +02:00
pre-commit-ci[bot]
421ace81ed
[pre-commit.ci] pre-commit autoupdate (#9013)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.285 → v0.0.286](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.285...v0.0.286)
- [github.com/tox-dev/pyproject-fmt: 0.13.1 → 1.1.0](https://github.com/tox-dev/pyproject-fmt/compare/0.13.1...1.1.0)

* updating DIRECTORY.md

* Fis ruff rules PIE808,PLR1714

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-08-29 15:18:10 +02:00
Tianyi Zheng
ae0fc85401
Fix ruff errors (#8936)
* Fix ruff errors

Renamed neural_network/input_data.py to neural_network/input_data.py_tf
because it should be left out of the directory for the following
reasons:

1. Its sole purpose is to be used by neural_network/gan.py_tf, which is
   itself left out of the directory because of issues with TensorFlow.

2. It was taken directly from TensorFlow's codebase and is actually
   already deprecated. If/when neural_network/gan.py_tf is eventually
   re-added back to the directory, its implementation should be changed
   to not use neural_network/input_data.py anyway.

* updating DIRECTORY.md

* Change input_data.py_tf file extension

Change input_data.py_tf file extension because algorithms-keeper bot is being picky about it

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-09 13:25:30 +05:30
Caeden Perelli-Harris
daa0c8f3d3
Create count negative numbers in matrix algorithm (#8813)
* updating DIRECTORY.md

* feat: Count negative numbers in sorted matrix

* updating DIRECTORY.md

* chore: Fix pre-commit

* refactor: Combine functions into iteration

* style: Reformat reference

* feat: Add timings of each implementation

* chore: Fix problems with algorithms-keeper bot

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* test: Remove doctest from benchmark function

* Update matrix/count_negative_numbers_in_sorted_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/count_negative_numbers_in_sorted_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/count_negative_numbers_in_sorted_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/count_negative_numbers_in_sorted_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/count_negative_numbers_in_sorted_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/count_negative_numbers_in_sorted_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* refactor: Use sum instead of large iteration

* refactor: Use len not sum

* Update count_negative_numbers_in_sorted_matrix.py

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-06-10 14:21:49 +02:00
Christian Clauss
4b79d771cd
Add more ruff rules (#8767)
* Add more ruff rules

* Add more ruff rules

* pre-commit: Update ruff v0.0.269 -> v0.0.270

* Apply suggestions from code review

* Fix doctest

* Fix doctest (ignore whitespace)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-05-26 09:34:17 +02:00
Christian Clauss
c909da9b08
pre-commit: Upgrade psf/black for stable style 2023 (#8110)
* pre-commit: Upgrade psf/black for stable style 2023

Updating https://github.com/psf/black ... updating 22.12.0 -> 23.1.0 for their `2023 stable style`.
* https://github.com/psf/black/blob/main/CHANGES.md#2310

> This is the first [psf/black] release of 2023, and following our stability policy, it comes with a number of improvements to our stable style…

Also, add https://github.com/tox-dev/pyproject-fmt and https://github.com/abravalheri/validate-pyproject to pre-commit.

I only modified `.pre-commit-config.yaml` and all other files were modified by pre-commit.ci and psf/black.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-02-01 18:44:54 +05:30
Dhruv Manilawala
8bfd1c844b
fix: mypy 0.991 issues (#7988)
* fix: mypy 0.991 issues

* fix: invalid condition for base case
2022-11-15 18:29:14 +01:00
Caeden Perelli-Harris
daa1c7529a
Raise error not string (#7945)
* ci: Add `B023` to `.flake8` ignores

* refactor: Return `bool`/raise Exception

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* revert: Remove previous branch commit

* Update data_structures/binary_tree/segment_tree_other.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* feat: Apply `__repr__` changes

* chore: Fix failing tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update data_structures/binary_tree/segment_tree_other.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* test: Fix doctests

* random.choice(population_score[:N_SELECTED])[0]

* Update basic_string.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-11-06 15:54:44 +01:00
Caeden Perelli-Harris
f512b4d105
refactor: Move pascals triange to maths/ (#7932)
* refactor: Move pascals triange to maths/

* Update xgboost_classifier.py

* statsmodels is now compatible with Python 3.11

* statsmodels is now compatible with Python 3.11

* cython>=0.29.28

* cython>=0.29.28  # For statsmodels on Python 3.11

Co-authored-by: Christian Clauss <cclauss@me.com>
2022-11-01 20:25:39 +01:00
Jason Devers
7b7b3dd086
matrix/count_paths.py (#7533)
* added recursive dfs backtracking for count paths with doctests

* fixed doc testing

* added type hints

* redefined r as row, c as col

* fixed naming conventions, ran mypy, only tests that didn't pass were using List[], rathan list()

* added another doctest, as well as a explanation above

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update matrix/count_paths.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* Update matrix/count_paths.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Apply suggestions from code review

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

Co-authored-by: J <jasondevers@wireless-10-105-49-243.umd.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-30 18:20:07 +13:00
Caeden Perelli-Harris
61eedc16c3
Remove useless code in doctests (#7733)
* refactor: Fix matrix display deprecation

* refactor: Remove useless `print` and `pass` statements

* revert: Replace broken doctests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* revert: Fix failing doctests

* chore: Satisfy pre-commit

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-27 22:52:00 +02:00
Shubham Kondekar
614274a9dc
Update spiral_print.py (#7674)
* Update spiral_print.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update matrix/spiral_print.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update matrix/spiral_print.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update matrix/spiral_print.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update matrix/spiral_print.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update spiral_print.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update spiral_print.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update spiral_print.py

* Update spiral_print.py

* Update spiral_print.py

* Update spiral_print.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-26 18:58:33 +02:00
Shubham Kondekar
5c8a939c5a
Create largest_square_area_in_matrix.py (#7673)
* Create largest_square_area_in_matrix.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update matrix/largest_square_area_in_matrix.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update matrix/largest_square_area_in_matrix.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update largest_square_area_in_matrix.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-26 17:06:15 +02:00
Karthik Ayangar
9390565350
added support for inverse of 3x3 matrix (#7355)
* added support for inverse of 3x3 matrix

* Modified Docstring and improved code

* fixed an error

* Modified docstring

* Apply all suggestions from code review

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
2022-10-26 10:36:40 +02:00
Karthik Ayangar
c3bcfbf19d
Add Cramer's rule for solving system of linear equations in two variables (#7547)
* added script for solving system of linear equations in two variables

* implemented all the suggested changes

* changed RuntimeError to ValueError

* Update matrix/system_of_linear_equation_in_2_variables.py

* Update matrix/system_of_linear_equation_in_2_variables.py

* Update and rename system_of_linear_equation_in_2_variables.py to cramers_rule_2x2.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-25 22:55:31 +01:00
Shubham Kondekar
2ca695b0fe
[Matrix] Max area of island problem solved DFS algorithm (#6918)
* Maximum area of island program added

* Update matrix/max_area_of_island.py

Co-authored-by: Caeden <caedenperelliharris@gmail.com>

* Update matrix/max_area_of_island.py

Co-authored-by: Caeden <caedenperelliharris@gmail.com>

* Update matrix/max_area_of_island.py

Co-authored-by: Caeden <caedenperelliharris@gmail.com>

* Review's comment resolved

* max area of island

* PR Comments resolved

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Test case fail fix

* Grammer correction

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* flake8 issue resolved

* some variable name fix

* Update matrix/max_area_of_island.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update matrix/max_area_of_island.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* PR, comments resolved

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update matrix/max_area_of_island.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/max_area_of_island.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* PR, comments resolved

* Update max_area_of_island.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Typo

Co-authored-by: Caeden <caedenperelliharris@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-18 20:05:18 +02:00
Caeden Perelli-Harris
f15cc2f01c
Follow Flake8 pep3101 and remove modulo formatting (#7339)
* ci: Add ``flake8-pep3101`` plugin to ``pre-commit``

* refactor: Remove all modulo string formatting

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor: Remove ``flake8-pep3101`` plugin from ``pre-commit``

* revert: Revert to modulo formatting

* refactor: Use f-string instead of `join`

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-16 22:50:11 +02:00
CenTdemeern1
04698538d8
Misc fixes across multiple algorithms (#6912)
Source: Snyk code quality
Add scikit-fuzzy to requirements

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2022-10-16 10:55:38 +05:30
Caeden
a652905b60
Add Flake8 comprehensions to pre-commit (#7235)
* ci(pre-commit): Add ``flake8-comprehensions`` to ``pre-commit`` (#7233)

* refactor: Fix ``flake8-comprehensions`` errors

* fix: Replace `map` with generator (#7233)

* fix: Cast `range` objects to `list`
2022-10-15 19:29:42 +02:00
Anurag Shukla
3deb4a3042
Create binary_search_matrix.py (#6995)
* Create binary_search_matrix.py

Added an algorithm to search in matrix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update binary_search_matrix.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix Indentation

* Update matrix/binary_search_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-13 22:03:15 +02:00
Caeden
4d0c830d2c
Add flake8 pluin flake8 bugbear to pre-commit (#7132)
* ci(pre-commit): Add ``flake8-builtins`` additional dependency to ``pre-commit`` (#7104)

* refactor: Fix ``flake8-builtins`` (#7104)

* fix(lru_cache): Fix naming conventions in docstrings (#7104)

* ci(pre-commit): Order additional dependencies alphabetically (#7104)

* fix(lfu_cache): Correct function name in docstring (#7104)

* Update strings/snake_case_to_camel_pascal_case.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update data_structures/stacks/next_greater_element.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update digital_image_processing/index_calculation.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update graphs/prim.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update hashes/djb2.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* refactor: Rename `_builtin` to `builtin_` ( #7104)

* fix: Rename all instances (#7104)

* refactor: Update variable names (#7104)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* ci: Create ``tox.ini`` and ignore ``A003`` (#7123)

* revert: Remove function name changes (#7104)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Rename tox.ini to .flake8

* Update data_structures/heap/heap.py

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>

* refactor: Rename `next_` to `next_item` (#7104)

* ci(pre-commit): Add `flake8` plugin `flake8-bugbear` (#7127)

* refactor: Follow `flake8-bugbear` plugin (#7127)

* fix: Correct `knapsack` code (#7127)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2022-10-13 18:03:06 +02:00
Caeden
07e991d553
Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062)
* ci(pre-commit): Add pep8-naming to `pre-commit` hooks (#7038)

* refactor: Fix naming conventions (#7038)

* Update arithmetic_analysis/lu_decomposition.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor(lu_decomposition): Replace `NDArray` with `ArrayLike` (#7038)

* chore: Fix naming conventions in doctests (#7038)

* fix: Temporarily disable project euler problem 104 (#7069)

* chore: Fix naming conventions in doctests (#7038)

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-13 00:54:20 +02:00
Rohan R Bharadwaj
46842e8c5b
Add missing type hints in matrix directory (#6612)
* Update count_islands_in_matrix.py

* Update matrix_class.py

* Update matrix_operation.py

* Update nth_fibonacci_using_matrix_exponentiation.py

* Update searching_in_sorted_matrix.py

* Update count_islands_in_matrix.py

* Update matrix_class.py

* Update matrix_operation.py

* Update rotate_matrix.py

* Update sherman_morrison.py

* Update spiral_print.py

* Update count_islands_in_matrix.py

* formatting

* formatting

* Update matrix_class.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-04 20:05:56 +02:00
Maxim Smolskiy
a0b0f414ae
Add Project Euler problem 116 solution 1 (#6305)
* Add solution

* updating DIRECTORY.md

* Fix pre-commit

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-09-24 18:04:00 +01:00
Yannick Brenning
91c671ebab
Fix minor typo and add matrix dimension check (#6367)
* Fix minor typo in comment

* Add matrix dimension check

* Add descriptive comment
2022-09-24 17:46:03 +01:00
Vardhaman
2d5dd6f132
MAINT: Updated f-string method (#6230)
* MAINT: Used f-string method

Updated the code with f-string methods wherever required for a better and cleaner understanding of the code.

* Updated files with f-string method

* Update rsa_key_generator.py

* Update rsa_key_generator.py

* Update elgamal_key_generator.py

* Update lru_cache.py

I don't think this change is efficient but it might tackle the error as the error was due to using long character lines.

* Update lru_cache.py

* Update lru_cache.py

Co-authored-by: cyai <seriesscar@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-07-07 16:34:07 +02:00
Omkaar
dbee5f072f
Improve code on f-strings and brevity (#6126)
* Update strassen_matrix_multiplication.py

* Update matrix_operation.py

* Update enigma_machine2.py

* Update enigma_machine.py

* Update enigma_machine2.py

* Update rod_cutting.py

* Update external_sort.py

* Update sol1.py

* Update hill_cipher.py

* Update prime_numbers.py

* Update integration_by_simpson_approx.py
2022-05-13 20:51:44 +08:00
Rohan R Bharadwaj
e9882e41ba
[mypy] Fix matrix_operation.py (#5808)
* Update matrix_operation.py

* Update mypy.ini

* Update DIRECTORY.md

* formatting

* Update matrix_operation.py

* doctest for exception

* A bit more...
2021-11-10 16:22:52 +01:00
Christian Clauss
cecf43d648
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-09-07 13:37:03 +02:00
arfy slowy
8e5c3536c7
[fixed] unused variable, standalone running, import doctest module (#4673)
* [fixed] unused variable, standalone running, import doctest module

information [standalone running](https://www.geeksforgeeks.org/what-does-the-if-__name__-__main__-do/)

Signed-off-by: slowy07 <slowy.arfy@gmail.com>

* Update other/fischer_yates_shuffle.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* [fixed] change to tuple and fixing callfunction

Signed-off-by: slowy07 <slowy.arfy@gmail.com>

* Update matrix/spiral_print.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update matrix/spiral_print.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* fixing

Co-authored-by: Christian Clauss <cclauss@me.com>

* [fixed] sprial matrix

Signed-off-by: slowy07 <slowy.arfy@gmail.com>

* Update spiral_print.py

* Update spiral_print.py

* Update spiral_print.py

* Update spiral_print.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-08-28 20:07:10 +02:00
algobytewise
4c76e3cba0
[mypy] Added/fixed type annotations for "rotate_matrix.py" & "test_matrix_operation.py" (#4221)
* [mypy] Added/fixed type annotations for "rotate_matrix.py"

* [mypy] Added/fixed type annotations for "test_matrix_operation.py"
2021-02-26 14:30:35 +01:00
CarsonHam
61f3119467
Change occurrences of str.format to f-strings (#4118)
* f-string update rsa_cipher.py

* f-string update rsa_key_generator.py

* f-string update burrows_wheeler.py

* f-string update non_recursive_segment_tree.py

* f-string update red_black_tree.py

* f-string update deque_doubly.py

* f-string update climbing_stairs.py

* f-string update iterating_through_submasks.py

* f-string update knn_sklearn.py

* f-string update 3n_plus_1.py

* f-string update quadratic_equations_complex_numbers.py

* f-string update nth_fibonacci_using_matrix_exponentiation.py

* f-string update sherman_morrison.py

* f-string update levenshtein_distance.py

* fix lines that were too long
2021-02-23 11:23:49 +05:30
Dhruv
48357cea5b
Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
Christian Clauss
9200a2e543
from __future__ import annotations (#2464)
* from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-23 13:30:13 +02:00
Du Yuanchao
4d0a8f2355
Optimized recursive_bubble_sort (#2410)
* optimized recursive_bubble_sort

* Fixed doctest error due whitespace

* reduce loop times for optimization

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-10 10:31:26 +02:00
Christian Clauss
e77600638d
Travis CI: Identify our ten slowest pytests (#2350)
* Travis CI: Identify our ten slowest tests

https://howchoo.com/g/mtblodnjzjc/how-to-measure-unit-test-execution-times-in-pytest helps us to find the individual tests that are slowing down our Travis CI checks.

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-25 15:47:06 +02:00
wuyudi
6822d1afeb
Update matrix_operation.py (#2344)
* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py

* Update matrix_operation.py
2020-08-21 20:41:48 +02:00
RobotGuy999
a823a86a29
Added "Inverse of Matrix" Algorithm (#2209)
* Added "Inverse of Matrix" Algorithm

* Small quotation marks change

* Update inverse_of_matrix.py

* Updated doctests

* Update inverse_of_matrix.py

* Add type hints

* swaped --> swapped

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-23 13:18:17 +02:00