mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
fix: no implicit optional (#7984)
This commit is contained in:
parent
316e71b034
commit
3bf86b91e7
|
@ -8,7 +8,7 @@ class FenwickTree:
|
|||
More info: https://en.wikipedia.org/wiki/Fenwick_tree
|
||||
"""
|
||||
|
||||
def __init__(self, arr: list[int] = None, size: int = None) -> None:
|
||||
def __init__(self, arr: list[int] | None = None, size: int | None = None) -> None:
|
||||
"""
|
||||
Constructor for the Fenwick tree
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ def iterate_function(
|
|||
function_params: Any,
|
||||
nb_iterations: int,
|
||||
z_0: numpy.ndarray,
|
||||
infinity: float = None,
|
||||
infinity: float | None = None,
|
||||
) -> numpy.ndarray:
|
||||
"""
|
||||
Iterate the function "eval_function" exactly nb_iterations times.
|
||||
|
|
|
@ -7,7 +7,7 @@ def schur_complement(
|
|||
mat_a: np.ndarray,
|
||||
mat_b: np.ndarray,
|
||||
mat_c: np.ndarray,
|
||||
pseudo_inv: np.ndarray = None,
|
||||
pseudo_inv: np.ndarray | None = None,
|
||||
) -> np.ndarray:
|
||||
"""
|
||||
Schur complement of a symmetric matrix X given as a 2x2 block matrix
|
||||
|
|
|
@ -256,7 +256,7 @@ def valid_input(
|
|||
input_msg: str,
|
||||
err_msg: str,
|
||||
condition: Callable[[num], bool] = lambda x: True,
|
||||
default: str = None,
|
||||
default: str | None = None,
|
||||
) -> num:
|
||||
"""
|
||||
Ask for user value and validate that it fulfill a condition.
|
||||
|
|
|
@ -71,7 +71,7 @@ def sum_digit_factorials(n: int) -> int:
|
|||
return ret
|
||||
|
||||
|
||||
def chain_length(n: int, previous: set = None) -> int:
|
||||
def chain_length(n: int, previous: set | None = None) -> int:
|
||||
"""
|
||||
Calculate the length of the chain of non-repeating terms starting with n.
|
||||
Previous is a set containing the previous member of the chain.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import operator
|
||||
|
||||
|
||||
def strand_sort(arr: list, reverse: bool = False, solution: list = None) -> list:
|
||||
def strand_sort(arr: list, reverse: bool = False, solution: list | None = None) -> list:
|
||||
"""
|
||||
Strand sort implementation
|
||||
source: https://en.wikipedia.org/wiki/Strand_sort
|
||||
|
|
Loading…
Reference in New Issue
Block a user