diff --git a/data_structures/binary_tree/fenwick_tree.py b/data_structures/binary_tree/fenwick_tree.py index babd75ac4..88b0873a1 100644 --- a/data_structures/binary_tree/fenwick_tree.py +++ b/data_structures/binary_tree/fenwick_tree.py @@ -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 diff --git a/fractals/julia_sets.py b/fractals/julia_sets.py index 35fdc45d0..77d1d7c04 100644 --- a/fractals/julia_sets.py +++ b/fractals/julia_sets.py @@ -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. diff --git a/linear_algebra/src/schur_complement.py b/linear_algebra/src/schur_complement.py index f3cb736d9..3a5f4443a 100644 --- a/linear_algebra/src/schur_complement.py +++ b/linear_algebra/src/schur_complement.py @@ -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 diff --git a/machine_learning/linear_discriminant_analysis.py b/machine_learning/linear_discriminant_analysis.py index 9ef42ed19..f4fb5ba76 100644 --- a/machine_learning/linear_discriminant_analysis.py +++ b/machine_learning/linear_discriminant_analysis.py @@ -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. diff --git a/project_euler/problem_074/sol1.py b/project_euler/problem_074/sol1.py index a40a62903..a257d4d94 100644 --- a/project_euler/problem_074/sol1.py +++ b/project_euler/problem_074/sol1.py @@ -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. diff --git a/sorts/strand_sort.py b/sorts/strand_sort.py index a89135a06..4cadd3961 100644 --- a/sorts/strand_sort.py +++ b/sorts/strand_sort.py @@ -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