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

Moving group of lint rules #12315

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

joesho112358
Copy link
Contributor

Summary

#9614 Moving up and comment on arguments-renamed, no-member, no-value-for-parameter, not-context-manager, unexpected-keyword-arg, unnecessary-dunder-call, unnecessary-lambda-assignment, and unspecified-encoding

Details and comments

Results below when each rule is disabled. Some are needed until qiskit/providers/options.py can be rid of the horrors/dragons within. Others seem like they are simply not wanted in this repo. See note in commit; open to suggestions on updates/removals.

arguments-renamed

************* Module qiskit.transpiler.basepasses
qiskit/transpiler/basepasses.py:90:4: W0237: Parameter 'passmanager_ir' has been renamed to 'dag' in overriding 'BasePass.run' method (arguments-renamed)
************* Module qiskit.transpiler.passmanager
qiskit/transpiler/passmanager.py:99:4: W0237: Parameter 'tasks' has been renamed to 'passes' in overriding 'PassManager.append' method (arguments-renamed)
qiskit/transpiler/passmanager.py:113:4: W0237: Parameter 'tasks' has been renamed to 'passes' in overriding 'PassManager.replace' method (arguments-renamed)
qiskit/transpiler/passmanager.py:127:4: W0237: Parameter 'in_programs' has been renamed to 'circuits' in overriding 'PassManager.run' method (arguments-renamed)
qiskit/transpiler/passmanager.py:127:4: W0237: Parameter 'callback' has been renamed to 'output_name' in overriding 'PassManager.run' method (arguments-renamed)
qiskit/transpiler/passmanager.py:127:4: W0237: Parameter 'num_processes' has been renamed to 'callback' in overriding 'PassManager.run' method (arguments-renamed)
************* Module test.python.circuit.test_unitary
test/python/circuit/test_unitary.py:181:12: W0237: Parameter 'o' has been renamed to 'obj' in overriding 'NumpyEncoder.default' method (arguments-renamed)
************* Module test.python.compiler.test_transpiler
test/python/compiler/test_transpiler.py:2770:12: W0237: Parameter 'run_input' has been renamed to 'circuit' in overriding 'FakeMultiChip.run' method (arguments-renamed)

no-member

************* Module qiskit.qasm3.exporter
qiskit/qasm3/exporter.py:803:25: E1101: Instance of 'QASM3Builder' has no 'build_subroutine_call' member (no-member)
qiskit/qasm3/exporter.py:1085:23: E1101: Module 'qiskit.qasm3.ast' has no 'BoolType' member (no-member)
************* Module qiskit.circuit._classical_resource_map
qiskit/circuit/_classical_resource_map.py:102:22: E1101: Instance of 'VariableMapper' has no 'exc_type' member (no-member)
************* Module qiskit.circuit.delay
qiskit/circuit/delay.py:65:15: E1101: Instance of 'Delay' has no 'array' member (no-member)
************* Module qiskit.circuit.singleton
qiskit/circuit/singleton.py:388:19: E1101: Instance of '_SingletonMeta' has no '_singleton_default_instance' member (no-member)
qiskit/circuit/singleton.py:389:19: E1101: Instance of '_SingletonMeta' has no '_singleton_lookup_key' member (no-member)
qiskit/circuit/singleton.py:391:28: E1101: Instance of '_SingletonMeta' has no '_singleton_static_lookup' member (no-member)
************* Module qiskit.circuit.library.basis_change.qft
qiskit/circuit/library/basis_change/qft.py:243:36: E1101: Instance of 'finfo' has no 'minexp' member (no-member)
************* Module qiskit.circuit.classical.types.types
qiskit/circuit/classical/types/types.py:111:23: E1101: Instance of 'Uint' has no 'width' member (no-member)
qiskit/circuit/classical/types/types.py:114:37: E1101: Instance of 'Uint' has no 'width' member (no-member)
qiskit/circuit/classical/types/types.py:117:43: E1101: Instance of 'Uint' has no 'width' member (no-member)
************* Module qiskit.providers.options
qiskit/providers/options.py:158:47: E1101: Instance of 'str' has no 'copy' member (no-member)
qiskit/providers/options.py:237:30: E1101: Instance of 'str' has no 'get' member (no-member)
qiskit/providers/options.py:266:32: E1101: Instance of 'str' has no 'items' member (no-member)
************* Module qiskit.utils.lazy_tester
qiskit/utils/lazy_tester.py:291:31: E1101: Class 'name' has no 'split' member (no-member)
************* Module qiskit.quantum_info.states.stabilizerstate
qiskit/quantum_info/states/stabilizerstate.py:301:18: E1101: Instance of 'bool' has no 'copy' member (no-member)
************* Module test.python.transpiler.test_preset_passmanagers
test/python/transpiler/test_preset_passmanagers.py:1277:42: E1101: Instance of 'StagedPassManager' has no 'translation' member (no-member)
test/python/transpiler/test_preset_passmanagers.py:1309:42: E1101: Instance of 'StagedPassManager' has no 'translation' member (no-member)
test/python/transpiler/test_preset_passmanagers.py:1341:42: E1101: Instance of 'StagedPassManager' has no 'translation' member (no-member)
************* Module test.python.circuit.test_singleton
test/python/circuit/test_singleton.py:472:30: E1101: Instance of 'module' has no 'name' member (no-member)
test/python/circuit/test_singleton.py:480:52: E1101: Instance of 'module' has no 'name' member (no-member)
************* Module test.python.circuit.test_circuit_vars
test/python/circuit/test_circuit_vars.py:143:25: E1101: Instance of 'str' has no 'name' member (no-member)
test/python/circuit/test_circuit_vars.py:144:25: E1101: Instance of 'str' has no 'type' member (no-member)
test/python/circuit/test_circuit_vars.py:147:25: E1101: Instance of 'str' has no 'name' member (no-member)
test/python/circuit/test_circuit_vars.py:148:25: E1101: Instance of 'str' has no 'type' member (no-member)
************* Module test.visual.results
test/visual/results.py:139:14: E1101: Instance of 'Results' has no 'summary' member (no-member)
************* Module tools.find_deprecated
tools/find_deprecated.py:44:18: E1101: Instance of 'Deprecation' has no 'filename' member (no-member)
tools/find_deprecated.py:44:34: E1101: Instance of 'Deprecation' has no 'lineno' member (no-member)

no-value-for-parameter

************* Module qiskit.providers.options
qiskit/providers/options.py:157:14: E1120: No value for argument 'cls' in classmethod call (no-value-for-parameter)

not-context-manager Excluded due to length
unexpected-keyword-arg

************* Module qiskit.primitives.backend_estimator
qiskit/primitives/backend_estimator.py:201:37: E1123: Unexpected keyword argument 'validator' in function call (unexpected-keyword-arg)
************* Module qiskit.primitives.backend_sampler
qiskit/primitives/backend_sampler.py:179:12: E1123: Unexpected keyword argument 'validator' in function call (unexpected-keyword-arg)

unnecessary-dunder-call

************* Module qiskit.visualization.state_visualization
qiskit/visualization/state_visualization.py:1459:15: C2801: Unnecessarily calls dunder method repr. Use repr built-in function. (unnecessary-dunder-call)
************* Module qiskit.visualization.pulse_v2.stylesheet
qiskit/visualization/pulse_v2/stylesheet.py:50:12: C2801: Unnecessarily calls dunder method setitem. Set item via subscript. (unnecessary-dunder-call)
************* Module qiskit.visualization.timeline.stylesheet
qiskit/visualization/timeline/stylesheet.py:57:12: C2801: Unnecessarily calls dunder method setitem. Set item via subscript. (unnecessary-dunder-call)
************* Module qiskit.circuit.parameterexpression
qiskit/circuit/parameterexpression.py:456:15: C2801: Unnecessarily calls dunder method abs. Use abs built-in function. (unnecessary-dunder-call)
************* Module qiskit.circuit.instruction
qiskit/circuit/instruction.py:515:14: C2801: Unnecessarily calls dunder method deepcopy. Use copy.deepcopy function. (unnecessary-dunder-call)
************* Module qiskit.providers.models.backendstatus
qiskit/providers/models/backendstatus.py:85:14: C2801: Unnecessarily calls dunder method repr. Use repr built-in function. (unnecessary-dunder-call)
************* Module qiskit.quantum_info.operators.operator
qiskit/quantum_info/operators/operator.py:192:19: C2801: Unnecessarily calls dunder method repr. Use repr built-in function. (unnecessary-dunder-call)
************* Module test.python.visualization.test_circuit_drawer
test/python/visualization/test_circuit_drawer.py:172:25: C2801: Unnecessarily calls dunder method str. Use str built-in function. (unnecessary-dunder-call)
test/python/visualization/test_circuit_drawer.py:206:25: C2801: Unnecessarily calls dunder method str. Use str built-in function. (unnecessary-dunder-call)
test/python/visualization/test_circuit_drawer.py:240:25: C2801: Unnecessarily calls dunder method str. Use str built-in function. (unnecessary-dunder-call)
test/python/visualization/test_circuit_drawer.py:264:25: C2801: Unnecessarily calls dunder method str. Use str built-in function. (unnecessary-dunder-call)
************* Module test.python.visualization.test_circuit_text_drawer
test/python/visualization/test_circuit_text_drawer.py:1038:12: C2801: Unnecessarily calls dunder method repr. Use repr built-in function. (unnecessary-dunder-call)
************* Module test.python.transpiler.test_layout
test/python/transpiler/test_layout.py:292:12: C2801: Unnecessarily calls dunder method repr. Use repr built-in function. (unnecessary-dunder-call)
test/python/transpiler/test_layout.py:308:12: C2801: Unnecessarily calls dunder method repr. Use repr built-in function. (unnecessary-dunder-call)
************* Module test.python.qasm3.test_import
test/python/qasm3/test_import.py:89:8: C2801: Unnecessarily calls dunder method enter. Invoke context manager directly. (unnecessary-dunder-call)
************* Module test.python.providers.test_backendstatus
test/python/providers/test_backendstatus.py:31:30: C2801: Unnecessarily calls dunder method repr. Use repr built-in function. (unnecessary-dunder-call)
************* Module test.python.quantum_info.test_quaternions
test/python/quantum_info/test_quaternions.py:43:25: C2801: Unnecessarily calls dunder method str. Use str built-in function. (unnecessary-dunder-call)
test/python/quantum_info/test_quaternions.py:43:59: C2801: Unnecessarily calls dunder method str. Use str built-in function. (unnecessary-dunder-call)
test/python/quantum_info/test_quaternions.py:47:25: C2801: Unnecessarily calls dunder method repr. Use repr built-in function. (unnecessary-dunder-call)
test/python/quantum_info/test_quaternions.py:47:60: C2801: Unnecessarily calls dunder method str. Use str built-in function. (unnecessary-dunder-call)
************* Module test.python.quantum_info.operators.test_scalar_op
test/python/quantum_info/operators/test_scalar_op.py:210:14: C2801: Unnecessarily calls dunder method rsub. Use - operator. (unnecessary-dunder-call)
************* Module tools.find_deprecated
tools/find_deprecated.py:119:18: C2801: Unnecessarily calls dunder method getitem. Access item via subscript. (unnecessary-dunder-call)

unnecessary-lambda-assignment

************* Module qiskit.transpiler.passes.optimization.template_matching.template_substitution
qiskit/transpiler/passes/optimization/template_matching/template_substitution.py:507:33: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
************* Module qiskit.dagcircuit.dagcircuit
qiskit/dagcircuit/dagcircuit.py:1565:24: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
************* Module test.python.qasm2.test_structure
test/python/qasm2/test_structure.py:1652:12: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/qasm2/test_structure.py:1653:12: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
************* Module test.python.circuit.test_compose
test/python/circuit/test_compose.py:824:17: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/circuit/test_compose.py:825:17: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/circuit/test_compose.py:826:17: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/circuit/test_compose.py:864:17: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/circuit/test_compose.py:865:17: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/circuit/test_compose.py:866:17: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/circuit/test_compose.py:867:17: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
************* Module test.python.dagcircuit.test_compose
test/python/dagcircuit/test_compose.py:448:17: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/dagcircuit/test_compose.py:449:17: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/dagcircuit/test_compose.py:450:17: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/dagcircuit/test_compose.py:492:17: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/dagcircuit/test_compose.py:493:17: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/dagcircuit/test_compose.py:494:17: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/dagcircuit/test_compose.py:495:17: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
************* Module test.python.primitives.containers.test_bindings_array
test/python/primitives/containers/test_bindings_array.py:363:22: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/primitives/containers/test_bindings_array.py:364:21: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/primitives/containers/test_bindings_array.py:381:22: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
test/python/primitives/containers/test_bindings_array.py:382:21: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)

unspecified-encoding

************* Module qiskit.version
qiskit/version.py:60:5: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module qiskit.user_config
qiskit/user_config.py:212:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module qiskit.visualization.circuit.circuit_visualization
qiskit/visualization/circuit/circuit_visualization.py:626:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module qiskit.visualization.circuit.qcstyle
qiskit/visualization/circuit/qcstyle.py:157:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
qiskit/visualization/circuit/qcstyle.py:238:25: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module qiskit.qasm3
qiskit/qasm3/init.py:316:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module qiskit.qasm2.export
qiskit/qasm2/export.py:121:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module qiskit.providers.fake_provider.fake_qasm_backend
qiskit/providers/fake_provider/fake_qasm_backend.py:67:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module test.python.test_user_config
test/python/test_user_config.py:41:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/test_user_config.py:53:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/test_user_config.py:65:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/test_user_config.py:78:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/test_user_config.py:90:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/test_user_config.py:103:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/test_user_config.py:116:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/test_user_config.py:128:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/test_user_config.py:141:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/test_user_config.py:161:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module test.python.visualization.test_circuit_text_drawer
test/python/visualization/test_circuit_text_drawer.py:489:17: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module test.python.qasm3.test_import
test/python/qasm3/test_import.py:73:17: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm3/test_import.py:112:17: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm3/test_import.py:310:17: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module test.python.qasm2.test_structure
test/python/qasm2/test_structure.py:1062:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1079:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1100:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1106:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1121:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1125:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1133:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1144:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1160:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1163:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1172:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1174:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1177:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1186:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1188:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1191:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1200:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_structure.py:1203:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module test.python.qasm2.test_export
test/python/qasm2/test_export.py:838:21: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
test/python/qasm2/test_export.py:856:21: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module test.visual.results
test/visual/results.py:34:17: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module tools.build_standard_commutations
tools/build_standard_commutations.py:142:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module tools.subunit_to_junit
tools/subunit_to_junit.py:74:20: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module tools.find_deprecated
tools/find_deprecated.py:219:15: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)

…context-manager, unexpected-keyword-arg, unnecessary-dunder-call, unnecessary-lambda-assignment, and unspecified-encoding lint rules
@joesho112358 joesho112358 requested a review from a team as a code owner May 1, 2024 03:11
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label May 1, 2024
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

@coveralls
Copy link

coveralls commented May 1, 2024

Pull Request Test Coverage Report for Build 9080725156

Details

  • 6 of 6 (100.0%) changed or added relevant lines in 4 files are covered.
  • 4 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.02%) to 89.624%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 4 92.37%
Totals Coverage Status
Change from base Build 9080271824: 0.02%
Covered Lines: 62302
Relevant Lines: 69515

💛 - Coveralls

Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking at these - I agree that most of them can just be generally disabled.

pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
@joesho112358
Copy link
Contributor Author

will review this soon

@joesho112358 joesho112358 requested a review from a team as a code owner May 14, 2024 01:56
@joesho112358 joesho112358 requested a review from jyu00 as a code owner May 14, 2024 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community PR PRs from contributors that are not 'members' of the Qiskit repo
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

4 participants