mjk22071998
5535759e99
"Fixed typo in class name 'SortedLinedList' to 'SortedLinkedList' in doctests."
2024-10-01 14:17:10 +05:00
mjk22071998
47f5c05bc7
Merge branch 'master' of https://github.com/mjk22071998/Python
2024-10-01 14:12:22 +05:00
mjk22071998
807ceada2e
"Removed type hints for None in Node and SortedLinkedList classes."
2024-10-01 14:12:15 +05:00
pre-commit-ci[bot]
2a10afe217
[pre-commit.ci] auto fixes from pre-commit.com hooks
...
for more information, see https://pre-commit.ci
2024-10-01 09:10:41 +00:00
mjk22071998
0795e15a6c
"Updated docstrings and comments in SortedLinkedList class and Node dataclass."
2024-10-01 14:10:05 +05:00
mjk22071998
3621bf39c9
Data type of data given and docstring generated for Node class constructor
2024-10-01 14:07:51 +05:00
pre-commit-ci[bot]
e89bb5c3a9
[pre-commit.ci] auto fixes from pre-commit.com hooks
...
for more information, see https://pre-commit.ci
2024-10-01 09:05:41 +00:00
mjk22071998
eec1c3a98b
Doctests added
2024-10-01 14:05:02 +05:00
mjk22071998
156392f49f
return types added
2024-10-01 13:33:55 +05:00
mjk22071998
8c1d01684d
format call removed
2024-10-01 13:29:22 +05:00
mjk22071998
187f4da98a
Errors from ruff tests solved
2024-10-01 13:25:32 +05:00
mjk22071998
01dfb178b2
Errors from ruff tests solved
2024-10-01 13:25:18 +05:00
mjk22071998
4ae57dc896
Corrected errors in ruff test
2024-10-01 13:12:39 +05:00
pre-commit-ci[bot]
583e564987
[pre-commit.ci] auto fixes from pre-commit.com hooks
...
for more information, see https://pre-commit.ci
2024-10-01 08:03:03 +00:00
mjk22071998
0a1c71e34d
Sorted linked list added
2024-10-01 12:53:22 +05:00
Maxim Smolskiy
7b88e15b1c
Enable ruff RUF007 rule ( #11349 )
...
* Enable ruff RUF005 rule
* Enable ruff RUF007 rule
* Fix
* Fix
* Fix
* Update sorts/bead_sort.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update sorts/bead_sort.py
* Revert "Update sorts/bead_sort.py"
This reverts commit b10e5632e4479c2117c8b67113b5aa6545f127aa.
* Revert "Update sorts/bead_sort.py"
This reverts commit 2c1816bf102eeec5aa39cb2f1806afb64b672d14.
* Update sorts/bead_sort.py
---------
Co-authored-by: Christian Clauss <cclauss@me.com>
2024-04-20 16:20:27 +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
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]
ed8d9209da
[pre-commit.ci] pre-commit autoupdate ( #11275 )
...
* [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.14 → v0.2.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.14...v0.2.0 )
* Upgrade pyproject.toml
* Revert sudoku_solver.py RUF017 Avoid quadratic list summation
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2024-02-05 20:48:10 +01:00
Christian Clauss
eb17fcf8f5
Use dataclasses in circular_linked_list.py ( #10884 )
...
* Use dataclasses in circular_linked_list.py
* updating DIRECTORY.md
---------
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-24 08:45:36 -04:00
Aqib Javid Bhat
30122062b9
Add Floyd's Cycle Detection Algorithm ( #10833 )
...
* Add Floyd's Cycle Detection Algorithm
* Add tests for add_node function
* Apply suggestions from code review
* Update floyds_cycle_detection.py
---------
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-10-23 13:56:43 -04:00
Precious C. Jacob
c92e86bd79
Add tests to data_structures/linked_list/swap_nodes.py ( #10751 )
...
* Added doctests to the swap_nodes file under linkedlist data structure
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added doctests to the swap_nodes file under linkedlist data structure
* Added doctests to the swap_nodes file under linkedlist data structure
* Added doctests to the swap_nodes file under linkedlist data structure
* Update swap_nodes.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-22 01:33:49 +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
Christian Clauss
844270c6e9
Remove backslashes from is_palindrome.py ( #10169 )
...
@SaiHarshaK Fixes https://github.com/TheAlgorithms/Python/pull/10081#discussion_r1349651289
2023-10-10 06:42:07 +13:00
Sai Harsha Kottapalli
12e8e9ca87
Add DocTests to is_palindrome.py ( #10081 )
...
* add doctest ut
* test complete
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* format
* ruff update
* cover line 154
* Update data_structures/linked_list/is_palindrome.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* use dataclass
* pre-commit fix
* Fix mypy errors
* use future annotations
---------
Co-authored-by: Harsha Kottapalli <skottapalli@microsoft.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-10-09 14:06:16 +02:00
Christian Clauss
d0c54acd75
Use dataclasses in singly_linked_list.py ( #9886 )
2023-10-06 15:31:11 +13:00
Christian Clauss
5869fda742
print reverse: A LinkedList with a tail pointer ( #9875 )
...
* print reverse: A LinkedList with a tail pointer
* updating DIRECTORY.md
---------
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-06 10:55:13 +13:00
Tianyi Zheng
dfdd78135d
Fix mypy errors in circular_linked_list.py and swap_nodes.py ( #9707 )
...
* updating DIRECTORY.md
* Fix mypy errors in circular_linked_list.py
* Fix mypy errors in swap_nodes.py
---------
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-04 18:05:00 +02:00
Siddhant Totade
3fd3497f15
Add Comments ( #9668 )
...
* docs : add comment in circular_linked_list.py and swap_nodes.py
* docs : improve comments
* docs : improved docs and tested on pre-commit
* docs : add comment in circular_linked_list.py and swap_nodes.py
* docs : improve comments
* docs : improved docs and tested on pre-commit
* docs : modified comments
* Update circular_linked_list.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* docs : improved
* Update data_structures/linked_list/circular_linked_list.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update data_structures/linked_list/circular_linked_list.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update data_structures/linked_list/swap_nodes.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update data_structures/linked_list/swap_nodes.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update data_structures/linked_list/swap_nodes.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update data_structures/linked_list/swap_nodes.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update requirements.txt
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update data_structures/linked_list/circular_linked_list.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Apply suggestions from code review
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update circular_linked_list.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-04 11:25:26 +02:00
Bama Charan Chhandogi
e798e5acde
add reverse k group linkedlist ( #9323 )
...
* add reverse k group linkedlist
* [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
* update
* [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
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* Update reverse_k_group.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update reverse_k_group.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update reverse_k_group.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-02 02:19:39 +02:00
Muhammad Umer Farooq
bacad12a1f
[NEW ALGORITHM] Rotate linked list by K. ( #9278 )
...
* Rotate linked list by k.
* Rotate linked list by k.
* updated variable name.
* Update data_structures/linked_list/rotate_linked_list_by_k.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
* Update data_structures/linked_list/rotate_linked_list_by_k.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update data_structures/linked_list/rotate_linked_list_by_k.py
* Make Node a dataclass
---------
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-01 18:11:16 +02:00
Saksham Saha
c9b4b8002f
Added an add at position subroutiune to linked list ( #9020 )
...
* added addAtPosition to simple linked list
* added addAtPosition to simple linked list
* modified the add function to take an optional position command
* fixed type safety errors:
* fixed type safety errors:
* fixed type safety errors:
* fixed type safety errors:
* fixed size error
* fixed size error
* added doctest and updates the else after checking if posiiton argument less than 0 or not
* added doctest and updates the else after checking if posiiton argument less than 0 or not
* fixed the contributing.md mistake
* added doctest for out of bounds position value, both negative and positive
2023-09-08 08:20:28 -04: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
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
amirsoroush
63710883c8
Remove extra len
calls in doubly-linked-list's methods ( #8600 )
2023-04-01 17:53:21 +05:30
amirsoroush
e4d90e2d5b
change space complexity of linked list's __len__ from O(n) to O(1) ( #8183 )
2023-04-01 08:26:43 +02: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
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
Christian Clauss
45b3383c39
Flake8: Drop ignore of issue A003 ( #7949 )
...
* Flake8: Drop ignore of issue A003
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-11-02 19:20:45 +01:00
Christian Clauss
19bff003aa
Adopt Python >= 3.8 assignment expressions using auto-walrus ( #7737 )
...
* Adopt Python >= 3.8 assignment expressions using auto-walrus
* updating DIRECTORY.md
* [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: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-28 15:54:54 +02: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
Caeden Perelli-Harris
9bba42eca8
refactor: Indent ... for visual purposes ( #7744 )
2022-10-27 19:42:30 +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
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
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
Christian Clauss
b75a7c77f8
pre-commit autoupdate: pyupgrade v2.34.0 -> v2.37.0 ( #6245 )
...
* pre-commit autoupdate: pyupgrade v2.34.0 -> v2.37.0
* pre-commit run --all-files
2022-07-11 10:19:52 +02:00
Christian Clauss
1ae5abfc3c
Replace typing.optional with new annotations syntax ( #5829 )
...
* Replace typing.optional with new annotations syntax
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-11-17 04:43:02 +01:00