mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
Delete empty junk file (#9062)
* updating DIRECTORY.md * updating DIRECTORY.md * Delete empty junk file * updating DIRECTORY.md * Fix ruff errors * Fix more ruff errors --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
parent
1488cdea70
commit
fbad85d3ec
@ -5,7 +5,6 @@
|
|||||||
* [In Static Equilibrium](arithmetic_analysis/in_static_equilibrium.py)
|
* [In Static Equilibrium](arithmetic_analysis/in_static_equilibrium.py)
|
||||||
* [Intersection](arithmetic_analysis/intersection.py)
|
* [Intersection](arithmetic_analysis/intersection.py)
|
||||||
* [Jacobi Iteration Method](arithmetic_analysis/jacobi_iteration_method.py)
|
* [Jacobi Iteration Method](arithmetic_analysis/jacobi_iteration_method.py)
|
||||||
* [Junk](arithmetic_analysis/junk.py)
|
|
||||||
* [Lu Decomposition](arithmetic_analysis/lu_decomposition.py)
|
* [Lu Decomposition](arithmetic_analysis/lu_decomposition.py)
|
||||||
* [Newton Forward Interpolation](arithmetic_analysis/newton_forward_interpolation.py)
|
* [Newton Forward Interpolation](arithmetic_analysis/newton_forward_interpolation.py)
|
||||||
* [Newton Method](arithmetic_analysis/newton_method.py)
|
* [Newton Method](arithmetic_analysis/newton_method.py)
|
||||||
|
@ -100,7 +100,9 @@ def binarize(image: np.ndarray, threshold: float = 127.0) -> np.ndarray:
|
|||||||
return np.where(image > threshold, 1, 0)
|
return np.where(image > threshold, 1, 0)
|
||||||
|
|
||||||
|
|
||||||
def transform(image: np.ndarray, kind: str, kernel: np.ndarray = None) -> np.ndarray:
|
def transform(
|
||||||
|
image: np.ndarray, kind: str, kernel: np.ndarray | None = None
|
||||||
|
) -> np.ndarray:
|
||||||
"""
|
"""
|
||||||
Simple image transformation using one of two available filter functions:
|
Simple image transformation using one of two available filter functions:
|
||||||
Erosion and Dilation.
|
Erosion and Dilation.
|
||||||
@ -154,7 +156,7 @@ def transform(image: np.ndarray, kind: str, kernel: np.ndarray = None) -> np.nda
|
|||||||
return transformed
|
return transformed
|
||||||
|
|
||||||
|
|
||||||
def opening_filter(image: np.ndarray, kernel: np.ndarray = None) -> np.ndarray:
|
def opening_filter(image: np.ndarray, kernel: np.ndarray | None = None) -> np.ndarray:
|
||||||
"""
|
"""
|
||||||
Opening filter, defined as the sequence of
|
Opening filter, defined as the sequence of
|
||||||
erosion and then a dilation filter on the same image.
|
erosion and then a dilation filter on the same image.
|
||||||
@ -172,7 +174,7 @@ def opening_filter(image: np.ndarray, kernel: np.ndarray = None) -> np.ndarray:
|
|||||||
return transform(transform(image, "dilation", kernel), "erosion", kernel)
|
return transform(transform(image, "dilation", kernel), "erosion", kernel)
|
||||||
|
|
||||||
|
|
||||||
def closing_filter(image: np.ndarray, kernel: np.ndarray = None) -> np.ndarray:
|
def closing_filter(image: np.ndarray, kernel: np.ndarray | None = None) -> np.ndarray:
|
||||||
"""
|
"""
|
||||||
Opening filter, defined as the sequence of
|
Opening filter, defined as the sequence of
|
||||||
dilation and then erosion filter on the same image.
|
dilation and then erosion filter on the same image.
|
||||||
|
@ -54,7 +54,7 @@ class NumberingSystem(Enum):
|
|||||||
|
|
||||||
|
|
||||||
class NumberWords(Enum):
|
class NumberWords(Enum):
|
||||||
ONES: ClassVar = {
|
ONES: ClassVar[dict[int, str]] = {
|
||||||
0: "",
|
0: "",
|
||||||
1: "one",
|
1: "one",
|
||||||
2: "two",
|
2: "two",
|
||||||
@ -67,7 +67,7 @@ class NumberWords(Enum):
|
|||||||
9: "nine",
|
9: "nine",
|
||||||
}
|
}
|
||||||
|
|
||||||
TEENS: ClassVar = {
|
TEENS: ClassVar[dict[int, str]] = {
|
||||||
0: "ten",
|
0: "ten",
|
||||||
1: "eleven",
|
1: "eleven",
|
||||||
2: "twelve",
|
2: "twelve",
|
||||||
@ -80,7 +80,7 @@ class NumberWords(Enum):
|
|||||||
9: "nineteen",
|
9: "nineteen",
|
||||||
}
|
}
|
||||||
|
|
||||||
TENS: ClassVar = {
|
TENS: ClassVar[dict[int, str]] = {
|
||||||
2: "twenty",
|
2: "twenty",
|
||||||
3: "thirty",
|
3: "thirty",
|
||||||
4: "forty",
|
4: "forty",
|
||||||
|
@ -77,7 +77,7 @@ if __name__ == "__main__":
|
|||||||
n_vertices = 7
|
n_vertices = 7
|
||||||
source = [0, 0, 1, 2, 3, 3, 4, 4, 6]
|
source = [0, 0, 1, 2, 3, 3, 4, 4, 6]
|
||||||
target = [1, 3, 2, 0, 1, 4, 5, 6, 5]
|
target = [1, 3, 2, 0, 1, 4, 5, 6, 5]
|
||||||
edges = [(u, v) for u, v in zip(source, target)]
|
edges = list(zip(source, target))
|
||||||
g = create_graph(n_vertices, edges)
|
g = create_graph(n_vertices, edges)
|
||||||
|
|
||||||
assert [[5], [6], [4], [3, 2, 1, 0]] == tarjan(g)
|
assert [[5], [6], [4], [3, 2, 1, 0]] == tarjan(g)
|
||||||
|
Loading…
Reference in New Issue
Block a user