From 95dad08129314f12f286ac077dee5dccb116ef6a Mon Sep 17 00:00:00 2001 From: Purva Thakre Date: Sun, 29 Oct 2023 17:04:21 -0500 Subject: [PATCH] all redefinition disabled --- toqito/channels/partial_trace.py | 4 ++-- toqito/channels/realignment.py | 2 +- toqito/matrices/gell_mann.py | 2 +- toqito/matrices/pauli.py | 2 +- toqito/matrix_props/is_block_positive.py | 2 +- toqito/matrix_props/sk_norm.py | 4 ++-- toqito/nonlocal_games/nonlocal_game.py | 2 +- toqito/perms/permute_systems.py | 2 +- toqito/perms/swap.py | 2 +- toqito/state_opt/optimal_clone.py | 2 +- toqito/state_opt/symmetric_extension_hierarchy.py | 4 ++-- toqito/state_props/entanglement_of_formation.py | 4 ++-- toqito/state_props/has_symmetric_extension.py | 2 +- toqito/state_props/is_separable.py | 2 +- toqito/state_props/schmidt_rank.py | 2 +- toqito/state_props/sk_vec_norm.py | 2 +- 16 files changed, 20 insertions(+), 20 deletions(-) diff --git a/toqito/channels/partial_trace.py b/toqito/channels/partial_trace.py index 392b12008..3b7e21a82 100644 --- a/toqito/channels/partial_trace.py +++ b/toqito/channels/partial_trace.py @@ -169,7 +169,7 @@ def partial_trace( for idx in sys: prod_dim_sys *= dim[idx] elif isinstance(sys, int): - prod_dim_sys = np.prod(dim[sys]) + prod_dim_sys = np.prod(dim[sys])# pylint: disable=redefined-variable-type else: raise ValueError( "Invalid: The variable `sys` must either be of type int or of a list of ints." @@ -179,7 +179,7 @@ def partial_trace( sub_sys_vec = prod_dim * np.ones(int(sub_prod)) / sub_prod if isinstance(sys, list): - sys = np.array(sys) + sys = np.array(sys)# pylint: disable=redefined-variable-type if isinstance(sys, int): sys = np.array([sys]) set_diff = list(set(list(range(1, num_sys + 1))) - set(sys + 1)) diff --git a/toqito/channels/realignment.py b/toqito/channels/realignment.py index 6416edb6e..6e3999240 100644 --- a/toqito/channels/realignment.py +++ b/toqito/channels/realignment.py @@ -79,7 +79,7 @@ def realignment(input_mat: np.ndarray, dim: int | list[int] = None) -> np.ndarra dim = np.array([dim, dim]) dim_x = np.array([[dim[0][1], dim[0][0]], [dim[1][0], dim[1][1]]]) - dim_x = np.int_(dim_x) + dim_x = np.int_(dim_x)# pylint: disable=redefined-variable-type dim_y = np.array([[dim[1][0], dim[0][0]], [dim[0][1], dim[1][1]]]) x_tmp = swap(input_mat, [1, 2], dim, True) diff --git a/toqito/matrices/gell_mann.py b/toqito/matrices/gell_mann.py index 18eff9228..c4513f3c8 100644 --- a/toqito/matrices/gell_mann.py +++ b/toqito/matrices/gell_mann.py @@ -117,6 +117,6 @@ def gell_mann(ind: int, is_sparse: bool = False) -> np.ndarray | scipy.sparse.cs raise ValueError("Gell-Mann index values can only be values from 0 to 8 (inclusive).") if is_sparse: - gm_op = scipy.sparse.csr_matrix(gm_op) + gm_op = scipy.sparse.csr_matrix(gm_op)# pylint: disable=redefined-variable-type return gm_op diff --git a/toqito/matrices/pauli.py b/toqito/matrices/pauli.py index d1907051c..0fb6a0023 100644 --- a/toqito/matrices/pauli.py +++ b/toqito/matrices/pauli.py @@ -97,7 +97,7 @@ def pauli( pauli_mat = np.identity(2) if is_sparse: - pauli_mat = sparse.csr_matrix(pauli_mat) + pauli_mat = sparse.csr_matrix(pauli_mat)# pylint: disable=redefined-variable-type return pauli_mat diff --git a/toqito/matrix_props/is_block_positive.py b/toqito/matrix_props/is_block_positive.py index 173e65c85..156574dc3 100644 --- a/toqito/matrix_props/is_block_positive.py +++ b/toqito/matrix_props/is_block_positive.py @@ -68,7 +68,7 @@ def is_block_positive( # Allow the user to enter in a single integer for dimension. if isinstance(dim, int): - dim = np.array([dim, dim_xy / dim]) + dim = np.array([dim, dim_xy / dim])# pylint: disable=redefined-variable-type if np.abs(dim[1] - np.round(dim[1])) >= 2 * dim_xy * np.finfo(float).eps: raise ValueError( "If `dim` is a scalar, it must evenly divide the length of the matrix." diff --git a/toqito/matrix_props/sk_norm.py b/toqito/matrix_props/sk_norm.py index 909143d3c..661a5a6f7 100644 --- a/toqito/matrix_props/sk_norm.py +++ b/toqito/matrix_props/sk_norm.py @@ -93,7 +93,7 @@ def sk_operator_norm( # pylint: disable=too-many-locals # Allow the user to enter in a single integer for dimension. if isinstance(dim, int): - dim = np.array([dim, dim_xy / dim]) + dim = np.array([dim, dim_xy / dim])# pylint: disable=redefined-variable-type if np.abs(dim[1] - np.round(dim[1])) >= 2 * dim_xy * np.finfo(float).eps: raise ValueError( "If `dim` is a scalar, it must evenly divide the length of the matrix." @@ -132,7 +132,7 @@ def sk_operator_norm( # pylint: disable=too-many-locals # comes from Theorem 4.13 in [1] lower_bound = k / min(dim) # our most basic upper bound - upper_bound = 1 + upper_bound = 1# pylint: disable=redefined-variable-type # break out of the function if the target value has already been met if __target_is_proved(lower_bound, upper_bound, op_norm, tol, target): diff --git a/toqito/nonlocal_games/nonlocal_game.py b/toqito/nonlocal_games/nonlocal_game.py index ebeaddef5..abb95876f 100644 --- a/toqito/nonlocal_games/nonlocal_game.py +++ b/toqito/nonlocal_games/nonlocal_game.py @@ -122,7 +122,7 @@ def from_bcs_game(cls, constraints: list[np.ndarray], reps: int = 1) -> "Nonloca bin_a = [int(x) for x in np.binary_repr(a_ans)] truth_assignment = np.zeros(num_variables, dtype=np.int8) truth_assignment[-len(bin_a) :] = bin_a - truth_assignment = tuple(truth_assignment) + truth_assignment = tuple(truth_assignment)# pylint: disable=redefined-variable-type for y_ques in range(num_variables): # The verifier can only accept the answer if Bob's truth assignment diff --git a/toqito/perms/permute_systems.py b/toqito/perms/permute_systems.py index d6d057e60..f2f3937be 100644 --- a/toqito/perms/permute_systems.py +++ b/toqito/perms/permute_systems.py @@ -209,7 +209,7 @@ def permute_systems( # If the dimensions are specified, ensure they are given to the # recursive calls as flattened lists. if len(dim[0][:]) == 1: - dim = functools.reduce(operator.iconcat, dim, []) + dim = functools.reduce(operator.iconcat, dim, [])# pylint: disable=redefined-variable-type row_perm = permute_systems(vec_arg, perm, dim[0][:], False, inv_perm) diff --git a/toqito/perms/swap.py b/toqito/perms/swap.py index 21447f027..c2a3f46d3 100644 --- a/toqito/perms/swap.py +++ b/toqito/perms/swap.py @@ -157,7 +157,7 @@ def swap( # Swap the indicated subsystems. perm = np.array(range(1, num_sys + 1)) - sys = np.array(sys) - 1 + sys = np.array(sys) - 1# pylint: disable=redefined-variable-type perm[sys] = perm[sys[::-1]] diff --git a/toqito/state_opt/optimal_clone.py b/toqito/state_opt/optimal_clone.py index dc968b71a..98199b6ca 100644 --- a/toqito/state_opt/optimal_clone.py +++ b/toqito/state_opt/optimal_clone.py @@ -133,7 +133,7 @@ def optimal_clone( else: # The permutation vector `perm` contains elements of the # sequence from: https://oeis.org/A023123 - q_a = tensor(q_a, num_reps) + q_a = tensor(q_a, num_reps)# pylint: disable=redefined-variable-type perm = [] for i in range(1, num_spaces + 1): perm.append(i) diff --git a/toqito/state_opt/symmetric_extension_hierarchy.py b/toqito/state_opt/symmetric_extension_hierarchy.py index e9c53c227..e4bfa8a96 100644 --- a/toqito/state_opt/symmetric_extension_hierarchy.py +++ b/toqito/state_opt/symmetric_extension_hierarchy.py @@ -169,7 +169,7 @@ def symmetric_extension_hierarchy( # Allow the user to enter in a single integer for dimension. if isinstance(dim, int): - dim = np.array([dim, dim_xy / dim]) + dim = np.array([dim, dim_xy / dim])# pylint: disable=redefined-variable-type if np.abs(dim[1] - np.round(dim[1])) >= 2 * dim_xy * np.finfo(float).eps: raise ValueError("If `dim` is a scalar, it must evenly divide the length of the state.") dim[1] = int(np.round(dim[1])) @@ -177,7 +177,7 @@ def symmetric_extension_hierarchy( dim_x, dim_y = int(dim[0]), int(dim[1]) dim_list = [dim_x] + [dim_y] * level - dim_list = np.int_(dim_list) + dim_list = np.int_(dim_list)# pylint: disable=redefined-variable-type # The `sys_list` variable contains the numbering pertaining to the symmetrically extended # spaces. sys_list = list(range(2, 2 + level - 1)) diff --git a/toqito/state_props/entanglement_of_formation.py b/toqito/state_props/entanglement_of_formation.py index f81f67d73..a4764574e 100644 --- a/toqito/state_props/entanglement_of_formation.py +++ b/toqito/state_props/entanglement_of_formation.py @@ -63,8 +63,8 @@ def entanglement_of_formation(rho: np.ndarray, dim: list[int] | int = None) -> f dim = round_dim # User can specify dimension as integer. - if isinstance(dim, int): - dim = np.array([dim, max(dim_x, dim_y) / dim], dtype=int) + if isinstance(dim, int): + dim = np.array([dim, max(dim_x, dim_y) / dim], dtype=int) # pylint: disable=redefined-variable-type if abs(dim[1] - np.round(dim[1])) >= 2 * max(dim_x, dim_y) * eps: raise ValueError( "Invalid dimension: If `dim` is provided as a " diff --git a/toqito/state_props/has_symmetric_extension.py b/toqito/state_props/has_symmetric_extension.py index bdff1773f..aca2f7312 100644 --- a/toqito/state_props/has_symmetric_extension.py +++ b/toqito/state_props/has_symmetric_extension.py @@ -108,7 +108,7 @@ def has_symmetric_extension( # Allow the user to enter in a single integer for dimension. if isinstance(dim, int): - dim = np.array([dim, len_mat / dim]) + dim = np.array([dim, len_mat / dim])# pylint: disable=redefined-variable-type if np.abs(dim[1] - np.round(dim[1])) >= 2 * len_mat * np.finfo(float).eps: raise ValueError( "If `dim` is a scalar, it must evenly divide the length of the matrix." diff --git a/toqito/state_props/is_separable.py b/toqito/state_props/is_separable.py index 2c554390d..716e6052e 100644 --- a/toqito/state_props/is_separable.py +++ b/toqito/state_props/is_separable.py @@ -76,7 +76,7 @@ def is_separable( dim = int(np.round(np.sqrt(state_len))) if isinstance(dim, int): - dim = np.array([dim, state_len / dim]) + dim = np.array([dim, state_len / dim])# pylint: disable=redefined-variable-type if np.abs(dim[1] - np.round(dim[1])) >= 2 * state_len * eps: raise ValueError("The parameter `dim` must evenly divide the length of the state.") dim[1] = np.round(dim[1]) diff --git a/toqito/state_props/schmidt_rank.py b/toqito/state_props/schmidt_rank.py index 33d9c560c..5e36e1110 100644 --- a/toqito/state_props/schmidt_rank.py +++ b/toqito/state_props/schmidt_rank.py @@ -92,7 +92,7 @@ def schmidt_rank(rho: np.ndarray, dim: int | list[int] | np.ndarray = None) -> f if dim is None: dim = slv if isinstance(dim, int): - dim = np.array([dim, len(rho) / dim], dtype=int) + dim = np.array([dim, len(rho) / dim], dtype=int)# pylint: disable=redefined-variable-type dim[1] = np.round(dim[1]) return np.linalg.matrix_rank(np.reshape(rho, dim[::-1])) diff --git a/toqito/state_props/sk_vec_norm.py b/toqito/state_props/sk_vec_norm.py index 65d1c0487..e59fc874a 100644 --- a/toqito/state_props/sk_vec_norm.py +++ b/toqito/state_props/sk_vec_norm.py @@ -59,7 +59,7 @@ def sk_vector_norm(rho: np.ndarray, k: int = 1, dim: int | list[int] = None) -> # Allow the user to enter in a single integer for dimension. if isinstance(dim, int): - dim = np.array([dim, dim_xy / dim]) + dim = np.array([dim, dim_xy / dim])# pylint: disable=redefined-variable-type if np.abs(dim[1] - np.round(dim[1])) >= 2 * dim_xy * np.finfo(float).eps: raise ValueError("If `dim` is a scalar, it must evenly divide the length of the state.") dim[1] = int(np.round(dim[1]))