Commit Graph

189 Commits

Author SHA1 Message Date
Christian Clauss
0177ae1cd5
Upgrade to Python 3.13 (#11588) 2024-09-30 23:01:15 +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
a42eb35702
Enable ruff E741 rule (#11370)
* Enable ruff E741 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-04-19 21:30:22 +02:00
Maxim Smolskiy
93fb555e0a
Enable ruff SIM102 rule (#11341)
* Enable ruff SIM102 rule

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

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

* Fix

* [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-04-02 03:27:56 +02:00
Maxim Smolskiy
39daaf8248
Enable ruff RUF100 rule (#11337) 2024-04-01 21:36:41 +02:00
Maxim Smolskiy
b5cb1fba0d
Enable ruff DTZ005 rule (#11327)
* Enable ruff DTZ005 rule

* Fix other/gauss_easter.py

* Fix

* Fix web_programming/instagram_pic.py

* Fix web_programming/instagram_video.py

* Apply suggestions from code review

* Update instagram_pic.py

* datetime.now(tz=UTC).astimezone()

* .astimezone()

* Fix

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2024-03-25 21:54:11 +01:00
Maxim Smolskiy
102e9a31b6
Enable ruff DTZ001 rule (#11326)
* updating DIRECTORY.md

* Enable ruff DTZ001 rule

* Fix other/gauss_easter.py

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

---------

Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
2024-03-25 08:43:24 +01:00
Maxim Smolskiy
a936e94704
Enable ruff ARG001 rule (#11321)
* Enable ruff ARG001 rule

* Fix dynamic_programming/combination_sum_iv.py

* Fix machine_learning/frequent_pattern_growth.py

* Fix other/davis_putnam_logemann_loveland.py

* Fix other/password.py

* Fix

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

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

* Fix physics/n_body_simulation.py

* Fix project_euler/problem_145/sol1.py

* Fix project_euler/problem_174/sol1.py

* Fix scheduling/highest_response_ratio_next.py

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

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

* Fix

* Fix

* Fix scheduling/job_sequencing_with_deadline.py

* Fix scheduling/job_sequencing_with_deadline.py

* Fix

* Fix

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-03-20 15:00:17 +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
Maxim Smolskiy
fd27953d44
Reenable files when TensorFlow supports the current Python (#11318)
* Remove python_version < '3.12' for tensorflow

* Reenable dynamic_programming/k_means_clustering_tensorflow.py

* updating DIRECTORY.md

* Try to fix ruff

* Try to fix ruff

* Try to fix ruff

* Try to fix ruff

* Try to fix ruff

* Reenable machine_learning/lstm/lstm_prediction.py

* updating DIRECTORY.md

* Try to fix ruff

* Reenable computer_vision/cnn_classification.py

* updating DIRECTORY.md

* Reenable neural_network/input_data.py

* updating DIRECTORY.md

* Try to fix ruff

* Try to fix ruff

* Try to fix mypy

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

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

* Try to fix ruff

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

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

---------

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-03-12 09:35:49 +01:00
Tianyi Zheng
579250363d
Speed up dijkstra_bankers_algorithm.py (#10861)
* updating DIRECTORY.md

* Rename dijkstra_bankers_algorithm.py

* Remove sleep() call

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-26 14:36:53 +02:00
Bhavesh Mathur
17059b7ece
Added doctests , type hints for other/nested_brackets.py (#10872)
* Added doctests , type hints

* Update nested_brackets.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-24 11:03:22 +02:00
Tianyi Zheng
ce0ede6476
Fix typo in DPLL file name (#10723)
* Fix DPLL file name

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-20 09:08:23 +02:00
Sai Harsha Kottapalli
876087be99
Add DocTests to magicdiamondpattern.py (#10135)
* magicdiamondpattern doctest

* remove start part

---------

Co-authored-by: Harsha Kottapalli <skottapalli@microsoft.com>
2023-10-09 14:16:43 +02:00
pre-commit-ci[bot]
895dffb412
[pre-commit.ci] pre-commit autoupdate (#9543)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.291 → v0.0.292](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.291...v0.0.292)
- [github.com/codespell-project/codespell: v2.2.5 → v2.2.6](https://github.com/codespell-project/codespell/compare/v2.2.5...v2.2.6)
- [github.com/tox-dev/pyproject-fmt: 1.1.0 → 1.2.0](https://github.com/tox-dev/pyproject-fmt/compare/1.1.0...1.2.0)

* updating DIRECTORY.md

* Fix typos in test_min_spanning_tree_prim.py

* Fix typos

* codespell --ignore-words-list=manuel

---------

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: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-10-07 21:32:28 +02:00
Sarvjeet Singh
795e97e87f
Added Majority Voting Algorithm (#9866)
* Create MajorityVoteAlgorithm.py

* Update and rename MajorityVoteAlgorithm.py to majorityvotealgorithm.py

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

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

* Update and rename majorityvotealgorithm.py to majority_vote_algorithm.py

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

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

* Update majority_vote_algorithm.py

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

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

* Update majority_vote_algorithm.py

* Update majority_vote_algorithm.py

* Update other/majority_vote_algorithm.py

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

* renaming variables majority_vote_algorithm.py

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

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

* Update majority_vote_algorithm.py

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

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

* Update majority_vote_algorithm.py

* Update majority_vote_algorithm.py

* Update majority_vote_algorithm.py

* Update majority_vote_algorithm.py

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

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

* Update other/majority_vote_algorithm.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 other/majority_vote_algorithm.py

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

* adding more testcases majority_vote_algorithm.py

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

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

* Update majority_vote_algorithm.py

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

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

* Update majority_vote_algorithm.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-06 15:49:34 +02:00
Caeden Perelli-Harris
dec96438be
Create word search algorithm (#8906)
* feat(other): Create word_search algorithm

* updating DIRECTORY.md

* doc(word_search): Link to wikipedia article

* Apply suggestions from code review

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

* Update word_search.py

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-09-30 00:57:56 -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
Bazif Rasool
8b831cb600
Added Altitude Pressure equation (#8909)
* Added Altitude Pressure equation

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

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

* Removed trailing whitespaces

* Removed pylint

* Fix lru_cache_pythonic.py

* Fixed spellings

* Fix again lru_cache_pythonic.py

* Update .vscode/settings.json

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

* Third fix lru_cache_pythonic.py

* Update .vscode/settings.json

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

* 4th fix lru_cache_pythonic.py

* Update physics/altitude_pressure.py

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

* lru_cache_pythonic.py: def get(self, key: Any, /) -> Any | None:

* Delete lru_cache_pythonic.py

* Added positive and negative pressure test cases

* [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>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-07-30 17:00:58 +02:00
Yatharth Mathur
d31750adec
Pythonic implementation of LRU Cache (#4630)
* Added a more pythonic implementation of LRU_Cache.[#4628]

* Added test cases and doctest

* Fixed doc tests

* Added more tests in doctests and fixed return types fixes [#4628]

* better doctests

* added doctests to main()

* Added dutch_national_flag.py in sorts. fixing [#4636]

* Delete dutch_national_flag.py

incorrect commit

* Update lru_cache_pythonic.py

* Remove pontification

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-07-30 11:27:45 +02:00
Caeden Perelli-Harris
9e08c7726d
Small docstring time complexity fix in number_container _system (#8875)
* fix: Write time is O(log n) not O(n log n)

* chore: Update pre-commit ruff version

* revert: Undo previous commit
2023-07-22 12:34:19 +02:00
Caeden Perelli-Harris
93fb169627
[Upgrade Ruff] Fix all errors raised from ruff (#8879)
* chore: Fix tests

* chore: Fix failing ruff

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

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

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

* chore: Fix ruff errors

* chore: Fix ruff errors

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

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

* Update cellular_automata/game_of_life.py

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

* chore: Update ruff version in pre-commit

* chore: Fix ruff errors

* Update edmonds_karp_multiple_source_and_sink.py

* Update factorial.py

* Update primelib.py

* Update min_cost_string_conversion.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-07-22 12:05:10 +02:00
Tianyi Zheng
a0eec90466
Consolidate duplicate implementations of max subarray (#8849)
* Remove max subarray sum duplicate implementations

* updating DIRECTORY.md

* Rename max_sum_contiguous_subsequence.py

* Fix typo in dynamic_programming/max_subarray_sum.py

* Remove duplicate divide and conquer max subarray

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-07-11 11:44:12 +02:00
Caeden Perelli-Harris
7775de0ef7
Create number container system algorithm (#8808)
* feat: Create number container system algorithm

* updating DIRECTORY.md

* chore: Fix failing tests

* Update other/number_container_system.py

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

* Update other/number_container_system.py

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

* Update other/number_container_system.py

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

* chore: Add more tests

* chore: Create binary_search_insert failing test

* type: Update typehints to accept str, list and range

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-06-08 14:40:38 +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
Caeden Perelli-Harris
9b3e4028c6
Fixes broken "Create guess_the_number_search.py" (#8746) 2023-05-17 18:47:23 +12:00
Harkishan Khuva
a2783c6597
Create guess_the_number_search.py (#7937) 2023-05-17 12:22:24 +12:00
Alexander Pantyukhin
61cfb43d2b
Add h index (#8036) 2023-05-17 12:21:16 +12:00
Pronoy Mandal
793e564e1d
Create maximum_subsequence.py (#7811) 2023-05-11 07:00:59 +12:00
Christian Clauss
521fbca61c
Replace flake8 with ruff (#8184) 2023-03-16 13:31:29 +01:00
Christian Clauss
c96241b5a5
Replace bandit, flake8, isort, and pyupgrade with ruff (#8178)
* Replace bandit, flake8, isort, and pyupgrade with ruff

* Comment on ruff rules

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-03-15 13:58:25 +01:00
Maxim Smolskiy
ee778128bd
Reduce the complexity of other/scoring_algorithm.py (#8045)
* Increase the --max-complexity threshold in the file .flake8
2023-03-02 10:27:07 +05:30
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
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
Maxim Smolskiy
978414bd50
Reduce the complexity of other/graham_scan.py (#7953)
* Reduce the complexity of other/graham_scan.py

* Lower the --max-complexity threshold in the file .flake8

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

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

* Fix tests

* Update other/graham_scan.py

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

* Update graham_scan.py

* Update other/graham_scan.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-02 23:56:30 +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
Caeden Perelli-Harris
598f6a26a1
refactor: Condense password related files in one (#7939)
* refactor: Condense `password` related files in one

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

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

* Update other/password.py

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

* dynamic_programming

* test: Make test input `str`

* requirements.txt: Remove cython>=0.29.28  # For statsmodels on Python 3.11

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-02 17:20:57 +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
TechFreak107
fecbf59436
Modified 'pascal_triangle.py' program (#7901)
* Added pascals_triangle.py program to maths directory

* Deleted 'pascals_triangle.py' because of duplication. Added a optimized function to generate pascal's triangle to 'pascal_triangle.py' program. Added some aadditional doctests to the existing function. Added some type check functionality to the existing function.

* Modified type check hints in 'generate_pascal_triangle_optimized' function'

q

* Modified 'pascal_triangle' prgram

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

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

* Update pascal_triangle.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-10-31 17:58:42 +01:00
Wissam Fawaz
d1430aa36b
Implemented a Pascal triangle generator (#7317)
* Added a Pascal triangle implementation to the other folder

* Added Pascal triangle implementation to the other folder.

* Added Pascal triangle implementation to the other folder.

* Added Pascal triangle implementation to the other folder.

* Implemented a Pascal triangle generator.

* Reversed Changes to DIRECTORY.md

* Reversed changed to .md files

* Update other/pascal_triangle.py

Removed personal info

Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>

* Update pascal_triangle.py

Expanded the description of the algorithm

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

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

* Printed output in triangular form

* Update CONTRIBUTING.md

Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-30 14:14:22 +01:00
Jeremias Moreira Gomes
ab9d8f3874
Adding a Quine in Python. (#6807)
* Adding a Quine in Python.

* [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-30 12:09:23 +01:00
Andrey
1550731cb7
Remove file-level flake8 suppression (#7844)
* Remove file-level flake8 suppression

* updating DIRECTORY.md

* Fix tests

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-29 22:45:21 +02:00
Pronoy Mandal
18ffc4dec8
Update password_generator.py (#7745)
* Update password_generator.py

1. Use secrets module instead of random for passwords as it gives a secure source of randomness
2. Add type annotations for functions
3. Replace ctbi (variable for the characters to be included) with a more meaningful and short name
4. Use integer division instead of obtaining the integer part of a division computing a floating point

* [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-29 14:54:13 +02:00
Pronoy Mandal
528b129019
Update maximum_subarray.py (#7757)
* Update maximum_subarray.py

1. Rectify documentation to indicate the correct output: function doesn't return the subarray, but rather returns a sum.
2. Make the function more Pythonic and optimal.
3. Make function annotation generic i.e. can accept any sequence.
4. Raise value error when the input sequence is empty.

* Update maximum_subarray.py

1. Use the conventions as mentioned in pep-0257.
2. Use negative infinity as the initial value for the current maximum and the answer.

* Update maximum_subarray.py

Avoid type conflict by returning the answer cast to an integer.

* Update other/maximum_subarray.py

Co-authored-by: Andrey <Cjkjvfnby@gmail.com>

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

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

* Update maximum_subarray.py

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

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

* Update maximum_subarray.py

Remove typecast to int for the final answer

Co-authored-by: Andrey <Cjkjvfnby@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-28 21:08:41 +02:00
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
6e69181d1f
refactor: Replace list() and dict() calls with literals (#7198) 2022-10-15 06:37:03 +05:30
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