Commit Graph

55 Commits

Author SHA1 Message Date
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
Caeden Perelli-Harris
490e645ed3
Fix minor typing errors in maths/ (#8959)
* updating DIRECTORY.md

* types(maths): Fix pylance issues in maths

* reset(vsc): Reset settings changes

* Update maths/jaccard_similarity.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* revert(erosion_operation): Revert erosion_operation

* test(jaccard_similarity): Add doctest to test alternative_union

* types(newton_raphson): Add typehints to func bodies

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-08-15 14:27:41 -07:00
Colin Leroy-Mira
2cfef0913a
Fix greyscale computation and inverted coords (#8905)
* Fix greyscale computation and inverted coords

* Fix test

* Add test cases

* Add reference to the greyscaling formula

---------

Co-authored-by: Colin Leroy-Mira <colin.leroy-mira@sigfox.com>
2023-07-29 10:03:43 -07: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
Caeden Perelli-Harris
1faf10b5c2
Correct ruff failures (#8732)
* fix: Correct ruff problems

* updating DIRECTORY.md

* fix: Fix pre-commit errors

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-05-14 22:03:13 +01:00
Tianyi Zheng
a213cea5f5
Fix mypy errors in dilation_operation.py (#8595)
* updating DIRECTORY.md

* Fix mypy errors in dilation_operation.py

* Rename functions to use snake case

* updating DIRECTORY.md

* updating DIRECTORY.md

* Replace raw file string with pathlib Path

* Update digital_image_processing/morphological_operations/dilation_operation.py

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

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-04-01 18:39:22 +02:00
Maxim Smolskiy
59cae167e0
Reduce the complexity of digital_image_processing/edge detection/canny.py (#8167)
* Reduce the complexity of digital_image_processing/edge_detection/canny.py

* Fix

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* Fix review issues

* Rename dst to destination

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-04-01 18:22:33 +02:00
Christian Clauss
521fbca61c
Replace flake8 with ruff (#8184) 2023-03-16 13:31:29 +01:00
Christian Clauss
64543faa98
Make some ruff fixes (#8154)
* Make some ruff fixes

* Undo manual fix

* Undo manual fix

* Updates from ruff=0.0.251
2023-03-01 17:23:33 +01: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
Mark Mayo
f32d611689
clean of unnecessary checks, imports, calls (#7993) 2022-11-21 00:00:27 +13:00
Andrey
584e743422
Fix yesqa hook (#7843)
* fix yesqa hook

* Remove redundant noqa

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-29 15:07:02 +02:00
Tianyi Zheng
cc10b20beb
Remove some print statements within algorithmic functions (#7499)
* Remove commented-out print statements in algorithmic functions

* Encapsulate non-algorithmic code in __main__

* Remove unused print_matrix function

* Remove print statement in __init__

* Remove print statement from doctest

* Encapsulate non-algorithmic code in __main__

* Modify algorithm to return instead of print

* Encapsulate non-algorithmic code in __main__

* Refactor data_safety_checker to return instead of print

* updating DIRECTORY.md

* updating DIRECTORY.md

* Apply suggestions from code review

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

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

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
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-22 13:33:51 +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
d5a9f649b8
Add flake8-builtins to pre-commit and fix errors (#7105)
Ignore `A003`

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 19:53:59 +05:30
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
zhexuanl
b1818af517
Add Digital Image Processing Algorithm: Local Binary Pattern (#6294)
* add algorithm local binary pattern

* fix failed test for local binary pattern

* updating DIRECTORY.md

* fix detected precommit-error

* fix precommit error

* final check

* Add descriptive name for parameters  x and y

* Update digital_image_processing/filters/local_binary_pattern.py

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

* Update digital_image_processing/filters/local_binary_pattern.py

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

* Update digital_image_processing/filters/local_binary_pattern.py

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

* Update local_binary_pattern.py

* undo changes made on get_neighbors_pixel()

* files formatted by black

* Update digital_image_processing/filters/local_binary_pattern.py

ok thanks

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

* add test for get_neighbors_pixel() function

* reviewed

* fix  get_neighbors_pixel

* Update test_digital_image_processing.py

* updating DIRECTORY.md

* Create code_quality.yml

* Create code_quality.yml

* Delete code_quality.yml

* Update code_quality.yml

* Delete code_quality.yml

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-08-24 06:48:54 +02:00
Christian Clauss
24d3cf8244
The black formatter is no longer beta (#5960)
* The black formatter is no longer beta

* pre-commit autoupdate

* pre-commit autoupdate

* Remove project_euler/problem_145 which is killing our CI tests

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-01-30 20:29:54 +01:00
Mozartus
424c200847
Add gabor filter (#5289)
* add gabor_filter.py

* Update gabor_filter.py

* update gabor_filter.py

* add doctest

* change import order

* Update digital_image_processing/filters/gabor_filter.py

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update gabor_filter.py

* fix gabor filter calculation

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-11-02 18:06:39 +08:00
Saurabh Suresh Powar
433b804f7d
Added morphological operations, fixes: #5197 (#5199)
* Added morphological operations, fixes: #5197

* Added dilation tests and type hints

* Added erosion tests and type hints

* fixes: TheAlgorithms#5197

* fixes: TheAlgorithms#5197

* Update erosion_operation.py

* made suggested changes in dilation

* made suggested changes in erosion

* made suggested changes in dilation

* removed extra spaces in the tests

* removed extra spaces in the tests
2021-10-16 16:32:40 +02:00
Dhruv Manilawala
6f21f76696
fix(ci): Update pre-commit hooks and apply new black (#4359)
* fix(ci): Update pre-commit hooks and apply new black

* remove empty docstring
2021-04-26 07:46:50 +02:00
algobytewise
531d2d6d7e
Mypy fix rotation.py (#4319)
* fix type-hints arguments

* fix matrices & image-path

* Update build.yml

* Revert "Update build.yml"

This reverts commit c2d04aef65.

* use pathlib

* feat: Add mypy configuration file (#4315)

* feat: Add mypy config file

* refactor: Remove mypy options from build workflow

* Remove linear_algebra

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

* rebase & update mypy.ini

* fix pre-commit errors

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2021-04-06 15:34:18 +02:00
Dmytro Litvinov
5903948cf3
Fixes: #2404. Fix PIL DeprecationWarnings in pytest output (#2678) 2020-10-03 09:22:22 +02:00
Dhruv
48357cea5b
Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +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
5f4da5d616
isort --profile black . (#2181)
* updating DIRECTORY.md

* isort --profile black .

* Black after

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-06 09:44:19 +02:00
Furkan Atesli
6f80ca821c
Create change_brightness.py (#2126)
* Create change_brightness.py

* Update change_brightness.py

* Update change_brightness.py

* Update change_brightness.py

* Update change_brightness.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-17 07:49:20 +02:00
Christian Clauss
b9e5259aeb
Fix long line, tests (#2123)
* Fix long line

* updating DIRECTORY.md

* Add doctest

* ...

* ...

* Update tabu_search.py

* space

* Fix doctest

    >>> find_neighborhood(['a','c','b','d','e','a'])  # doctest: +NORMALIZE_WHITESPACE
    [['a','e','b','d','c','a',90], [['a','c','d','b','e','a',90],
     ['a','d','b','c','e','a',93], ['a','c','b','e','d','a',102],
     ['a','c','e','d','b','a',113], ['a','b','c','d','e','a',93]]

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-06-16 14:29:13 +02:00
Christian Clauss
9316e7c014
Set the Python file maximum line length to 88 characters (#2122)
* flake8 --max-line-length=88

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-16 10:09:19 +02:00
Christian Clauss
1f8a21d727
Tighten up psf/black and flake8 (#2024)
* Tighten up psf/black and flake8

* Fix some tests

* Fix some E741

* Fix some E741

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-22 08:10:11 +02:00
Christian Clauss
69171a9ac3
The new version of flake8 is linting f-strings (#1976)
* The new version of flake8 is linting f-strings

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-13 20:03:28 +02:00
Maxim R
369562a1e8
Upgrades to caesar_cipher.py (#1958)
* Added more flexibility to functions, decreased amount of repeating code

* Added docstrings

* Updated input functions

* Added doctests

* removed test piece of code

* black .

* Updated caesar cipher standard alphabet to fit python 3.8

* Update and rename sleepsort.py to sleep_sort.py

* Or 4

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-08 07:44:07 +02:00
mateuszz0000
c18c677a38
Added Nearest neighbour algorithm (#1934) 2020-05-07 23:47:28 +02:00
Christian Clauss
1ad78b2663
Fix invalid escape sequence in binary_search_tree.py (#1920)
* Fix invalid escape sequence in binary_search_tree.py

data_structures/binary_tree/binary_search_tree.py:156
  /home/travis/build/TheAlgorithms/Python/data_structures/binary_tree/binary_search_tree.py:156: DeprecationWarning: invalid escape sequence \

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-01 02:17:11 +05:30
mateuszz0000
3d0680eddf
Added Burkes dithering algorithm. (#1916)
* Added Burkes dithering algorithm

* Added unit tests for burkes algorithm

* Fix burkes algorithm

* Added some additional information

* Fixed CI tests

* Update digital_image_processing/dithering/burkes.py

Co-Authored-By: Christian Clauss <cclauss@me.com>

* Update digital_image_processing/dithering/burkes.py

Co-Authored-By: Christian Clauss <cclauss@me.com>

* Update digital_image_processing/dithering/burkes.py

Co-Authored-By: Christian Clauss <cclauss@me.com>

* Propogate the += and add a doctest

* Fix doctest

* @staticmethod --> @ classmethod to ease testing

* def test_burkes(file_path):

* Fix for mypy checks

* Fix variable order in get_greyscale

* Fix get_greyscale method

* Fix get_greyscale method

* 3.753

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-04-30 11:54:20 +02:00
mateuszz0000
5933cd4d83
Added sepia tone (#1877)
* Add sepia tone

* Add unit test

* technic --> technique

* Update digital_image_processing/sepia.py

Co-Authored-By: Christian Clauss <cclauss@me.com>

* Update digital_image_processing/sepia.py

Co-Authored-By: Christian Clauss <cclauss@me.com>

* Fixed errors after commit changes

* Fixed errors

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-04-26 11:59:11 +02:00
matkosoric
7f04e5cd34
contribution guidelines checks (#1787)
* spelling corrections

* review

* improved documentation, removed redundant variables, added testing

* added type hint

* camel case to snake case

* spelling fix

* review

* python --> Python # it is a brand name, not a snake

* explicit cast to int

* spaces in int list

* "!= None" to "is not None"

* Update comb_sort.py

* various spelling corrections in documentation & several variables naming conventions fix

* + char in file name

* import dependency - bug fix

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-03-04 13:40:28 +01:00
praveennadiminti
c1a4cc96c8
Add bilateral filter (#1786)
* Added Bilateral filter

* Added Bilateral filter

* changed types of varS and varI

* formatted with black

* added type hints

* changed variable names

* Update bilateral_filter.py

* Drop transitory variables, add parse_args()

Co-authored-by: vinayak <itssvinayak@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-02-26 15:56:45 +05:30
Christian Clauss
bfcb95b297
Create codespell.yml (#1698)
* fixup! Format Python code with psf/black push

* Create codespell.yml

* fixup! Format Python code with psf/black push
2020-01-18 13:24:33 +01:00
Christian Clauss
28419cf839 pyupgrade --py37-plus **/*.py (#1654)
* pyupgrade --py37-plus **/*.py

* fixup! Format Python code with psf/black push
2020-01-03 22:25:36 +08:00
Binish Manandhar
1cbeaa252a Image processing algorithms added (#616)
* Image processing algorithms added

* Example images included

* Issues resolved

* class added

* Naming issues fixes

* Create file_path
2019-12-10 07:52:40 +01:00
Shoaib Asgar
9316618611 digital_image_processing/convert_to_negative (#1216)
* digital_image_processing/convert_to_negative

* added doc

* added test code

* Update convert_to_negative.py
2019-12-09 03:29:01 +01:00
Níkolas Vargas
938dd0bbb5 improved prime numbers implementation (#1606)
* improved prime numbers implementation

* fixup! Format Python code with psf/black push

* fix type hint

* fixup! Format Python code with psf/black push

* fix doctests

* updating DIRECTORY.md

* added prime tests with negative numbers

* using for instead filter

* updating DIRECTORY.md

* Remove unused typing.List

* Remove tab indentation

* print("Sorted order is:", " ".join(a))
2019-12-07 06:39:08 +01:00
João Gustavo A. Amorim
3cfca42f17 add the index calculation class at digital_image_processing and the hamming code algorithm at hashes (#1152)
* add the index calculation at difital_image_processing file

* make changes at index_calculation

* update the variables to self variables at functions

* update the word wrap in comments at index_calculation

* add the hamming code algorithm

* Wrap long lines
2019-12-06 07:13:10 +01:00
Christian Clauss
ec7bc7c7cd Tabs --> spaces in quine_mc_cluskey.py (#1426)
* Tabs --> spaces in quine_mc_cluskey.py

* fixup! Format Python code with psf/black push
2019-11-21 22:21:40 +08:00
Fakher Mokadem
e8aa81297a Update gaussian_filter.py (#1548)
* Update gaussian_filter.py

Changed embedded for loops with product. This way range(dst_height) is called only once, instead of being called $dst_height.

* Update gaussian_filter.py

fixed missing width
2019-11-20 11:06:32 +05:30
Matheus T. Guimarães
5fd868c460 Add algorithm to rotate images (#1420)
* Add algorithm to rotate image

* Edit function to be compliant in Black and Flake8 formats

* Add type hints in get_rotation() and  enumerate() in loop
2019-10-22 21:19:38 +02:00
William Zhang
9eac17a408 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
Marvin M. Michum
f8e30cfab1
Digital Image Processing Tests (#1178)
* add version of smaller image

* swap image in tests

* edits for image src
2019-09-13 07:40:14 -04:00
Marvin M. Michum
c686cc5863 fix outdated fork error (#1117) 2019-08-08 17:59:15 +02:00