Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pylint errors #198

Closed
purva-thakre opened this issue Oct 16, 2023 · 1 comment · Fixed by #205
Closed

pylint errors #198

purva-thakre opened this issue Oct 16, 2023 · 1 comment · Fixed by #205
Assignees
Labels
bug Something isn't working devops
Milestone

Comments

@purva-thakre
Copy link
Collaborator

When a GithubActions job is being run, a line poetry run pylint --exit-zero tests/ toqito/ leads to the following:

pylint: Command line or configuration file:1: UserWarning: Specifying exception names in the overgeneral-exceptions option without module name is deprecated and support for it will be removed in pylint 3.0. Use fully qualified name (maybe 'builtins.Exception' ?) instead.

Some other issues that are raised by pylint are:

************* Module tests.test_nonlocal_games.test_xor_game
tests/test_nonlocal_games/test_xor_game.py:6:0: W0611: Unused NonlocalGame imported from toqito.nonlocal_games.nonlocal_game (unused-import)
************* Module tests.test_channel_ops.test_dual_channel
tests/test_channel_ops/test_dual_channel.py:78:4: W0621: Redefining name 'choi' from outer scope (line 5) (redefined-outer-name)
************* Module tests.test_channel_metrics.test_completely_bounded_trace_norm
tests/test_channel_metrics/test_completely_bounded_trace_norm.py:19:9: W0612: Unused variable 'eigv' (unused-variable)
************* Module toqito.state_props.has_symmetric_extension
toqito/state_props/has_symmetric_extension.py:120:23: E1136: Value 'dim' is unsubscriptable (unsubscriptable-object)
toqito/state_props/has_symmetric_extension.py:120:36: E1136: Value 'dim' is unsubscriptable (unsubscriptable-object)
toqito/state_props/has_symmetric_extension.py:111:8: R0204: Redefinition of dim type from int to .ndarray (redefined-variable-type)
************* Module toqito.state_props.entanglement_of_formation
toqito/state_props/entanglement_of_formation.py:90:[14](https://github.com/purva-thakre/toqito/actions/runs/6527284296/job/17721926644#step:6:15): R1721: Unnecessary use of a comprehension, use list(dim) instead. (unnecessary-comprehension)
toqito/state_props/entanglement_of_formation.py:68:8: R0204: Redefinition of dim type from int to .ndarray (redefined-variable-type)
************* Module toqito.state_props.schmidt_rank
toqito/state_props/schmidt_rank.py:95:8: R0204: Redefinition of dim type from int to .ndarray (redefined-variable-type)
************* Module toqito.state_props.is_ppt
toqito/state_props/is_ppt.py:86:16: E1136: Value 'sqrt_rho_dims' is unsubscriptable (unsubscriptable-object)
toqito/state_props/is_ppt.py:86:34: E1136: Value 'sqrt_rho_dims' is unsubscriptable (unsubscriptable-object)
toqito/state_props/is_ppt.py:86:54: E1136: Value 'sqrt_rho_dims' is unsubscriptable (unsubscriptable-object)
toqito/state_props/is_ppt.py:86:72: E1136: Value 'sqrt_rho_dims' is unsubscriptable (unsubscriptable-object)
************* Module toqito.state_props.is_mutually_unbiased_basis
toqito/state_props/is_mutually_unbiased_basis.py:92:68: R1736: Unnecessary list index lookup, use '_' instead (unnecessary-list-index-lookup)
************* Module toqito.state_props.sk_vec_norm
toqito/state_props/sk_vec_norm.py:62:8: R0204: Redefinition of dim type from int to .ndarray (redefined-variable-type)
************* Module toqito.state_props.is_separable
toqito/state_props/is_separable.py:184:4: C0501: `for` loop could be `any(has_symmetric_extension(state, level) for _ in range(2, level))` (consider-using-any-or-all)
toqito/state_props/is_separable.py:78:8: R0204: Redefinition of dim type from int to .ndarray (redefined-variable-type)
toqito/state_props/is_separable.py:164:8: W0612: Unused variable 'Xt' (unused-variable)
************* Module toqito.helper.npa_hierarchy
toqito/helper/npa_hierarchy.py:127:0: R0914: Too many local variables (34/25) (too-many-locals)
************* Module toqito.nonlocal_games.nonlocal_game
toqito/nonlocal_games/nonlocal_game.py:126:16: R0204: Redefinition of truth_assignment type from .ndarray to tuple (redefined-variable-type)
************* Module toqito.channel_ops.dual_channel
toqito/channel_ops/dual_channel.py:7:0: W0611: Unused is_square imported from toqito.matrix_props (unused-import)
************* Module toqito.channel_metrics.completely_bounded_trace_norm
toqito/channel_metrics/completely_bounded_trace_norm.py:41:4: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
************* Module toqito.channel_metrics.fidelity_of_separability
toqito/channel_metrics/fidelity_of_separability.py:16:0: W9016: "solver_option, verbosity_option" missing in parameter type documentation (missing-type-doc)
toqito/channel_metrics/fidelity_of_separability.py:16:0: W9006: "ValueError" not documented as being raised (missing-raises-doc)
toqito/channel_metrics/fidelity_of_separability.py:16:0: W9006: "ValueError" not documented as being raised (missing-raises-doc)
************* Module toqito.perms.swap
toqito/perms/swap.py:160:4: R0204: Redefinition of sys type from list to .ndarray (redefined-variable-type)
************* Module toqito.perms.permute_systems
toqito/perms/permute_systems.py:212:8: R0204: Redefinition of dim type from .ndarray to list (redefined-variable-type)
************* Module toqito.matrix_ops.vectors_from_gram_matrix
toqito/matrix_ops/vectors_from_gram_matrix.py:13:11: W0718: Catching too general exception Exception (broad-exception-caught)
************* Module toqito.matrix_ops.inner_product
toqito/matrix_ops/inner_product.py:5:0: W90[15](https://github.com/purva-thakre/toqito/actions/runs/6527284296/job/17721926644#step:6:16): "v1, v2" missing in parameter documentation (missing-param-doc)
toqito/matrix_ops/inner_product.py:5:0: W9017: "args" differing in parameter documentation (differing-param-doc)
************* Module toqito.matrix_ops.outer_product
toqito/matrix_ops/outer_product.py:5:0: W9015: "v1, v2" missing in parameter documentation (missing-param-doc)
toqito/matrix_ops/outer_product.py:5:0: W9017: "args" differing in parameter documentation (differing-param-doc)
************* Module toqito.channels.partial_transpose
toqito/channels/partial_transpose.py:13:0: W0102: Dangerous default value [] as argument (dangerous-default-value)
************* Module toqito.channels.partial_trace
toqito/channels/partial_trace.py:13:0: W0102: Dangerous default value [] as argument (dangerous-default-value)
toqito/channels/partial_trace.py:[16](https://github.com/purva-thakre/toqito/actions/runs/6527284296/job/17721926644#step:6:17)9:8: R0204: Redefinition of prod_dim_sys type from int to .ndarray (redefined-variable-type)
************* Module toqito.channels.realignment
toqito/channels/realignment.py:82:4: R0204: Redefinition of dim_x type from .ndarray to numpy.core.numerictypes.int32 (redefined-variable-type)
************* Module toqito.state_opt.ppt_distinguishability
toqito/state_opt/ppt_distinguishability.py:127:0: W9016: "dist_method" missing in parameter type documentation (missing-type-doc)
toqito/state_opt/ppt_distinguishability.py:195:47: R[17](https://github.com/purva-thakre/toqito/actions/runs/6527284296/job/17721926644#step:6:18)36: Unnecessary list index lookup, use '_' instead (unnecessary-list-index-lookup)
toqito/state_opt/ppt_distinguishability.py:206:0: W9016: "dist_method" missing in parameter type documentation (missing-type-doc)
toqito/state_opt/ppt_distinguishability.py:268:46: R1736: Unnecessary list index lookup, use '_' instead (unnecessary-list-index-lookup)
************* Module toqito.state_opt.symmetric_extension_hierarchy
toqito/state_opt/symmetric_extension_hierarchy.py:199:47: R1736: Unnecessary list index lookup, use '_' instead (unnecessary-list-index-lookup)
toqito/state_opt/symmetric_extension_hierarchy.py:172:8: R0204: Redefinition of dim type from int to .ndarray (redefined-variable-type)
toqito/state_opt/symmetric_extension_hierarchy.py:[18](https://github.com/purva-thakre/toqito/actions/runs/6527284296/job/17721926644#step:6:19)0:4: R0[20](https://github.com/purva-thakre/toqito/actions/runs/6527284296/job/17721926644#step:6:21)4: Redefinition of dim_list type from list to numpy.core.numerictypes.int32 (redefined-variable-type)
************* Module toqito.state_opt.optimal_clone
toqito/state_opt/optimal_clone.py:136:8: R0204: Redefinition of q_a type from .ndarray to numpy.matrixlib.defmatrix.matrix (redefined-variable-type)
************* Module toqito.state_opt.state_distinguishability
toqito/state_opt/state_distinguishability.py:125:47: R1736: Unnecessary list index lookup, use '_' instead (unnecessary-list-index-lookup)
************* Module toqito.state_opt.state_exclusion
toqito/state_opt/state_exclusion.py:8:0: W9015: "primal_dual, solver, vectors" missing in parameter documentation (missing-param-doc)
toqito/state_opt/state_exclusion.py:8:0: W9016: "primal_dual" missing in parameter type documentation (missing-type-doc)
toqito/state_opt/state_exclusion.py:8:0: W9017: "states" differing in parameter documentation (differing-param-doc)
toqito/state_opt/state_exclusion.py:95:4: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
************* Module toqito.matrices.pauli
toqito/matrices/pauli.py:100:12: R0204: Redefinition of pauli_mat type from .ndarray to scipy.sparse._csr.csr_matrix (redefined-variable-type)
************* Module toqito.states.basis
toqito/states/basis.py:51:24: W0141: Used builtin function 'map'. Using a list comprehension can be clearer. (bad-builtin)
************* Module toqito.channel_props.is_trace_preserving
toqito/channel_props/is_trace_preserving.py:104:8: R5501: Consider using "elif" instead of "else" then "if" to remove one indentation level (else-if-used)
toqito/channel_props/is_trace_preserving.py:104:11: C01[21](https://github.com/purva-thakre/toqito/actions/runs/6527284296/job/17721926644#step:6:22): Comparison 'dim == None' should be 'dim is None' (singleton-comparison)
************* Module toqito.matrix_props.is_block_positive
toqito/matrix_props/is_block_positive.py:71:8: R0204: Redefinition of dim type from int to .ndarray (redefined-variable-type)
************* Module toqito.matrix_props
toqito/matrix_props/__init__.py:21:0: W0404: Reimport 'is_orthonormal' (imported line 6) (reimported)
************* Module toqito.matrix_props.sk_norm
toqito/matrix_props/sk_norm.py:20:0: R0914: Too many local variables (36/25) (too-many-locals)
toqito/matrix_props/sk_norm.py:[23](https://github.com/purva-thakre/toqito/actions/runs/6527284296/job/17721926644#step:6:24)1:7: R0916: Too many boolean expressions in if statement (6/5) (too-many-boolean-expressions)
toqito/matrix_props/sk_norm.py:[25](https://github.com/purva-thakre/toqito/actions/runs/6527284296/job/17721926644#step:6:26)7:12: W0632: Possible unbalanced tuple unpacking with sequence defined at line 201 of scipy.special._orthogonal: left side has 2 labels, right side has 3 values (unbalanced-tuple-unpacking)
toqito/matrix_props/sk_norm.py:298:16: W0632: Possible unbalanced tuple unpacking with sequence defined at line 201 of scipy.special._orthogonal: left side has 2 labels, right side has 3 values (unbalanced-tuple-unpacking)
toqito/matrix_props/sk_norm.py:96:8: R0204: Redefinition of dim type from int to .ndarray (redefined-variable-type)
toqito/matrix_props/sk_norm.py:135:4: R0204: Redefinition of upper_bound type from .ndarray to int (redefined-variable-type)
toqito/matrix_props/sk_norm.py:332:0: R0914: Too many local variables ([26](https://github.com/purva-thakre/toqito/actions/runs/6527284296/job/17721926644#step:6:27)/25) (too-many-locals)
************* Module toqito.matrix_props.is_positive_definite
toqito/matrix_props/is_positive_definite.py:7:42: W0613: Unused argument 'rtol' (unused-argument)
toqito/matrix_props/is_positive_definite.py:7:63: W0613: Unused argument 'atol' (unused-argument)
toqito/matrix_props/is_positive_definite.py:4:0: W0611: Unused is_hermitian imported from toqito.matrix_props (unused-import)
************* Module toqito.random.random_povm
toqito/random/random_povm.py:52:21: R17[28](https://github.com/purva-thakre/toqito/actions/runs/6527284296/job/17721926644#step:6:29): Consider using a generator instead 'sum(np.array(output_block).T.conj() @ output_block for output_block in input_block)' (consider-using-generator)
************* Module toqito.state_metrics.fidelity_of_separability
toqito/state_metrics/fidelity_of_separability.py:15:0: W[90](https://github.com/purva-thakre/toqito/actions/runs/6527284296/job/17721926644#step:6:91)16: "solver_option, verbosity_option" missing in parameter type documentation (missing-type-doc)
toqito/state_metrics/fidelity_of_separability.py:15:0: W9006: "ValueError" not documented as being raised (missing-raises-doc)
toqito/state_metrics/fidelity_of_separability.py:15:0: W9006: "ValueError" not documented as being raised (missing-raises-doc)
toqito/state_metrics/fidelity_of_separability.py:15:0: W9006: "ValueError" not documented as being raised (missing-raises-doc)
@purva-thakre purva-thakre self-assigned this Oct 16, 2023
@purva-thakre purva-thakre added devops bug Something isn't working labels Oct 16, 2023
@purva-thakre purva-thakre changed the title pylint error pylint errors Oct 16, 2023
@vprusso
Copy link
Owner

vprusso commented Oct 16, 2023

Great capture. Quite a lot of things to address, but I broadly agree with the warnings thrown by the linter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working devops
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants