mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Use compiled black as the pre-commit formatter (#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 <cclauss@me.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
dd47651bfc
commit
4b6f688344
8
.github/.github/dependabot.yml
vendored
Normal file
8
.github/.github/dependabot.yml
vendored
Normal file
|
@ -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"
|
|
@ -19,11 +19,7 @@ repos:
|
||||||
rev: v0.1.13
|
rev: v0.1.13
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
|
- id: ruff-format
|
||||||
- repo: https://github.com/psf/black
|
|
||||||
rev: 23.12.1
|
|
||||||
hooks:
|
|
||||||
- id: black
|
|
||||||
|
|
||||||
- repo: https://github.com/codespell-project/codespell
|
- repo: https://github.com/codespell-project/codespell
|
||||||
rev: v2.2.6
|
rev: v2.2.6
|
||||||
|
|
|
@ -11,7 +11,9 @@ Alternatively you can use scipy.signal.butter, which should yield the same resul
|
||||||
|
|
||||||
|
|
||||||
def make_lowpass(
|
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:
|
) -> IIRFilter:
|
||||||
"""
|
"""
|
||||||
Creates a low-pass filter
|
Creates a low-pass filter
|
||||||
|
@ -39,7 +41,9 @@ def make_lowpass(
|
||||||
|
|
||||||
|
|
||||||
def make_highpass(
|
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:
|
) -> IIRFilter:
|
||||||
"""
|
"""
|
||||||
Creates a high-pass filter
|
Creates a high-pass filter
|
||||||
|
@ -67,7 +71,9 @@ def make_highpass(
|
||||||
|
|
||||||
|
|
||||||
def make_bandpass(
|
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:
|
) -> IIRFilter:
|
||||||
"""
|
"""
|
||||||
Creates a band-pass filter
|
Creates a band-pass filter
|
||||||
|
@ -96,7 +102,9 @@ def make_bandpass(
|
||||||
|
|
||||||
|
|
||||||
def make_allpass(
|
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:
|
) -> IIRFilter:
|
||||||
"""
|
"""
|
||||||
Creates an all-pass filter
|
Creates an all-pass filter
|
||||||
|
|
|
@ -41,7 +41,7 @@ class NumberingSystem(Enum):
|
||||||
>>> NumberingSystem.max_value("indian") == 10**19 - 1
|
>>> NumberingSystem.max_value("indian") == 10**19 - 1
|
||||||
True
|
True
|
||||||
"""
|
"""
|
||||||
match (system_enum := cls[system.upper()]):
|
match system_enum := cls[system.upper()]:
|
||||||
case cls.SHORT:
|
case cls.SHORT:
|
||||||
max_exp = system_enum.value[0][0] + 3
|
max_exp = system_enum.value[0][0] + 3
|
||||||
case cls.LONG:
|
case cls.LONG:
|
||||||
|
|
|
@ -48,9 +48,9 @@ def gabor_filter_kernel(
|
||||||
_y = -sin_theta * px + cos_theta * py
|
_y = -sin_theta * px + cos_theta * py
|
||||||
|
|
||||||
# fill kernel
|
# fill kernel
|
||||||
gabor[y, x] = np.exp(
|
gabor[y, x] = np.exp(-(_x**2 + gamma**2 * _y**2) / (2 * sigma**2)) * np.cos(
|
||||||
-(_x**2 + gamma**2 * _y**2) / (2 * sigma**2)
|
2 * np.pi * _x / lambd + psi
|
||||||
) * np.cos(2 * np.pi * _x / lambd + psi)
|
)
|
||||||
|
|
||||||
return gabor
|
return gabor
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ def main():
|
||||||
g4 = {1: [2, 3], 2: [1, 3], 3: [1, 2]}
|
g4 = {1: [2, 3], 2: [1, 3], 3: [1, 2]}
|
||||||
g5 = {
|
g5 = {
|
||||||
1: [],
|
1: [],
|
||||||
2: []
|
2: [],
|
||||||
# all degree is zero
|
# all degree is zero
|
||||||
}
|
}
|
||||||
max_node = 10
|
max_node = 10
|
||||||
|
|
|
@ -165,9 +165,7 @@ class BodySystem:
|
||||||
|
|
||||||
# Calculation of the distance using Pythagoras's theorem
|
# Calculation of the distance using Pythagoras's theorem
|
||||||
# Extra factor due to the softening technique
|
# Extra factor due to the softening technique
|
||||||
distance = (dif_x**2 + dif_y**2 + self.softening_factor) ** (
|
distance = (dif_x**2 + dif_y**2 + self.softening_factor) ** (1 / 2)
|
||||||
1 / 2
|
|
||||||
)
|
|
||||||
|
|
||||||
# Newton's law of universal gravitation.
|
# Newton's law of universal gravitation.
|
||||||
force_x += (
|
force_x += (
|
||||||
|
|
|
@ -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
|
# RETURN the MAXIMUM from the list of SUMs of the list of INT converted from STR of
|
||||||
# BASE raised to the POWER
|
# BASE raised to the POWER
|
||||||
return max(
|
return max(
|
||||||
sum(int(x) for x in str(base**power))
|
sum(int(x) for x in str(base**power)) for base in range(a) for power in range(b)
|
||||||
for base in range(a)
|
|
||||||
for power in range(b)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user