Skip to content

Commit 0804aec

Browse files
authored
Merge pull request #2 from TheAlgorithms/master
udate
2 parents 6a95bf9 + f6ee518 commit 0804aec

File tree

637 files changed

+35647
-11188
lines changed

Some content is hidden

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

637 files changed

+35647
-11188
lines changed

.coveragerc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[report]
2+
sort = Cover
3+
omit =
4+
.env/*

.github/FUNDING.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# These are supported funding model platforms
2+
3+
github: [cclauss]
4+
patreon: cclauss
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: TheAlgorithms
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
custom: ['http://paypal.me/TheAlgorithms/1000', 'https://donorbox.org/thealgorithms']

.github/pull_request_template.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
### **Describe your change:**
2+
3+
4+
5+
* [ ] Add an algorithm?
6+
* [ ] Fix a bug or typo in an existing algorithm?
7+
* [ ] Documentation change?
8+
9+
### **Checklist:**
10+
* [ ] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md).
11+
* [ ] This pull request is all my own work -- I have not plagiarized.
12+
* [ ] I know that pull requests will not be merged if they fail the automated tests.
13+
* [ ] This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
14+
* [ ] All new Python files are placed inside an existing directory.
15+
* [ ] All filenames are in all lowercase characters with no spaces or dashes.
16+
* [ ] All functions and variable names follow Python naming conventions.
17+
* [ ] All function parameters and return values are annotated with Python [type hints](https://docs.python.org/3/library/typing.html).
18+
* [ ] All functions have [doctests](https://docs.python.org/3/library/doctest.html) that pass the automated testing.
19+
* [ ] All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
20+
* [ ] If this pull request resolves one or more open issues then the commit message contains `Fixes: #{$ISSUE_NO}`.

.github/stale.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Number of days of inactivity before an issue becomes stale
2+
daysUntilStale: 30
3+
# Number of days of inactivity before a stale issue is closed
4+
daysUntilClose: 7
5+
# Issues with these labels will never be considered stale
6+
exemptLabels:
7+
- bug
8+
- help wanted
9+
- OK to merge
10+
# Label to use when marking an issue as stale
11+
staleLabel: wontfix
12+
# Comment to post when marking an issue as stale. Set to `false` to disable
13+
markComment: >
14+
This issue has been automatically marked as stale because it has not had
15+
recent activity. It will be closed if no further activity occurs. Thank you
16+
for your contributions.
17+
# Comment to post when closing a stale issue. Set to `false` to disable
18+
closeComment: true

.github/workflows/autoblack.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# GitHub Action that uses Black to reformat Python code (if needed) when doing a git push.
2+
# If all Python code in the repo is compliant with Black then this Action does nothing.
3+
# Otherwise, Black is run and its changes are committed to the repo.
4+
# https://github.com/cclauss/autoblack
5+
6+
name: autoblack_push
7+
on: [push]
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v1 # Use v1, NOT v2
13+
- uses: actions/setup-python@v1
14+
- run: pip install black
15+
- run: black --check .
16+
- name: If needed, commit black changes to a new pull request
17+
if: failure()
18+
run: |
19+
black .
20+
git config --global user.name github-actions
21+
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
22+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
23+
git commit -am "fixup! Format Python code with psf/black push"
24+
git push --force origin HEAD:$GITHUB_REF

.github/workflows/codespell.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# GitHub Action to automate the identification of common misspellings in text files
2+
# https://github.com/codespell-project/codespell
3+
name: codespell
4+
on: [push, pull_request]
5+
jobs:
6+
codespell:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: actions/setup-python@v1
11+
- run: pip install codespell flake8
12+
- run: |
13+
SKIP="./.*,./other/dictionary.txt,./other/words,./project_euler/problem_22/p022_names.txt"
14+
codespell -L ans,fo,hist,iff,secant,tim --skip=$SKIP --quiet-level=2
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# The objective of this GitHub Action is to update the DIRECTORY.md file (if needed)
2+
# when doing a git push
3+
name: directory_writer
4+
on: [push]
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v1 # v1, NOT v2
10+
- uses: actions/setup-python@v1
11+
with:
12+
python-version: 3.x
13+
- name: Write DIRECTORY.md
14+
run: |
15+
scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
16+
git config --global user.name github-actions
17+
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
18+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
19+
- name: Update DIRECTORY.md
20+
run: |
21+
git add DIRECTORY.md
22+
git commit -am "updating DIRECTORY.md" || true
23+
git push --force origin HEAD:$GITHUB_REF || true

.github/workflows/stale.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Mark stale issues and pull requests
2+
on:
3+
schedule:
4+
- cron: "0 0 * * *"
5+
jobs:
6+
stale:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/stale@v1
10+
with:
11+
repo-token: ${{ secrets.GITHUB_TOKEN }}
12+
stale-issue-message: 'Stale issue message'
13+
stale-pr-message: 'Stale pull request message'
14+
stale-issue-label: 'no-issue-activity'
15+
stale-pr-label: 'no-pr-activity'

.gitignore

+26-9
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ __pycache__/
77
*.so
88

99
# Distribution / packaging
10-
.vscode/
1110
.Python
12-
env/
1311
build/
1412
develop-eggs/
1513
dist/
@@ -21,12 +19,14 @@ lib64/
2119
parts/
2220
sdist/
2321
var/
22+
wheels/
2423
*.egg-info/
2524
.installed.cfg
2625
*.egg
26+
MANIFEST
2727

2828
# PyInstaller
29-
# Usually these files are written by a python script from a template
29+
# Usually these files are written by a Python script from a template
3030
# before PyInstaller builds the exe, so as to inject date/other infos into it.
3131
*.manifest
3232
*.spec
@@ -43,8 +43,9 @@ htmlcov/
4343
.cache
4444
nosetests.xml
4545
coverage.xml
46-
*,cover
46+
*.cover
4747
.hypothesis/
48+
.pytest_cache/
4849

4950
# Translations
5051
*.mo
@@ -53,6 +54,7 @@ coverage.xml
5354
# Django stuff:
5455
*.log
5556
local_settings.py
57+
db.sqlite3
5658

5759
# Flask stuff:
5860
instance/
@@ -67,7 +69,7 @@ docs/_build/
6769
# PyBuilder
6870
target/
6971

70-
# IPython Notebook
72+
# Jupyter Notebook
7173
.ipynb_checkpoints
7274

7375
# pyenv
@@ -76,17 +78,32 @@ target/
7678
# celery beat schedule file
7779
celerybeat-schedule
7880

79-
# dotenv
80-
.env
81+
# SageMath parsed files
82+
*.sage.py
8183

82-
# virtualenv
84+
# Environments
85+
.env
86+
.venv
87+
env/
8388
venv/
8489
ENV/
90+
env.bak/
91+
venv.bak/
8592

8693
# Spyder project settings
8794
.spyderproject
95+
.spyproject
8896

8997
# Rope project settings
9098
.ropeproject
99+
100+
# mkdocs documentation
101+
/site
102+
103+
# mypy
104+
.mypy_cache/
105+
106+
.DS_Store
91107
.idea
92-
.DS_Store
108+
.try
109+
.vscode/

.gitpod.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tasks:
2+
- init: pip3 install -r ./requirements.txt

.lgtm.yml

-12
This file was deleted.

.travis.yml

+13-22
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
1+
os: linux
2+
dist: bionic
13
language: python
4+
python: 3.8
25
cache: pip
3-
python:
4-
- 2.7
5-
- 3.6
6-
#- nightly
7-
#- pypy
8-
#- pypy3
9-
matrix:
10-
allow_failures:
11-
- python: nightly
12-
- python: pypy
13-
- python: pypy3
14-
install:
15-
#- pip install -r requirements.txt
16-
- pip install flake8 # pytest # add another testing frameworks later
6+
before_install: pip install --upgrade pip setuptools six
7+
install: pip install -r requirements.txt
178
before_script:
18-
# stop the build if there are Python syntax errors or undefined names
19-
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
20-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
21-
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
9+
- black --check . || true
10+
- flake8 . --count --select=E101,E722,E9,F4,F63,F7,F82,W191 --show-source --statistics
11+
- flake8 . --count --exit-zero --max-line-length=127 --statistics
2212
script:
23-
- true # pytest --capture=sys # add other tests here
24-
notifications:
25-
on_success: change
26-
on_failure: change # `always` will be the setting once code changes slow down
13+
- scripts/validate_filenames.py # no uppercase, no spaces, in a directory
14+
- mypy --ignore-missing-imports .
15+
- pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=. .
16+
after_success:
17+
- scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md

.vs/Python/v15/.suo

-16.5 KB
Binary file not shown.

.vs/slnx.sqlite

-172 KB
Binary file not shown.

0 commit comments

Comments
 (0)