Commit Graph

275 Commits

Author SHA1 Message Date
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
Linus M. Henkel
5b0890bd83
Dijkstra algorithm with binary grid (#8802)
* Create TestShiva

* Delete TestShiva

* Implementation of the Dijkstra-Algorithm in a binary grid

* Update double_ended_queue.py

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

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

* Update least_common_multiple.py

* Update sol1.py

* Update pyproject.toml

* Update pyproject.toml

* https://github.com/astral-sh/ruff-pre-commit v0.0.274

---------

Co-authored-by: ShivaDahal99 <130563462+ShivaDahal99@users.noreply.github.com>
Co-authored-by: jlhuhn <134317018+jlhuhn@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>
2023-06-22 13:49:09 +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
Ishab
ebc2d5d79f
Add Project Euler problem 79 solution 1 (#8607)
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2023-04-02 17:34:11 +05:30
Maxim Smolskiy
3d2012c4ba
Add Project Euler problem 94 solution 1 (#8599)
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>
2023-04-01 17:50:08 +05:30
Maxim Smolskiy
d66e1e8732
Add Project Euler problem 800 solution 1 (#8567)
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>
2023-04-01 17:48:13 +05:30
Maxim Smolskiy
dc4f603dad
Add Project Euler problem 187 solution 1 (#8182)
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>
2023-04-01 11:17:24 +05:30
Christian Veenhuis
86b2ab09aa
Fix broken links to Gitter Community (Fixes: #8197) (#8546)
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-03-26 18:20:47 +02:00
Genesis
7cdb011ba4
New gitter link added or replaced (#8551)
* New gitter link added

* ruff==0.0.258

* noqa: S310

* noqa: S310

* Update ruff.yml

* Add Ruff rule S311

* Ruff v0.0.259

* return ("{:08x}" * 5).format(*self.h)

* pickle.load(f)  # noqa: S301

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-03-26 17:19:18 +02: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
adc3ccdabe
Add Project Euler problem 131 solution 1 (#8179)
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>
2023-03-15 18:26:03 +05:30
Maxim Smolskiy
9701e459e8
Add Project Euler problem 100 solution 1 (#8175)
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>
2023-03-14 11:09:36 +05:30
Maxim Smolskiy
9720e6a6cf
Add Project Euler problem 117 solution 1 (#6872)
Update DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-03-02 22:21:48 +05:30
Maxim Smolskiy
069a14b1c5
Add Project Euler problem 082 solution 1 (#6282)
Update DIRECTORY.md
---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-03-02 10:25:47 +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
Christian Clauss
08c2245705
Upgrade to flake8 v6 (#8007)
* Upgrade to flake8 v6

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-11-29 16:56:41 +01:00
Mark Mayo
f32d611689
clean of unnecessary checks, imports, calls (#7993) 2022-11-21 00:00:27 +13:00
Dhruv Manilawala
3bf86b91e7
fix: no implicit optional (#7984) 2022-11-15 14:55:14 +01:00
Saksham1970
84facb78b2
Project Euler: 092 decreased the time (#6627)
* Added explanation and increased speed of the solution of problem 092

* updating DIRECTORY.md

* Added temporary fix to the failing of problem 104

* Reduced few seconds by minor improvements

* Update sol.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-30 11:10:16 +01:00
Caeden Perelli-Harris
9bba42eca8
refactor: Indent ... for visual purposes (#7744) 2022-10-27 19:42:30 +02:00
Maxim Smolskiy
d407476531
fix: increase str conversion limit where required (#7604)
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-25 06:27:03 +05:30
Maxim Smolskiy
a041b64f7a
feat: add Project Euler problem 073 solution 1 (#6273)
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-24 18:59:49 +05:30
Caeden Perelli-Harris
6d20e2b750
Add flake8-broken-line to pre-commit (#7338)
* ci: Add ``flake8-broken-line`` plugin to ``pre-commit``

* refactor: Fix errors from ``flake8-broken-line``
2022-10-16 21:50:48 +02:00
Caeden
c6582b35bf
refactor: Move constants outside of variable scope (#7262)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-16 15:03:29 +05:30
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
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
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
pre-commit-ci[bot]
756bb268eb
[pre-commit.ci] pre-commit autoupdate (#6629)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 22.6.0 → 22.8.0](https://github.com/psf/black/compare/22.6.0...22.8.0)
- [github.com/asottile/pyupgrade: v2.37.0 → v2.38.2](https://github.com/asottile/pyupgrade/compare/v2.37.0...v2.38.2)
- https://gitlab.com/pycqa/flake8https://github.com/PyCQA/flake8
- [github.com/PyCQA/flake8: 3.9.2 → 5.0.4](https://github.com/PyCQA/flake8/compare/3.9.2...5.0.4)
- [github.com/pre-commit/mirrors-mypy: v0.961 → v0.981](https://github.com/pre-commit/mirrors-mypy/compare/v0.961...v0.981)
- [github.com/codespell-project/codespell: v2.1.0 → v2.2.1](https://github.com/codespell-project/codespell/compare/v2.1.0...v2.2.1)

* Fix a long line

* Update sol1.py

* Update sol1.py

* lambda_

* Update multi_level_feedback_queue.py

* Update double_ended_queue.py

* Update sequential_minimum_optimization.py

* Update .pre-commit-config.yaml

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-03 22:00:45 +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
Nikos Giachoudis
2104fa7aeb
Unify O(sqrt(N)) is_prime functions under project_euler (#6258)
* fixes #5434

* fixes broken solution

* removes assert

* removes assert

* Apply suggestions from code review

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

* Update project_euler/problem_003/sol1.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-09-14 09:40:04 +01:00
Maxim Smolskiy
063a0eced9
feat: add Project Euler problem 115 solution 1 (#6303)
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-08-07 16:50:45 +05:30
Maxim Smolskiy
a69d880bb5
feat: add Project Euler problem 114 solution 1 (#6300)
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-08-07 07:37:35 +05:30
Maxim Smolskiy
defc205ef4
perf: improve Project Euler problem 203 solution 1 (#6279)
Improve solution (locally 1500+ times - from 3+ seconds to ~2 milliseconds)

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-08-06 19:34:24 +05:30
Maxim Smolskiy
97f25d4b43
feat: add Project Euler problem 587 solution 1 (#6269)
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-26 21:45:14 +05:30
Maxim Smolskiy
90959212e5
perf: improve Project Euler problem 030 solution 1 (#6267)
Improve solution (locally 3+ times - from 3+ seconds to ~1 second)

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-25 22:11:12 +05:30
keshav Sharma
7d9ebee75f
chore: rename gcd to greatest_common_divisor (#6265)
As described in CONTRIBUTING.md

> Expand acronyms because gcd() is hard to understand but greatest_common_divisor() is not.

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2022-07-24 21:33:10 +05:30
Maxim Smolskiy
c45fb3c294
perf: Project Euler problem 145 solution 1 (#6259)
Improve solution (~30 times - from 900+ seconds to ~30 seconds)

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-23 07:23:46 +05:30
Christian Clauss
dad789d903
Get rid of the Union (#6246)
* Get rid of the Union

* updating DIRECTORY.md

* Get rid of the Union

* Remove the redundant pre-commit runs.

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-11 13:11:17 +02:00
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
kugiyasan
8004671b98
Add Project Euler 68 Solution (#5552)
* updating DIRECTORY.md

* Project Euler 68 Solution

* updating DIRECTORY.md

* Project Euler 68 Fixed doctests, now at 93% coverage

* Update sol1.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: kugiyasan <kugiyasan@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-27 03:24:23 +08:00
Maxim Smolskiy
de4d98081b
Improve Project Euler problem 145 solution 1 (#6141)
* updating DIRECTORY.md

* Improve solution

* updating DIRECTORY.md

* Fix

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-05-24 09:20:47 +08: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
Maxim Smolskiy
562cf31a9a
Improve Project Euler problem 074 solution 2 (#5803)
* Fix statement

* Improve solution

* Fix

* Add tests
2022-05-12 11:48:04 +08:00
KerimovEmil
3bff196981
Fix some typos in solution 1 of euler 686 (#6112)
While reading this code I noticed some typos in the doc strings and wanted to fix them.
2022-05-12 11:28:45 +08:00
Kunwar Preet Singh
26f2df7622
Add sol for P104 Project Euler (#5257)
* Hacktoberfest: added sol for P104 Project Euler

* bot requests resolved

* pre-commit

* Update sol.py

* Update sol.py

* remove trailing zeroes

* Update sol.py

* Update sol.py

* Update sol.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-02 22:12:18 +08:00
Vineet Rao
4bd5494992
Add solution to Problem 145 of Project Euler (#5464)
* Solution to Problem 145 of Project Euler

* Provided more descriptive filename

* Update sol1.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-02 21:58:12 +08:00