Skip to content

Commit f4147ad

Browse files
authored
Merge branch 'master' into proper_fractions_with_denom
2 parents 9ee43a0 + 435309a commit f4147ad

File tree

509 files changed

+14136
-3389
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

509 files changed

+14136
-3389
lines changed

.github/CODEOWNERS

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# Order is important. The last matching pattern has the most precedence.
99

10-
/.* @cclauss @dhruvmanila
10+
/.* @cclauss
1111

1212
# /arithmetic_analysis/
1313

@@ -21,15 +21,15 @@
2121

2222
# /cellular_automata/
2323

24-
# /ciphers/ @cclauss # TODO: Uncomment this line after Hacktoberfest
24+
# /ciphers/
2525

2626
# /compression/
2727

2828
# /computer_vision/
2929

30-
# /conversions/ @cclauss # TODO: Uncomment this line after Hacktoberfest
30+
# /conversions/
3131

32-
# /data_structures/ @cclauss # TODO: Uncomment this line after Hacktoberfest
32+
# /data_structures/
3333

3434
# /digital_image_processing/
3535

@@ -67,7 +67,7 @@
6767

6868
# /neural_network/
6969

70-
# /other/ @cclauss # TODO: Uncomment this line after Hacktoberfest
70+
# /other/
7171

7272
# /project_euler/
7373

@@ -81,7 +81,7 @@
8181

8282
# /sorts/
8383

84-
# /strings/ @cclauss # TODO: Uncomment this line after Hacktoberfest
84+
# /strings/
8585

8686
# /traversals/
8787

.github/ISSUE_TEMPLATE/feature_request.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ body:
66
attributes:
77
value: >
88
Before requesting please search [existing issues](https://github.com/TheAlgorithms/Python/labels/enhancement).
9+
Do not create issues to implement new algorithms as these will be closed.
910
Usage questions such as "How do I...?" belong on the
1011
[Discord](https://discord.gg/c7MnfGFGa6) and will be closed.
1112
1213
- type: textarea
1314
attributes:
1415
label: "Feature description"
1516
description: >
16-
This could be new algorithms, data structures or improving any existing
17-
implementations.
17+
This could include new topics or improving any existing implementations.
1818
validations:
1919
required: true

.github/dependabot.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Keep GitHub Actions up to date with Dependabot...
2+
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
3+
version: 2
4+
updates:
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "daily"

.github/pull_request_template.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
* [ ] Add an algorithm?
66
* [ ] Fix a bug or typo in an existing algorithm?
7+
* [ ] Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
78
* [ ] Documentation change?
89

910
### Checklist:

.github/workflows/build.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13-
- uses: actions/setup-python@v4
13+
- uses: actions/setup-python@v5
1414
with:
1515
python-version: 3.12
1616
allow-prereleases: true
17-
- uses: actions/cache@v3
17+
- uses: actions/cache@v4
1818
with:
1919
path: ~/.cache/pip
2020
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
@@ -25,10 +25,10 @@ jobs:
2525
- name: Run tests
2626
# TODO: #8818 Re-enable quantum tests
2727
run: pytest
28-
--ignore=quantum/q_fourier_transform.py
29-
--ignore=project_euler/
30-
--ignore=scripts/validate_solutions.py
31-
--cov-report=term-missing:skip-covered
32-
--cov=. .
28+
--ignore=quantum/q_fourier_transform.py
29+
--ignore=project_euler/
30+
--ignore=scripts/validate_solutions.py
31+
--cov-report=term-missing:skip-covered
32+
--cov=. .
3333
- if: ${{ success() }}
3434
run: scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md

.github/workflows/directory_writer.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ jobs:
99
- uses: actions/checkout@v4
1010
with:
1111
fetch-depth: 0
12-
- uses: actions/setup-python@v4
12+
- uses: actions/setup-python@v5
1313
with:
1414
python-version: 3.x
1515
- name: Write DIRECTORY.md
1616
run: |
1717
scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
18-
git config --global user.name github-actions
19-
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
18+
git config --global user.name "$GITHUB_ACTOR"
19+
git config --global user.email "$[email protected]"
2020
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
2121
- name: Update DIRECTORY.md
2222
run: |

.github/workflows/project_euler.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18-
- uses: actions/setup-python@v4
18+
- uses: actions/setup-python@v5
1919
with:
2020
python-version: 3.x
2121
- name: Install pytest and pytest-cov
@@ -27,7 +27,7 @@ jobs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- uses: actions/checkout@v4
30-
- uses: actions/setup-python@v4
30+
- uses: actions/setup-python@v5
3131
with:
3232
python-version: 3.x
3333
- name: Install pytest and requests

.github/workflows/ruff.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
ruff:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
15-
- run: pip install --user ruff
16-
- run: ruff check --output-format=github .
14+
- uses: actions/checkout@v4
15+
- run: pip install --user ruff
16+
- run: ruff check --output-format=github .

.pre-commit-config.yaml

+12-10
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,13 @@ repos:
1313
- repo: https://github.com/MarcoGorelli/auto-walrus
1414
rev: v0.2.2
1515
hooks:
16-
- id: auto-walrus
16+
- id: auto-walrus
1717

1818
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: v0.0.292
19+
rev: v0.3.3
2020
hooks:
2121
- id: ruff
22-
23-
- repo: https://github.com/psf/black
24-
rev: 23.9.1
25-
hooks:
26-
- id: black
22+
- id: ruff-format
2723

2824
- repo: https://github.com/codespell-project/codespell
2925
rev: v2.2.6
@@ -33,7 +29,7 @@ repos:
3329
- tomli
3430

3531
- repo: https://github.com/tox-dev/pyproject-fmt
36-
rev: "1.2.0"
32+
rev: "1.7.0"
3733
hooks:
3834
- id: pyproject-fmt
3935

@@ -46,16 +42,22 @@ repos:
4642
pass_filenames: false
4743

4844
- repo: https://github.com/abravalheri/validate-pyproject
49-
rev: v0.14
45+
rev: v0.16
5046
hooks:
5147
- id: validate-pyproject
5248

5349
- repo: https://github.com/pre-commit/mirrors-mypy
54-
rev: v1.5.1
50+
rev: v1.9.0
5551
hooks:
5652
- id: mypy
5753
args:
5854
- --ignore-missing-imports
5955
- --install-types # See mirrors-mypy README.md
6056
- --non-interactive
6157
additional_dependencies: [types-requests]
58+
59+
- repo: https://github.com/pre-commit/mirrors-prettier
60+
rev: "v4.0.0-alpha.8"
61+
hooks:
62+
- id: prettier
63+
types_or: [toml, yaml]

CONTRIBUTING.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@
22

33
## Before contributing
44

5-
Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Before sending your pull requests, make sure that you __read the whole guidelines__. If you have any doubt on the contributing guide, please feel free to [state it clearly in an issue](https://github.com/TheAlgorithms/Python/issues/new) or ask the community in [Gitter](https://gitter.im/TheAlgorithms/community).
5+
Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Before submitting your pull requests, please ensure that you __read the whole guidelines__. If you have any doubts about the contributing guide, please feel free to [state it clearly in an issue](https://github.com/TheAlgorithms/Python/issues/new) or ask the community on [Gitter](https://gitter.im/TheAlgorithms/community).
66

77
## Contributing
88

99
### Contributor
1010

11-
We are very happy that you are considering implementing algorithms and data structures for others! This repository is referenced and used by learners from all over the globe. Being one of our contributors, you agree and confirm that:
11+
We are delighted that you are considering implementing algorithms and data structures for others! This repository is referenced and used by learners from all over the globe. By being one of our contributors, you agree and confirm that:
1212

13-
- You did your work - no plagiarism allowed
13+
- You did your work - no plagiarism allowed.
1414
- Any plagiarized work will not be merged.
15-
- Your work will be distributed under [MIT License](LICENSE.md) once your pull request is merged
16-
- Your submitted work fulfils or mostly fulfils our styles and standards
15+
- Your work will be distributed under [MIT License](LICENSE.md) once your pull request is merged.
16+
- Your submitted work fulfills or mostly fulfills our styles and standards.
1717

18-
__New implementation__ is welcome! For example, new solutions for a problem, different representations for a graph data structure or algorithm designs with different complexity but __identical implementation__ of an existing implementation is not allowed. Please check whether the solution is already implemented or not before submitting your pull request.
18+
__New implementation__ is welcome! For example, new solutions for a problem, different representations for a graph data structure or algorithm designs with different complexity, but __identical implementation__ of an existing implementation is not allowed. Please check whether the solution is already implemented or not before submitting your pull request.
1919

2020
__Improving comments__ and __writing proper tests__ are also highly welcome.
2121

2222
### Contribution
2323

2424
We appreciate any contribution, from fixing a grammar mistake in a comment to implementing complex algorithms. Please read this section if you are contributing your work.
2525

26-
Your contribution will be tested by our [automated testing on GitHub Actions](https://github.com/TheAlgorithms/Python/actions) to save time and mental energy. After you have submitted your pull request, you should see the GitHub Actions tests start to run at the bottom of your submission page. If those tests fail, then click on the ___details___ button try to read through the GitHub Actions output to understand the failure. If you do not understand, please leave a comment on your submission page and a community member will try to help.
26+
Your contribution will be tested by our [automated testing on GitHub Actions](https://github.com/TheAlgorithms/Python/actions) to save time and mental energy. After you have submitted your pull request, you should see the GitHub Actions tests start to run at the bottom of your submission page. If those tests fail, then click on the ___details___ button to read through the GitHub Actions output to understand the failure. If you do not understand, please leave a comment on your submission page and a community member will try to help.
2727

2828
#### Issues
2929

@@ -58,7 +58,7 @@ Algorithms should:
5858
* contain doctests that test both valid and erroneous input values
5959
* return all calculation results instead of printing or plotting them
6060

61-
Algorithms in this repo should not be how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values. Those calculations or manipulations can use data types, classes, or functions of existing Python packages but each algorithm in this repo should add unique value.
61+
Algorithms in this repo should not be how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values. Those calculations or manipulations can use data types, classes, or functions of existing Python packages but each algorithm in this repo should add unique value.
6262

6363
#### Pre-commit plugin
6464
Use [pre-commit](https://pre-commit.com/#installation) to automatically format your code to match our coding style:
@@ -77,7 +77,7 @@ pre-commit run --all-files --show-diff-on-failure
7777

7878
We want your work to be readable by others; therefore, we encourage you to note the following:
7979

80-
- Please write in Python 3.12+. For instance: `print()` is a function in Python 3 so `print "Hello"` will *not* work but `print("Hello")` will.
80+
- Please write in Python 3.12+. For instance: `print()` is a function in Python 3 so `print "Hello"` will *not* work but `print("Hello")` will.
8181
- Please focus hard on the naming of functions, classes, and variables. Help your reader by using __descriptive names__ that can help you to remove redundant comments.
8282
- Single letter variable names are *old school* so please avoid them unless their life only spans a few lines.
8383
- Expand acronyms because `gcd()` is hard to understand but `greatest_common_divisor()` is not.
@@ -145,7 +145,7 @@ We want your work to be readable by others; therefore, we encourage you to note
145145
python3 -m doctest -v my_submission.py
146146
```
147147

148-
The use of the Python builtin `input()` function is __not__ encouraged:
148+
The use of the Python built-in `input()` function is __not__ encouraged:
149149

150150
```python
151151
input('Enter your input:')

0 commit comments

Comments
 (0)