Skip to content

Commit 24d3cf8

Browse files
cclaussgithub-actions
andauthored
The black formatter is no longer beta (TheAlgorithms#5960)
* The black formatter is no longer beta * pre-commit autoupdate * pre-commit autoupdate * Remove project_euler/problem_145 which is killing our CI tests * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent c15a4d5 commit 24d3cf8

File tree

81 files changed

+139
-228
lines changed

Some content is hidden

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

81 files changed

+139
-228
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v3.4.0
3+
rev: v4.1.0
44
hooks:
55
- id: check-executables-have-shebangs
66
- id: check-yaml
@@ -14,26 +14,26 @@ repos:
1414
- id: requirements-txt-fixer
1515

1616
- repo: https://github.com/psf/black
17-
rev: 21.4b0
17+
rev: 22.1.0
1818
hooks:
1919
- id: black
2020

2121
- repo: https://github.com/PyCQA/isort
22-
rev: 5.8.0
22+
rev: 5.10.1
2323
hooks:
2424
- id: isort
2525
args:
2626
- --profile=black
2727

2828
- repo: https://github.com/asottile/pyupgrade
29-
rev: v2.29.0
29+
rev: v2.31.0
3030
hooks:
3131
- id: pyupgrade
3232
args:
3333
- --py39-plus
3434

3535
- repo: https://gitlab.com/pycqa/flake8
36-
rev: 3.9.1
36+
rev: 3.9.2
3737
hooks:
3838
- id: flake8
3939
args:
@@ -42,7 +42,7 @@ repos:
4242
- --max-line-length=88
4343

4444
- repo: https://github.com/pre-commit/mirrors-mypy
45-
rev: v0.910
45+
rev: v0.931
4646
hooks:
4747
- id: mypy
4848
args:
@@ -51,11 +51,11 @@ repos:
5151
- --non-interactive
5252

5353
- repo: https://github.com/codespell-project/codespell
54-
rev: v2.0.0
54+
rev: v2.1.0
5555
hooks:
5656
- id: codespell
5757
args:
58-
- --ignore-words-list=ans,crate,fo,followings,hist,iff,mater,secant,som,tim
58+
- --ignore-words-list=ans,crate,fo,followings,hist,iff,mater,secant,som,sur,tim
5959
- --skip="./.*,./strings/dictionary.txt,./strings/words.txt,./project_euler/problem_022/p022_names.txt"
6060
exclude: |
6161
(?x)^(

DIRECTORY.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,6 @@
856856
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_135/sol1.py)
857857
* Problem 144
858858
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_144/sol1.py)
859-
* Problem 145
860-
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_145/sol1.py)
861859
* Problem 173
862860
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_173/sol1.py)
863861
* Problem 174

arithmetic_analysis/bisection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def bisection(function: Callable[[float], float], a: float, b: float) -> float:
3232
raise ValueError("could not find root in given interval.")
3333
else:
3434
mid: float = start + (end - start) / 2.0
35-
while abs(start - mid) > 10 ** -7: # until precisely equals to 10^-7
35+
while abs(start - mid) > 10**-7: # until precisely equals to 10^-7
3636
if function(mid) == 0:
3737
return mid
3838
elif function(mid) * function(start) < 0:
@@ -44,7 +44,7 @@ def bisection(function: Callable[[float], float], a: float, b: float) -> float:
4444

4545

4646
def f(x: float) -> float:
47-
return x ** 3 - 2 * x - 5
47+
return x**3 - 2 * x - 5
4848

4949

5050
if __name__ == "__main__":

arithmetic_analysis/in_static_equilibrium.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def polar_force(
2323

2424

2525
def in_static_equilibrium(
26-
forces: ndarray, location: ndarray, eps: float = 10 ** -1
26+
forces: ndarray, location: ndarray, eps: float = 10**-1
2727
) -> bool:
2828
"""
2929
Check if a system is in equilibrium.

arithmetic_analysis/intersection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def intersection(function: Callable[[float], float], x0: float, x1: float) -> fl
3535
x_n2: float = x_n1 - (
3636
function(x_n1) / ((function(x_n1) - function(x_n)) / (x_n1 - x_n))
3737
)
38-
if abs(x_n2 - x_n1) < 10 ** -5:
38+
if abs(x_n2 - x_n1) < 10**-5:
3939
return x_n2
4040
x_n = x_n1
4141
x_n1 = x_n2

arithmetic_analysis/newton_method.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ def newton(
3737
next_guess = prev_guess - function(prev_guess) / derivative(prev_guess)
3838
except ZeroDivisionError:
3939
raise ZeroDivisionError("Could not find root") from None
40-
if abs(prev_guess - next_guess) < 10 ** -5:
40+
if abs(prev_guess - next_guess) < 10**-5:
4141
return next_guess
4242
prev_guess = next_guess
4343

4444

4545
def f(x: float) -> float:
46-
return (x ** 3) - (2 * x) - 5
46+
return (x**3) - (2 * x) - 5
4747

4848

4949
def f1(x: float) -> float:
50-
return 3 * (x ** 2) - 2
50+
return 3 * (x**2) - 2
5151

5252

5353
if __name__ == "__main__":

arithmetic_analysis/newton_raphson.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
def newton_raphson(
14-
func: str, a: float | Decimal, precision: float = 10 ** -10
14+
func: str, a: float | Decimal, precision: float = 10**-10
1515
) -> float:
1616
"""Finds root from the point 'a' onwards by Newton-Raphson method
1717
>>> newton_raphson("sin(x)", 2)

ciphers/deterministic_miller_rabin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def miller_rabin(n: int, allow_probable: bool = False) -> bool:
7373
for prime in plist:
7474
pr = False
7575
for r in range(s):
76-
m = pow(prime, d * 2 ** r, n)
76+
m = pow(prime, d * 2**r, n)
7777
# see article for analysis explanation for m
7878
if (r == 0 and m == 1) or ((m + 1) % n == 0):
7979
pr = True

ciphers/rabin_miller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def rabinMiller(num: int) -> bool:
2121
return False
2222
else:
2323
i = i + 1
24-
v = (v ** 2) % num
24+
v = (v**2) % num
2525
return True
2626

2727

ciphers/rsa_cipher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def get_text_from_blocks(
2929
block_message: list[str] = []
3030
for i in range(block_size - 1, -1, -1):
3131
if len(message) + i < message_length:
32-
ascii_number = block_int // (BYTE_SIZE ** i)
33-
block_int = block_int % (BYTE_SIZE ** i)
32+
ascii_number = block_int // (BYTE_SIZE**i)
33+
block_int = block_int % (BYTE_SIZE**i)
3434
block_message.insert(0, chr(ascii_number))
3535
message.extend(block_message)
3636
return "".join(message)

0 commit comments

Comments
 (0)