fix: no implicit optional (#7984)

This commit is contained in:
Dhruv Manilawala 2022-11-15 19:25:14 +05:30 committed by GitHub
parent 316e71b034
commit 3bf86b91e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -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