Skip to content

Commit 4b6f688

Browse files
ZJUGuoShuaicclausspre-commit-ci[bot]
authored
Use compiled black as the pre-commit formatter (TheAlgorithms#11247)
* Use compiled black as the pre-commit formatter * ruff-format * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Keep GitHub Actions up to date with Dependabot --------- Co-authored-by: Christian Clauss <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent dd47651 commit 4b6f688

File tree

8 files changed

+28
-20
lines changed

8 files changed

+28
-20
lines changed

.github/.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"

.pre-commit-config.yaml

+1-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ repos:
1919
rev: v0.1.13
2020
hooks:
2121
- id: ruff
22-
23-
- repo: https://github.com/psf/black
24-
rev: 23.12.1
25-
hooks:
26-
- id: black
22+
- id: ruff-format
2723

2824
- repo: https://github.com/codespell-project/codespell
2925
rev: v2.2.6

audio_filters/butterworth_filter.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212

1313
def make_lowpass(
14-
frequency: int, samplerate: int, q_factor: float = 1 / sqrt(2) # noqa: B008
14+
frequency: int,
15+
samplerate: int,
16+
q_factor: float = 1 / sqrt(2), # noqa: B008
1517
) -> IIRFilter:
1618
"""
1719
Creates a low-pass filter
@@ -39,7 +41,9 @@ def make_lowpass(
3941

4042

4143
def make_highpass(
42-
frequency: int, samplerate: int, q_factor: float = 1 / sqrt(2) # noqa: B008
44+
frequency: int,
45+
samplerate: int,
46+
q_factor: float = 1 / sqrt(2), # noqa: B008
4347
) -> IIRFilter:
4448
"""
4549
Creates a high-pass filter
@@ -67,7 +71,9 @@ def make_highpass(
6771

6872

6973
def make_bandpass(
70-
frequency: int, samplerate: int, q_factor: float = 1 / sqrt(2) # noqa: B008
74+
frequency: int,
75+
samplerate: int,
76+
q_factor: float = 1 / sqrt(2), # noqa: B008
7177
) -> IIRFilter:
7278
"""
7379
Creates a band-pass filter
@@ -96,7 +102,9 @@ def make_bandpass(
96102

97103

98104
def make_allpass(
99-
frequency: int, samplerate: int, q_factor: float = 1 / sqrt(2) # noqa: B008
105+
frequency: int,
106+
samplerate: int,
107+
q_factor: float = 1 / sqrt(2), # noqa: B008
100108
) -> IIRFilter:
101109
"""
102110
Creates an all-pass filter

conversions/convert_number_to_words.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def max_value(cls, system: str) -> int:
4141
>>> NumberingSystem.max_value("indian") == 10**19 - 1
4242
True
4343
"""
44-
match (system_enum := cls[system.upper()]):
44+
match system_enum := cls[system.upper()]:
4545
case cls.SHORT:
4646
max_exp = system_enum.value[0][0] + 3
4747
case cls.LONG:

digital_image_processing/filters/gabor_filter.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ def gabor_filter_kernel(
4848
_y = -sin_theta * px + cos_theta * py
4949

5050
# fill kernel
51-
gabor[y, x] = np.exp(
52-
-(_x**2 + gamma**2 * _y**2) / (2 * sigma**2)
53-
) * np.cos(2 * np.pi * _x / lambd + psi)
51+
gabor[y, x] = np.exp(-(_x**2 + gamma**2 * _y**2) / (2 * sigma**2)) * np.cos(
52+
2 * np.pi * _x / lambd + psi
53+
)
5454

5555
return gabor
5656

graphs/eulerian_path_and_circuit_for_undirected_graph.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def main():
5656
g4 = {1: [2, 3], 2: [1, 3], 3: [1, 2]}
5757
g5 = {
5858
1: [],
59-
2: []
59+
2: [],
6060
# all degree is zero
6161
}
6262
max_node = 10

physics/n_body_simulation.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,7 @@ def update_system(self, delta_time: float) -> None:
165165

166166
# Calculation of the distance using Pythagoras's theorem
167167
# Extra factor due to the softening technique
168-
distance = (dif_x**2 + dif_y**2 + self.softening_factor) ** (
169-
1 / 2
170-
)
168+
distance = (dif_x**2 + dif_y**2 + self.softening_factor) ** (1 / 2)
171169

172170
# Newton's law of universal gravitation.
173171
force_x += (

project_euler/problem_056/sol1.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ def solution(a: int = 100, b: int = 100) -> int:
3030
# RETURN the MAXIMUM from the list of SUMs of the list of INT converted from STR of
3131
# BASE raised to the POWER
3232
return max(
33-
sum(int(x) for x in str(base**power))
34-
for base in range(a)
35-
for power in range(b)
33+
sum(int(x) for x in str(base**power)) for base in range(a) for power in range(b)
3634
)
3735

3836

0 commit comments

Comments
 (0)