Skip to content

Commit 960ac31

Browse files
author
Yuhui
authored
Merge pull request #1 from TheAlgorithms/master
更新
2 parents 5b6ebf8 + 1a39970 commit 960ac31

File tree

822 files changed

+31142
-6219
lines changed

Some content is hidden

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

822 files changed

+31142
-6219
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.github/CODEOWNERS

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# This is a comment.
2+
# Each line is a file pattern followed by one or more owners.
3+
4+
# More details are here: https://help.github.com/articles/about-codeowners/
5+
6+
# The '*' pattern is global owners.
7+
8+
# Order is important. The last matching pattern has the most precedence.
9+
10+
/.* @cclauss @dhruvmanila
11+
12+
# /arithmetic_analysis/
13+
14+
# /backtracking/
15+
16+
# /bit_manipulation/
17+
18+
# /blockchain/
19+
20+
# /boolean_algebra/
21+
22+
# /cellular_automata/
23+
24+
# /ciphers/ @cclauss # TODO: Uncomment this line after Hacktoberfest
25+
26+
# /compression/
27+
28+
# /computer_vision/
29+
30+
# /conversions/ @cclauss # TODO: Uncomment this line after Hacktoberfest
31+
32+
# /data_structures/ @cclauss # TODO: Uncomment this line after Hacktoberfest
33+
34+
/digital_image_processing/ @mateuszz0000
35+
36+
# /divide_and_conquer/
37+
38+
/dynamic_programming/ @Kush1101
39+
40+
# /file_transfer/
41+
42+
# /fuzzy_logic/
43+
44+
# /genetic_algorithm/
45+
46+
# /geodesy/
47+
48+
# /graphics/
49+
50+
# /graphs/
51+
52+
# /greedy_method/
53+
54+
# /hashes/
55+
56+
# /images/
57+
58+
# /linear_algebra/
59+
60+
# /machine_learning/
61+
62+
/maths/ @Kush1101
63+
64+
# /matrix/
65+
66+
# /networking_flow/
67+
68+
# /neural_network/
69+
70+
# /other/ @cclauss # TODO: Uncomment this line after Hacktoberfest
71+
72+
/project_euler/ @dhruvmanila @Kush1101
73+
74+
# /quantum/
75+
76+
# /scheduling/
77+
78+
# /scripts/
79+
80+
# /searches/
81+
82+
/sorts/ @mateuszz0000
83+
84+
# /strings/ @cclauss # TODO: Uncomment this line after Hacktoberfest
85+
86+
# /traversals/
87+
88+
/web_programming/ @cclauss

.github/stale.yml

+60-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,63 @@
1-
# Number of days of inactivity before an issue becomes stale
1+
# Configuration for probot-stale - https://github.com/probot/stale
2+
3+
# Number of days of inactivity before an Issue or Pull Request becomes stale
24
daysUntilStale: 30
3-
# Number of days of inactivity before a stale issue is closed
5+
6+
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
7+
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
48
daysUntilClose: 7
5-
# Issues with these labels will never be considered stale
9+
10+
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
11+
onlyLabels: []
12+
13+
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
614
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: >
19-
Please reopen this issue once you commit the changes requested or
20-
make improvements on the code. Thank you for your contributions.
15+
- "Status: on hold"
16+
17+
# Set to true to ignore issues in a project (defaults to false)
18+
exemptProjects: false
19+
20+
# Set to true to ignore issues in a milestone (defaults to false)
21+
exemptMilestones: false
22+
23+
# Set to true to ignore issues with an assignee (defaults to false)
24+
exemptAssignees: false
25+
26+
# Label to use when marking as stale
27+
staleLabel: stale
28+
29+
# Limit the number of actions per hour, from 1-30. Default is 30
30+
limitPerRun: 5
31+
32+
# Comment to post when removing the stale label.
33+
# unmarkComment: >
34+
# Your comment here.
35+
36+
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
37+
pulls:
38+
# Comment to post when marking as stale. Set to `false` to disable
39+
markComment: >
40+
This pull request has been automatically marked as stale because it has not had
41+
recent activity. It will be closed if no further activity occurs. Thank you
42+
for your contributions.
43+
44+
# Comment to post when closing a stale Pull Request.
45+
closeComment: >
46+
Please reopen this pull request once you commit the changes requested
47+
or make improvements on the code. If this is not the case and you need
48+
some help, feel free to seek help from our [Gitter](https://gitter.im/TheAlgorithms)
49+
or ping one of the reviewers. Thank you for your contributions!
50+
51+
issues:
52+
# Comment to post when marking as stale. Set to `false` to disable
53+
markComment: >
54+
This issue has been automatically marked as stale because it has not had
55+
recent activity. It will be closed if no further activity occurs. Thank you
56+
for your contributions.
57+
58+
# Comment to post when closing a stale Issue.
59+
closeComment: >
60+
Please reopen this issue once you add more information and updates here.
61+
If this is not the case and you need some help, feel free to seek help
62+
from our [Gitter](https://gitter.im/TheAlgorithms) or ping one of the
63+
reviewers. Thank you for your contributions!

.github/workflows/autoblack.yml

-24
This file was deleted.

.github/workflows/build.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "build"
2+
3+
on:
4+
pull_request:
5+
schedule:
6+
- cron: "0 0 * * *" # Run everyday
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-python@v2
14+
with:
15+
python-version: "3.9"
16+
- uses: actions/cache@v2
17+
with:
18+
path: ~/.cache/pip
19+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip setuptools six wheel
23+
python -m pip install mypy pytest-cov -r requirements.txt
24+
- run: mypy .
25+
- name: Run tests
26+
run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/ --cov-report=term-missing:skip-covered --cov=. .
27+
- if: ${{ success() }}
28+
run: scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md

.github/workflows/codespell.yml

-17
This file was deleted.

.github/workflows/directory_writer.yml

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ jobs:
88
steps:
99
- uses: actions/checkout@v1 # v1, NOT v2
1010
- uses: actions/setup-python@v2
11-
with:
12-
python-version: 3.x
1311
- name: Write DIRECTORY.md
1412
run: |
1513
scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md

.github/workflows/pre-commit.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: pre-commit
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
pre-commit:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: actions/cache@v2
11+
with:
12+
path: |
13+
~/.cache/pre-commit
14+
~/.cache/pip
15+
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
16+
- uses: actions/setup-python@v2
17+
- uses: psf/black@20.8b1
18+
- name: Install pre-commit
19+
run: |
20+
python -m pip install --upgrade pip
21+
python -m pip install --upgrade pre-commit
22+
- run: pre-commit run --verbose --all-files --show-diff-on-failure

.github/workflows/project_euler.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
on:
2+
pull_request:
3+
# Run only if a file is changed within the project_euler directory and related files
4+
paths:
5+
- "project_euler/**"
6+
- ".github/workflows/project_euler.yml"
7+
- "scripts/validate_solutions.py"
8+
schedule:
9+
- cron: "0 0 * * *" # Run everyday
10+
11+
name: "Project Euler"
12+
13+
jobs:
14+
project-euler:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: actions/setup-python@v2
19+
- name: Install pytest and pytest-cov
20+
run: |
21+
python -m pip install --upgrade pip
22+
python -m pip install --upgrade pytest pytest-cov
23+
- run: pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
24+
validate-solutions:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v2
28+
- uses: actions/setup-python@v2
29+
- name: Install pytest and requests
30+
run: |
31+
python -m pip install --upgrade pip
32+
python -m pip install --upgrade pytest requests
33+
- run: pytest scripts/validate_solutions.py
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/stale.yml

-23
This file was deleted.

.pre-commit-config.yaml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v3.4.0
4+
hooks:
5+
- id: check-executables-have-shebangs
6+
- id: check-yaml
7+
- id: end-of-file-fixer
8+
types: [python]
9+
- id: trailing-whitespace
10+
exclude: |
11+
(?x)^(
12+
data_structures/heap/binomial_heap.py
13+
)$
14+
- id: requirements-txt-fixer
15+
- repo: https://github.com/psf/black
16+
rev: 20.8b1
17+
hooks:
18+
- id: black
19+
- repo: https://github.com/PyCQA/isort
20+
rev: 5.7.0
21+
hooks:
22+
- id: isort
23+
args:
24+
- --profile=black
25+
- repo: https://gitlab.com/pycqa/flake8
26+
rev: 3.9.0
27+
hooks:
28+
- id: flake8
29+
args:
30+
- --ignore=E203,W503
31+
- --max-complexity=25
32+
- --max-line-length=88
33+
# FIXME: fix mypy errors and then uncomment this
34+
# - repo: https://github.com/pre-commit/mirrors-mypy
35+
# rev: v0.782
36+
# hooks:
37+
# - id: mypy
38+
# args:
39+
# - --ignore-missing-imports
40+
- repo: https://github.com/codespell-project/codespell
41+
rev: v2.0.0
42+
hooks:
43+
- id: codespell
44+
args:
45+
- --ignore-words-list=ans,crate,fo,followings,hist,iff,mater,secant,som,tim
46+
- --skip="./.*,./strings/dictionary.txt,./strings/words.txt,./project_euler/problem_022/p022_names.txt"
47+
- --quiet-level=2
48+
exclude: |
49+
(?x)^(
50+
strings/dictionary.txt |
51+
strings/words.txt |
52+
project_euler/problem_022/p022_names.txt
53+
)$
54+
- repo: local
55+
hooks:
56+
- id: validate-filenames
57+
name: Validate filenames
58+
entry: ./scripts/validate_filenames.py
59+
language: script
60+
pass_filenames: false

0 commit comments

Comments
 (0)