Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ruff format as the pre-commit formatter #11247

Merged
merged 4 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Keep GitHub Actions up to date with Dependabot...
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
6 changes: 1 addition & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ repos:
rev: v0.1.11
hooks:
- id: ruff

- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
- id: ruff-format

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
Expand Down
16 changes: 12 additions & 4 deletions audio_filters/butterworth_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@


def make_lowpass(
frequency: int, samplerate: int, q_factor: float = 1 / sqrt(2) # noqa: B008
frequency: int,
samplerate: int,
q_factor: float = 1 / sqrt(2), # noqa: B008
) -> IIRFilter:
"""
Creates a low-pass filter
Expand Down Expand Up @@ -39,7 +41,9 @@ def make_lowpass(


def make_highpass(
frequency: int, samplerate: int, q_factor: float = 1 / sqrt(2) # noqa: B008
frequency: int,
samplerate: int,
q_factor: float = 1 / sqrt(2), # noqa: B008
) -> IIRFilter:
"""
Creates a high-pass filter
Expand Down Expand Up @@ -67,7 +71,9 @@ def make_highpass(


def make_bandpass(
frequency: int, samplerate: int, q_factor: float = 1 / sqrt(2) # noqa: B008
frequency: int,
samplerate: int,
q_factor: float = 1 / sqrt(2), # noqa: B008
) -> IIRFilter:
"""
Creates a band-pass filter
Expand Down Expand Up @@ -96,7 +102,9 @@ def make_bandpass(


def make_allpass(
frequency: int, samplerate: int, q_factor: float = 1 / sqrt(2) # noqa: B008
frequency: int,
samplerate: int,
q_factor: float = 1 / sqrt(2), # noqa: B008
) -> IIRFilter:
"""
Creates an all-pass filter
Expand Down
2 changes: 1 addition & 1 deletion conversions/convert_number_to_words.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def max_value(cls, system: str) -> int:
>>> NumberingSystem.max_value("indian") == 10**19 - 1
True
"""
match (system_enum := cls[system.upper()]):
match system_enum := cls[system.upper()]:
case cls.SHORT:
max_exp = system_enum.value[0][0] + 3
case cls.LONG:
Expand Down
6 changes: 3 additions & 3 deletions digital_image_processing/filters/gabor_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ def gabor_filter_kernel(
_y = -sin_theta * px + cos_theta * py

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

return gabor

Expand Down
2 changes: 1 addition & 1 deletion graphs/eulerian_path_and_circuit_for_undirected_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def main():
g4 = {1: [2, 3], 2: [1, 3], 3: [1, 2]}
g5 = {
1: [],
2: []
2: [],
# all degree is zero
}
max_node = 10
Expand Down
4 changes: 1 addition & 3 deletions physics/n_body_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,7 @@ def update_system(self, delta_time: float) -> None:

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

# Newton's law of universal gravitation.
force_x += (
Expand Down
4 changes: 1 addition & 3 deletions project_euler/problem_056/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ def solution(a: int = 100, b: int = 100) -> int:
# RETURN the MAXIMUM from the list of SUMs of the list of INT converted from STR of
# BASE raised to the POWER
return max(
sum(int(x) for x in str(base**power))
for base in range(a)
for power in range(b)
sum(int(x) for x in str(base**power)) for base in range(a) for power in range(b)
)


Expand Down