Repository: rigetti/pyquil (python)

Issue:
Ignore fewer flake8 style rules
If I remove everything other than `E501` (line length) and `F401` (unused imports), and run `flake8 pyquil`, I get 319 errors. At some point we should try to get rid of these, rather than ignoring them. I'll paste the output as a comment.




Discussion:
```
pyquil/magic.py:43:5: E743 ambiguous function definition 'I'
pyquil/gates.py:75:5: E743 ambiguous function definition 'I'
pyquil/gates.py:514:14: W503 line break before binary operator
pyquil/gates.py:900:11: E126 continuation line over-indented for hanging indent
pyquil/gate_matrices.py:90:1: E741 ambiguous variable name 'I'
pyquil/paulis.py:66:13: W503 line break before binary operator
pyquil/paulis.py:140:21: W503 line break before binary operator
pyquil/paulis.py:510:17: W503 line break before binary operator
pyquil/noise.py:464:9: F841 local variable 'key' is assigned to but never used
pyquil/noise.py:684:23: W503 line break before binary operator
pyquil/quilatom.py:387:17: W503 line break before binary operator
pyquil/quilatom.py:388:17: W503 line break before binary operator
pyquil/quilatom.py:437:17: W503 line break before binary operator
pyquil/quilatom.py:438:17: W503 line break before binary operator
pyquil/quilatom.py:521:17: W503 line break before binary operator
pyquil/quilatom.py:522:17: W503 line break before binary operator
pyquil/quilatom.py:528:17: W503 line break before binary operator
pyquil/quilatom.py:529:17: W503 line break before binary operator
pyquil/quilatom.py:627:17: W503 line break before binary operator
pyquil/quilatom.py:628:17: W503 line break before binary operator
pyquil/quilbase.py:751:17: W503 line break before binary operator
pyquil/quilbase.py:774:17: W503 line break before binary operator
pyquil/quilbase.py:858:21: W503 line break before binary operator
pyquil/quilbase.py:859:21: W503 line break before binary operator
pyquil/quilbase.py:860:21: W503 line break before binary operator
pyquil/latex/_ipython.py:79:34: E127 continuation line over-indented for visual indent
pyquil/tests/test_parser.py:19:1: F403 'from pyquil.gates import *' used; unable to detect undefined names
pyquil/tests/test_parser.py:29:25: F405 'Gate' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:30:32: F405 'Gate' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:34:25: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:35:30: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:36:30: F405 'SWAP' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:114:31: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:115:37: F405 'CPHASE00' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:116:30: F405 'Gate' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:117:31: F405 'Gate' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:123:50: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:184:31: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:185:37: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:196:27: F405 'RESET' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:197:26: F405 'WAIT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:198:25: F405 'NOP' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:204:43: F405 'STORE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:205:39: F405 'STORE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:206:43: F405 'LOAD' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:207:41: F405 'CONVERT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:208:42: F405 'EXCHANGE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:209:35: F405 'MOVE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:210:36: F405 'MOVE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:211:38: F405 'MOVE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:215:34: F405 'MOVE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:216:34: F405 'MOVE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:217:31: F405 'NOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:218:33: F405 'AND' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:219:33: F405 'IOR' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:220:34: F405 'MOVE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:221:33: F405 'XOR' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:222:36: F405 'ADD' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:223:36: F405 'SUB' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:224:36: F405 'MUL' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:225:36: F405 'DIV' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:226:37: F405 'ADD' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:227:37: F405 'SUB' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:228:37: F405 'MUL' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:229:37: F405 'DIV' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:231:18: F405 'EQ' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:233:18: F405 'LT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:235:18: F405 'LE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:237:18: F405 'GT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:239:18: F405 'GE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:241:18: F405 'EQ' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:243:18: F405 'LT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:245:18: F405 'LE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:247:18: F405 'GT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:249:18: F405 'GE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:251:18: F405 'EQ' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:253:18: F405 'LT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:255:18: F405 'LE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:257:18: F405 'GT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:259:18: F405 'GE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:337:21: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:339:21: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:344:21: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:349:21: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parser.py:355:18: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:8:1: F403 'from pyquil.gates import *' used; unable to detect undefined names
pyquil/tests/test_numpy_simulator.py:53:20: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:61:20: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:61:26: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:69:20: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:69:26: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:77:20: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:77:26: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:77:32: F405 'CCNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:87:20: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:89:17: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:103:9: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:104:9: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:105:9: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:165:20: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:165:26: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:220:10: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:236:10: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_numpy_simulator.py:237:10: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_noise.py:123:5: F841 local variable 'new_gates' is assigned to but never used
pyquil/tests/test_noise.py:128:16: W503 line break before binary operator
pyquil/tests/test_reference_density_simulator.py:7:1: F403 'from pyquil.gates import *' used; unable to detect undefined names
pyquil/tests/test_reference_density_simulator.py:25:16: F405 'RY' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:25:34: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:26:16: F405 'RY' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:26:34: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:27:16: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:27:28: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:27:47: F405 'RY' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:28:16: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:28:34: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:29:16: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:29:43: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:39:9: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:39:15: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:39:21: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:39:27: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:40:9: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:41:9: F405 'PHASE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:42:9: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:43:9: F405 'PHASE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:44:9: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:45:9: F405 'RZ' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:46:9: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:47:9: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:48:9: F405 'PHASE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:49:9: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:50:9: F405 'PHASE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:51:9: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:52:9: F405 'RZ' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:53:9: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:54:9: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:55:9: F405 'PHASE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:56:9: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:57:9: F405 'PHASE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:58:9: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:59:9: F405 'RZ' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:60:9: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:61:9: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:62:9: F405 'PHASE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:63:9: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:64:9: F405 'PHASE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:65:9: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:66:9: F405 'RZ' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:67:9: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:68:9: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:69:9: F405 'RZ' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:70:9: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:71:9: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:72:9: F405 'RZ' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:73:9: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:74:9: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:75:9: F405 'RZ' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:76:9: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:77:9: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:78:9: F405 'RZ' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:79:9: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:119:25: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:130:25: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:142:25: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:154:25: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:167:25: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:179:25: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:182:48: W503 line break before binary operator
pyquil/tests/test_reference_density_simulator.py:183:48: W503 line break before binary operator
pyquil/tests/test_reference_density_simulator.py:195:25: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:205:9: F405 'RY' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:206:9: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:270:20: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:310:20: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:312:13: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_reference_density_simulator.py:329:23: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_gate_matrices.py:7:5: E741 ambiguous variable name 'I'
pyquil/tests/test_unitary_tools.py:6:1: F403 'from pyquil.gates import *' used; unable to detect undefined names
pyquil/tests/test_unitary_tools.py:16:25: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:16:31: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:16:37: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:23:25: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:23:31: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:23:37: F405 'Y' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:23:43: F405 'Z' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:33:17: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:33:23: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:33:35: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:52:21: F405 'RY' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:52:39: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:53:21: F405 'RY' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:53:39: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:54:21: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:54:33: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:54:52: F405 'RY' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:55:21: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:55:39: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:56:21: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:56:48: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:66:42: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:66:48: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:66:54: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:118:20: E127 continuation line over-indented for visual indent
pyquil/tests/test_unitary_tools.py:125:20: E127 continuation line over-indented for visual indent
pyquil/tests/test_unitary_tools.py:281:32: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:285:32: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:289:32: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:293:32: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:299:32: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:303:32: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:307:32: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:313:32: F405 'RZ' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:317:32: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:318:32: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:323:32: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:324:32: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:327:32: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:328:32: F405 'CCNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:333:32: F405 'RY' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:334:27: F405 'RY' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:342:32: F405 'PHASE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:343:32: F405 'CZ' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:346:32: F405 'PHASE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:347:32: F405 'CZ' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_unitary_tools.py:411:12: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_parameters.py:5:1: F811 redefinition of unused 'quil_cis' from line 5
pyquil/tests/test_quil.py:352:39: F841 local variable 'e' is assigned to but never used
pyquil/tests/test_quil.py:1313:5: F841 local variable 'less_trivial_pi' is assigned to but never used
pyquil/tests/test_quil.py:1318:5: F841 local variable 'more_less_trivial_pi' is assigned to but never used
pyquil/tests/test_operator_estimation.py:131:9: F841 local variable 'res' is assigned to but never used
pyquil/tests/test_operator_estimation.py:385:9: F841 local variable 'result' is assigned to but never used
pyquil/tests/test_paulis_with_placeholders.py:58:13: W503 line break before binary operator
pyquil/tests/test_paulis_with_placeholders.py:76:13: W503 line break before binary operator
pyquil/tests/test_paulis_with_placeholders.py:86:13: W503 line break before binary operator
pyquil/tests/test_paulis_with_placeholders.py:154:13: F841 local variable 't' is assigned to but never used
pyquil/tests/test_paulis_with_placeholders.py:302:18: W503 line break before binary operator
pyquil/tests/test_paulis_with_placeholders.py:303:18: W503 line break before binary operator
pyquil/tests/test_paulis_with_placeholders.py:304:18: W503 line break before binary operator
pyquil/tests/test_qpu.py:247:9: F841 local variable 'result' is assigned to but never used
pyquil/tests/test_qpu.py:252:9: F841 local variable 'qpu' is assigned to but never used
pyquil/tests/test_magic.py:1:1: F403 'from pyquil.magic import *' used; unable to detect undefined names
pyquil/tests/test_magic.py:4:2: F405 'magicquil' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:6:5: F405 'H' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:7:5: F405 'CNOT' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:11:32: F405 'Program' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:14:2: F405 'magicquil' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:16:12: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:18:9: F405 'X' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:20:9: F405 'I' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:24:29: F405 'Program' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:24:91: F405 'Program' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:24:107: F405 'Program' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:27:2: F405 'magicquil' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:29:12: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:31:9: F405 'X' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:35:26: F405 'Program' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:35:88: F405 'Program' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:38:2: F405 'magicquil' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:40:12: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:41:12: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:43:9: F405 'X' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:45:9: F405 'X' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:49:31: F405 'Program' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:50:29: F405 'Program' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:50:45: F405 'Program' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:50:74: F405 'Program' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:53:2: F405 'magicquil' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:56:5: F405 'CNOT' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:60:38: F405 'Program' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:63:2: F405 'magicquil' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:66:9: F405 'H' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:68:9: F405 'H' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_magic.py:72:40: F405 'Program' may be undefined, or defined from star imports: pyquil.magic
pyquil/tests/test_quantum_computer.py:20:1: F403 'from pyquil.gates import *' used; unable to detect undefined names
pyquil/tests/test_quantum_computer.py:24:1: F811 redefinition of unused 'DummyCompiler' from line 10
pyquil/tests/test_quantum_computer.py:53:20: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:53:26: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:151:20: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:151:26: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:217:13: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:218:13: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:219:13: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:220:13: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:221:13: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:222:13: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:238:20: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:238:26: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:238:38: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:241:17: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:257:20: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:257:26: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:257:38: F405 'CNOT' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:260:17: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:278:20: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:278:26: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:279:20: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:280:20: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:302:25: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:429:37: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:452:13: F405 'H' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:468:20: F405 'I' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:479:39: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:479:45: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:511:13: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:512:13: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:532:9: F405 'RX' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:533:9: F405 'MEASURE' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:573:42: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_quantum_computer.py:586:17: F405 'X' may be undefined, or defined from star imports: pyquil.gates
pyquil/tests/test_paulis.py:98:13: W503 line break before binary operator
pyquil/tests/test_paulis.py:348:18: W503 line break before binary operator
pyquil/tests/test_paulis.py:349:18: W503 line break before binary operator
pyquil/tests/test_paulis.py:350:18: W503 line break before binary operator
pyquil/tests/test_paulis.py:679:9: F841 local variable 'op' is assigned to but never used
pyquil/_parser/PyQuilListener.py:83:13: W503 line break before binary operator
pyquil/api/_quantum_computer.py:133:37: E127 continuation line over-indented for visual indent
pyquil/experiment/_main.py:58:26: W503 line break before binary operator
pyquil/experiment/_main.py:222:29: W503 line break before binary operator
```

Patch:
diff --git a/examples/1.3_vqe_demo.py b/examples/1.3_vqe_demo.py
--- a/examples/1.3_vqe_demo.py
+++ b/examples/1.3_vqe_demo.py
@@ -2,7 +2,6 @@
 This is a demo of VQE through the forest stack. We will do the H2 binding from the Google paper
 using OpenFermion to generate Hamiltonians and Forest to simulate the system
 """
-import sys
 import numpy as np
 import matplotlib.pyplot as plt
 
@@ -18,12 +17,14 @@
 
 from pyquil.quil import Program
 from pyquil.paulis import sX, sY, exponentiate, PauliSum
-from pyquil.gates import X, I
+from pyquil.gates import X
 from pyquil.api import QVMConnection
 from pyquil.unitary_tools import tensor_up
 
 from grove.measurements.estimation import estimate_locally_commuting_operator
 
+QVM_CONNECTION = QVMConnection(endpoint="http://localhost:5000")
+
 
 def get_h2_dimer(bond_length):
     # Set molecule parameters.
@@ -60,7 +61,7 @@ def ucc_circuit(theta):
 
 
 def objective_fun(
-    theta, hamiltonian=None, quantum_resource=QVMConnection(endpoint="http://localhost:5000")
+    theta, hamiltonian=None, quantum_resource=QVM_CONNECTION
 ):
     """
     Evaluate the Hamiltonian bny operator averaging
diff --git a/examples/qaoa_ansatz.py b/examples/qaoa_ansatz.py
--- a/examples/qaoa_ansatz.py
+++ b/examples/qaoa_ansatz.py
@@ -26,7 +26,6 @@
 from pyquil.quil import Program
 from pyquil.gates import H
 from pyquil.paulis import sI, sX, sZ, exponentiate_commuting_pauli_sum
-from pyquil.api import QVMConnection
 
 # Create a 4-node array graph: 0-1-2-3.
 graph = [(0, 1), (1, 2), (2, 3)]
diff --git a/examples/website-script.py b/examples/website-script.py
--- a/examples/website-script.py
+++ b/examples/website-script.py
@@ -10,7 +10,7 @@
 """
 
 from pyquil import Program, get_qc
-from pyquil.gates import *
+from pyquil.gates import H, CNOT
 
 # construct a Bell State program
 p = Program(H(0), CNOT(0, 1))
diff --git a/pyquil/api/_base_connection.py b/pyquil/api/_base_connection.py
--- a/pyquil/api/_base_connection.py
+++ b/pyquil/api/_base_connection.py
@@ -30,7 +30,6 @@
 from pyquil.api._error_reporting import _record_call
 from pyquil.api._errors import error_mapping, UserMessageError, UnknownApiError, TooManyQubitsError
 from pyquil.api._logger import logger
-from pyquil.device import Specs, ISA
 from pyquil.wavefunction import Wavefunction
 
 TYPE_EXPECTATION = "expectation"
diff --git a/pyquil/api/_compiler.py b/pyquil/api/_compiler.py
--- a/pyquil/api/_compiler.py
+++ b/pyquil/api/_compiler.py
@@ -34,7 +34,7 @@
 from urllib.parse import urljoin
 
 from pyquil import __version__
-from pyquil.api._base_connection import ForestSession, get_session
+from pyquil.api._base_connection import ForestSession
 from pyquil.api._qac import AbstractCompiler
 from pyquil.api._error_reporting import _record_call
 from pyquil.api._errors import UserMessageError
diff --git a/pyquil/api/_qpu.py b/pyquil/api/_qpu.py
--- a/pyquil/api/_qpu.py
+++ b/pyquil/api/_qpu.py
@@ -24,7 +24,7 @@
 
 from pyquil import Program
 from pyquil.parser import parse
-from pyquil.api._base_connection import ForestSession, get_session
+from pyquil.api._base_connection import ForestSession
 from pyquil.api._error_reporting import _record_call
 from pyquil.api._errors import UserMessageError
 from pyquil.api._logger import logger
diff --git a/pyquil/api/_quantum_computer.py b/pyquil/api/_quantum_computer.py
--- a/pyquil/api/_quantum_computer.py
+++ b/pyquil/api/_quantum_computer.py
@@ -1199,7 +1199,7 @@ def hadamard(n, dtype=int):
     H = np.array([[1]], dtype=dtype)
 
     # Sylvester's construction
-    for i in range(0, lg2):
+    for _ in range(0, lg2):
         H = np.vstack((np.hstack((H, H)), np.hstack((H, -H))))
 
     return H
diff --git a/pyquil/api/_qvm.py b/pyquil/api/_qvm.py
--- a/pyquil/api/_qvm.py
+++ b/pyquil/api/_qvm.py
@@ -34,7 +34,6 @@
 from pyquil.api._config import PyquilConfig
 from pyquil.api._error_reporting import _record_call
 from pyquil.api._qam import QAM
-from pyquil.device import Device
 from pyquil.gates import MOVE, MemoryReference
 from pyquil.noise import apply_noise_model
 from pyquil.paulis import PauliSum
diff --git a/pyquil/experiment/_memory.py b/pyquil/experiment/_memory.py
--- a/pyquil/experiment/_memory.py
+++ b/pyquil/experiment/_memory.py
@@ -20,7 +20,6 @@
 import numpy as np
 
 from pyquil.paulis import PauliTerm
-from pyquil.experiment._symmetrization import SymmetrizationLevel
 
 
 def euler_angles_RX(theta: float) -> Tuple[float, float, float]:
diff --git a/pyquil/experiment/_setting.py b/pyquil/experiment/_setting.py
--- a/pyquil/experiment/_setting.py
+++ b/pyquil/experiment/_setting.py
@@ -24,10 +24,6 @@
 from typing import Iterable, Tuple
 
 from pyquil.paulis import PauliTerm, sI, is_identity
-from pyquil.experiment._memory import (
-    pauli_term_to_measurement_memory_map,
-    pauli_term_to_preparation_memory_map,
-)
 
 if sys.version_info < (3, 7):
     from pyquil.external.dataclasses import dataclass
diff --git a/pyquil/gates.py b/pyquil/gates.py
--- a/pyquil/gates.py
+++ b/pyquil/gates.py
@@ -14,18 +14,17 @@
 #    limitations under the License.
 ##############################################################################
 from warnings import warn
-from typing import Any, Callable, Mapping, Optional, Tuple, Union, overload
+from typing import Callable, Mapping, Optional, Tuple, Union
+
+import numpy as np
 
 from pyquil.quilatom import (
     Addr,
     Expression,
     MemoryReference,
     MemoryReferenceDesignator,
-    Parameter,
     ParameterDesignator,
-    Qubit,
     QubitDesignator,
-    QubitPlaceholder,
     unpack_classical_reg,
     unpack_qubit,
 )
@@ -382,7 +381,15 @@ def CPHASE10(angle: ParameterDesignator, control: QubitDesignator, target: Qubit
     return Gate(name="CPHASE10", params=[angle], qubits=qubits)
 
 
-def CPHASE(angle: ParameterDesignator, control: QubitDesignator, target: QubitDesignator) -> Gate:
+# NOTE: We don't use ParameterDesignator here because of the following Sphinx error. This error
+# can be resolved by importing Expression, but then flake8 complains about an unused import:
+#   Cannot resolve forward reference in type annotations of "pyquil.gates.CPHASE":
+#   name 'Expression' is not defined
+def CPHASE(
+    angle: Union[Expression, MemoryReference, np.int_, int, float, complex],
+    control: QubitDesignator,
+    target: QubitDesignator,
+) -> Gate:
     """Produces a controlled-phase instruction::
 
         CPHASE(phi) = diag([1, 1, 1, exp(1j * phi)])
diff --git a/pyquil/latex/_diagram.py b/pyquil/latex/_diagram.py
--- a/pyquil/latex/_diagram.py
+++ b/pyquil/latex/_diagram.py
@@ -23,7 +23,6 @@
 from pyquil.quilbase import (
     AbstractInstruction,
     Wait,
-    Reset,
     ResetQubit,
     JumpConditional,
     JumpWhen,
@@ -404,7 +403,7 @@ def build(self):
         self.index = 0
         self.working_instructions = measures
 
-        for instr in self.working_instructions:
+        for _ in self.working_instructions:
             self._build_measure()
 
         offset = max(self.settings.qubit_line_open_wire_length, 0)
diff --git a/pyquil/noise.py b/pyquil/noise.py
--- a/pyquil/noise.py
+++ b/pyquil/noise.py
@@ -468,7 +468,6 @@ def _decoherence_noise_model(
     kraus_maps = []
     for g in gates:
         targets = tuple(t.index for t in g.qubits)
-        key = (g.name, tuple(g.params))
         if g.name in NO_NOISE:
             continue
         matrix, _ = get_noisy_gate(g.name, g.params)
diff --git a/pyquil/numpy_simulator.py b/pyquil/numpy_simulator.py
--- a/pyquil/numpy_simulator.py
+++ b/pyquil/numpy_simulator.py
@@ -18,7 +18,6 @@
 import numpy as np
 from numpy.random.mtrand import RandomState
 
-from pyquil import Program
 from pyquil.gate_matrices import QUANTUM_GATES
 from pyquil.paulis import PauliTerm, PauliSum
 from pyquil.quilbase import Gate
diff --git a/pyquil/pyqvm.py b/pyquil/pyqvm.py
--- a/pyquil/pyqvm.py
+++ b/pyquil/pyqvm.py
@@ -15,8 +15,7 @@
 ##############################################################################
 import warnings
 from abc import ABC, abstractmethod
-from collections import defaultdict
-from typing import Type, Dict, Tuple, Union, List, Sequence
+from typing import Dict, List, Sequence, Type, Union
 
 import numpy as np
 from numpy.random.mtrand import RandomState
@@ -52,15 +51,6 @@
     ClassicalDiv,
     ClassicalMove,
     ClassicalExchange,
-    ClassicalConvert,
-    ClassicalLoad,
-    ClassicalStore,
-    ClassicalComparison,
-    ClassicalEqual,
-    ClassicalLessThan,
-    ClassicalLessEqual,
-    ClassicalGreaterThan,
-    ClassicalGreaterEqual,
     Jump,
     Pragma,
     Declare,
diff --git a/pyquil/quil.py b/pyquil/quil.py
--- a/pyquil/quil.py
+++ b/pyquil/quil.py
@@ -39,7 +39,7 @@
     unpack_classical_reg,
     unpack_qubit,
 )
-from pyquil.gates import MEASURE, H, RESET
+from pyquil.gates import MEASURE, RESET
 from pyquil.quilbase import (
     DefGate,
     Gate,
@@ -65,7 +65,7 @@ class Program(object):
     """A list of pyQuil instructions that comprise a quantum program.
 
     >>> from pyquil import Program
-    >>> from pyquil.gates import *
+    >>> from pyquil.gates import H, CNOT
     >>> p = Program()
     >>> p += H(0)
     >>> p += CNOT(0, 1)
diff --git a/pyquil/quilatom.py b/pyquil/quilatom.py
--- a/pyquil/quilatom.py
+++ b/pyquil/quilatom.py
@@ -289,7 +289,7 @@ def format_parameter(element: ParameterDesignator) -> str:
         return str(element)
     elif isinstance(element, Expression):
         return _expression_to_string(element)
-    assert False, "Invalid parameter: %r" % element
+    raise AssertionError("Invalid parameter: %r" % element)
 
 
 ExpressionValueDesignator = Union[int, float, complex]


Test patch:
diff --git a/pyquil/api/tests/test_config.py b/pyquil/api/tests/test_config.py
--- a/pyquil/api/tests/test_config.py
+++ b/pyquil/api/tests/test_config.py
@@ -1,5 +1,4 @@
 import pytest
-import os
 
 from pyquil.api._config import PyquilConfig
 from pyquil.api._errors import UserMessageError
diff --git a/pyquil/latex/tests/test_latex.py b/pyquil/latex/tests/test_latex.py
--- a/pyquil/latex/tests/test_latex.py
+++ b/pyquil/latex/tests/test_latex.py
@@ -3,7 +3,7 @@
 from pyquil.quil import Program, Pragma
 from pyquil.quilbase import Declare, Measurement, JumpTarget, Jump
 from pyquil.quilatom import MemoryReference, Label
-from pyquil.gates import H, X, Y, RX, CZ, SWAP, MEASURE, CNOT, RESET, WAIT, MOVE
+from pyquil.gates import H, X, Y, RX, CZ, SWAP, MEASURE, CNOT, WAIT, MOVE
 from pyquil.latex import to_latex, DiagramSettings
 from pyquil.latex._diagram import split_on_terminal_measures
 
diff --git a/pyquil/tests/test_gate_matrices.py b/pyquil/tests/test_gate_matrices.py
--- a/pyquil/tests/test_gate_matrices.py
+++ b/pyquil/tests/test_gate_matrices.py
@@ -11,21 +11,16 @@
 
 
 def test_singleq():
-    I = QUANTUM_GATES["I"]
-    assert np.isclose(I, np.eye(2)).all()
-    X = QUANTUM_GATES["X"]
-    assert np.isclose(X, np.array([[0, 1], [1, 0]])).all()
-    Y = QUANTUM_GATES["Y"]
-    assert np.isclose(Y, np.array([[0, -1j], [1j, 0]])).all()
-    Z = QUANTUM_GATES["Z"]
-    assert np.isclose(Z, np.array([[1, 0], [0, -1]])).all()
-
-    H = QUANTUM_GATES["H"]
-    assert np.isclose(H, (1.0 / np.sqrt(2)) * np.array([[1, 1], [1, -1]])).all()
-    S = QUANTUM_GATES["S"]
-    assert np.isclose(S, np.array([[1.0, 0], [0, 1j]])).all()
-    T = QUANTUM_GATES["T"]
-    assert np.isclose(T, np.array([[1.0, 0.0], [0.0, np.exp(1.0j * np.pi / 4.0)]])).all()
+    assert np.isclose(QUANTUM_GATES["I"], np.eye(2)).all()
+    assert np.isclose(QUANTUM_GATES["X"], np.array([[0, 1], [1, 0]])).all()
+    assert np.isclose(QUANTUM_GATES["Y"], np.array([[0, -1j], [1j, 0]])).all()
+    assert np.isclose(QUANTUM_GATES["Z"], np.array([[1, 0], [0, -1]])).all()
+
+    assert np.isclose(QUANTUM_GATES["H"], (1.0 / np.sqrt(2)) * np.array([[1, 1], [1, -1]])).all()
+    assert np.isclose(QUANTUM_GATES["S"], np.array([[1.0, 0], [0, 1j]])).all()
+    assert np.isclose(
+        QUANTUM_GATES["T"], np.array([[1.0, 0.0], [0.0, np.exp(1.0j * np.pi / 4.0)]])
+    ).all()
 
 
 def test_parametric():
diff --git a/pyquil/tests/test_magic.py b/pyquil/tests/test_magic.py
--- a/pyquil/tests/test_magic.py
+++ b/pyquil/tests/test_magic.py
@@ -1,4 +1,12 @@
-from pyquil.magic import *
+from pyquil.magic import (
+    CNOT,
+    H,
+    I,
+    MEASURE,
+    X,
+    Program,
+    magicquil,
+)
 
 
 @magicquil
diff --git a/pyquil/tests/test_noise.py b/pyquil/tests/test_noise.py
--- a/pyquil/tests/test_noise.py
+++ b/pyquil/tests/test_noise.py
@@ -3,7 +3,7 @@
 import numpy as np
 from unittest.mock import Mock
 
-from pyquil.gates import CZ, RZ, RX, I, H
+from pyquil.gates import CZ, I, RX, RZ
 from pyquil.noise import (
     pauli_kraus_map,
     damping_kraus_map,
@@ -134,7 +134,6 @@ def test_decoherence_noise():
 
     # verify that gate names are translated
     new_prog = apply_noise_model(prog, m3)
-    new_gates = _get_program_gates(new_prog)
 
     # check that headers have been embedded
     headers = _noise_model_program_header(m3)
diff --git a/pyquil/tests/test_numpy_simulator.py b/pyquil/tests/test_numpy_simulator.py
--- a/pyquil/tests/test_numpy_simulator.py
+++ b/pyquil/tests/test_numpy_simulator.py
@@ -5,7 +5,7 @@
 
 from pyquil import Program
 from pyquil.gate_matrices import QUANTUM_GATES as GATES
-from pyquil.gates import *
+from pyquil.gates import CCNOT, CNOT, H, MEASURE, RX, X
 from pyquil.numpy_simulator import (
     targeted_einsum,
     NumpyWavefunctionSimulator,
@@ -195,7 +195,7 @@ def test_expectation():
 
 
 def test_expectation_vs_ref_qvm(qvm, n_qubits):
-    for repeat_i in range(20):
+    for _ in range(20):
         prog = _generate_random_program(n_qubits=n_qubits, length=10)
         operator = _generate_random_pauli(n_qubits=n_qubits, n_terms=5)
         print(prog)
diff --git a/pyquil/tests/test_operator_estimation.py b/pyquil/tests/test_operator_estimation.py
--- a/pyquil/tests/test_operator_estimation.py
+++ b/pyquil/tests/test_operator_estimation.py
@@ -162,7 +162,7 @@ def test_no_complex_coeffs(forest):
         [ExperimentSetting(TensorProductState(), 1.0j * sY(0))], program=Program(X(0))
     )
     with pytest.raises(ValueError):
-        res = list(measure_observables(qc, suite, n_shots=2000))
+        list(measure_observables(qc, suite, n_shots=2000))
 
 
 def test_max_weight_operator_1():
@@ -415,7 +415,7 @@ def test_measure_observables_no_symm_calibr_raises_error(forest):
     exptsetting = ExperimentSetting(plusZ(0), sX(0))
     suite = TomographyExperiment([exptsetting], program=Program(I(0)), symmetrization=0)
     with pytest.raises(ValueError):
-        result = list(measure_observables(qc, suite, calibrate_readout="plus-eig"))
+        list(measure_observables(qc, suite, calibrate_readout="plus-eig"))
 
 
 def test_ops_bool_to_prog():
diff --git a/pyquil/tests/test_parameters.py b/pyquil/tests/test_parameters.py
--- a/pyquil/tests/test_parameters.py
+++ b/pyquil/tests/test_parameters.py
@@ -8,7 +8,6 @@
     quil_cos,
     quil_sqrt,
     quil_exp,
-    quil_cis,
     _contained_parameters,
     format_parameter,
     quil_cis,
diff --git a/pyquil/tests/test_parser.py b/pyquil/tests/test_parser.py
--- a/pyquil/tests/test_parser.py
+++ b/pyquil/tests/test_parser.py
@@ -16,7 +16,37 @@
 import numpy as np
 import pytest
 
-from pyquil.gates import *
+from pyquil.gates import (
+    ADD,
+    AND,
+    CNOT,
+    CONVERT,
+    CPHASE00,
+    DIV,
+    EQ,
+    EXCHANGE,
+    Gate,
+    GE,
+    GT,
+    H,
+    IOR,
+    LE,
+    LOAD,
+    LT,
+    MEASURE,
+    MOVE,
+    MUL,
+    NOP,
+    NOT,
+    RESET,
+    RX,
+    STORE,
+    SUB,
+    SWAP,
+    WAIT,
+    X,
+    XOR,
+)
 from pyquil.parser import parse
 from pyquil.quilatom import MemoryReference, Parameter, quil_cos, quil_sin
 from pyquil.quilbase import Declare, Reset, ResetQubit
diff --git a/pyquil/tests/test_paulis.py b/pyquil/tests/test_paulis.py
--- a/pyquil/tests/test_paulis.py
+++ b/pyquil/tests/test_paulis.py
@@ -776,7 +776,7 @@ def test_identity_no_qubit():
 
 def test_qubit_validation():
     with pytest.raises(ValueError):
-        op = sX(None)
+        sX(None)
 
 
 def test_pauli_term_from_str():
diff --git a/pyquil/tests/test_paulis_with_placeholders.py b/pyquil/tests/test_paulis_with_placeholders.py
--- a/pyquil/tests/test_paulis_with_placeholders.py
+++ b/pyquil/tests/test_paulis_with_placeholders.py
@@ -172,7 +172,7 @@ def test_ids():
     # Not sortable
     with pytest.raises(TypeError):
         with pytest.warns(FutureWarning):
-            t = term_1.id() == term_2.id()
+            term_1.id() == term_2.id()
 
 
 def test_ids_no_sort():
@@ -669,7 +669,7 @@ def test_from_list():
 
     with pytest.raises(ValueError):
         # terms are not on disjoint qubits
-        pterm = PauliTerm.from_list([("X", q[0]), ("Y", q[0])])
+        PauliTerm.from_list([("X", q[0]), ("Y", q[0])])
 
 
 def test_ordered():
diff --git a/pyquil/tests/test_qpu.py b/pyquil/tests/test_qpu.py
--- a/pyquil/tests/test_qpu.py
+++ b/pyquil/tests/test_qpu.py
@@ -10,7 +10,6 @@
 from pyquil.api._base_connection import Engagement, get_session
 from pyquil.api._compiler import _collect_classical_memory_write_locations
 from pyquil.api._config import PyquilConfig
-from pyquil.api._errors import UserMessageError
 from pyquil.api._qpu import _extract_bitstrings
 from pyquil.device import NxDevice
 from pyquil.gates import I, X
@@ -246,12 +245,12 @@ def test_run_expects_executable(qvm, qpu_compiler):
 
     p = Program(X(0))
     with pytest.raises(TypeError):
-        result = qc.run(p)
+        qc.run(p)
 
 
 def test_qpu_not_engaged_error():
     with pytest.raises(ValueError):
-        qpu = QPU()
+        QPU()
 
 
 def test_qpu_does_not_engage_without_session():
diff --git a/pyquil/tests/test_quantum_computer.py b/pyquil/tests/test_quantum_computer.py
--- a/pyquil/tests/test_quantum_computer.py
+++ b/pyquil/tests/test_quantum_computer.py
@@ -7,7 +7,6 @@
 
 from pyquil import Program, get_qc, list_quantum_computers
 from pyquil.api import QVM, QuantumComputer, local_forest_runtime
-from pyquil.tests.utils import DummyCompiler
 from pyquil.api._quantum_computer import (
     _symmetrization,
     _flip_array_to_prog,
@@ -21,7 +20,7 @@
     _check_min_num_trials_for_symmetrized_readout,
 )
 from pyquil.device import NxDevice, gates_in_isa
-from pyquil.gates import *
+from pyquil.gates import CNOT, H, I, MEASURE, RX, X
 from pyquil.quilbase import Declare, MemoryReference
 from pyquil.noise import decoherence_noise_with_asymmetric_ro
 from pyquil.pyqvm import PyQVM
@@ -422,7 +421,7 @@ def test_qc_run(qvm, compiler):
     qc = get_qc("9q-square-noisy-qvm")
     bs = qc.run_and_measure(Program(X(0)), trials=3)
     assert len(bs) == 9
-    for q, bits in bs.items():
+    for _, bits in bs.items():
         assert bits.shape == (3,)
 
 
diff --git a/pyquil/tests/test_quil.py b/pyquil/tests/test_quil.py
--- a/pyquil/tests/test_quil.py
+++ b/pyquil/tests/test_quil.py
@@ -406,7 +406,7 @@ def test_dagger():
     assert p.dagger().out() == "DAGGER H 0\nDAGGER X 0\n"
 
     p = Program(X(0), MEASURE(0, MemoryReference("ro", 0)))
-    with pytest.raises(ValueError) as e:
+    with pytest.raises(ValueError):
         p.dagger().out()
 
     # ensure that modifiers are preserved https://github.com/rigetti/pyquil/pull/914
@@ -1376,7 +1376,7 @@ def test_placeholders_preserves_modifiers():
 
 
 def _eval_as_np_pi(exp):
-    eval(exp.replace("pi", repr(np.pi)).replace("theta[0]", "1"))
+    return eval(exp.replace("pi", repr(np.pi)).replace("theta[0]", "1"))
 
 
 def test_params_pi_and_precedence():
@@ -1386,11 +1386,11 @@ def test_params_pi_and_precedence():
     assert _eval_as_np_pi(trivial_pi) == _eval_as_np_pi(exp)
 
     less_trivial_pi = "3 * theta[0] * 2 / (pi)"
-    prog = Program(f"RX({trivial_pi}) 0")
+    prog = Program(f"RX({less_trivial_pi}) 0")
     exp = str(prog[0].params[0])
-    assert _eval_as_np_pi(trivial_pi) == _eval_as_np_pi(exp)
+    assert _eval_as_np_pi(less_trivial_pi) == _eval_as_np_pi(exp)
 
     more_less_trivial_pi = "3 / (theta[0] / (pi + 1)) / pi"
-    prog = Program(f"RX({trivial_pi}) 0")
+    prog = Program(f"RX({more_less_trivial_pi}) 0")
     exp = str(prog[0].params[0])
-    assert _eval_as_np_pi(trivial_pi) == _eval_as_np_pi(exp)
+    assert _eval_as_np_pi(more_less_trivial_pi) == _eval_as_np_pi(exp)
diff --git a/pyquil/tests/test_qvm.py b/pyquil/tests/test_qvm.py
--- a/pyquil/tests/test_qvm.py
+++ b/pyquil/tests/test_qvm.py
@@ -1,13 +1,11 @@
-import networkx as nx
 import numpy as np
 import pytest
 
 from rpcq.messages import PyQuilExecutableResponse
 
 from pyquil import Program
-from pyquil.api import QVM, ForestConnection, QVMCompiler
+from pyquil.api import ForestConnection, QVM
 from pyquil.api._compiler import _extract_program_from_pyquil_executable_response
-from pyquil.device import NxDevice
 from pyquil.gates import MEASURE, X, CNOT, H
 from pyquil.quilbase import Declare, MemoryReference
 
diff --git a/pyquil/tests/test_reference_density_simulator.py b/pyquil/tests/test_reference_density_simulator.py
--- a/pyquil/tests/test_reference_density_simulator.py
+++ b/pyquil/tests/test_reference_density_simulator.py
@@ -4,7 +4,7 @@
 
 import pyquil.gate_matrices as qmats
 from pyquil import Program
-from pyquil.gates import *
+from pyquil.gates import CNOT, H, I, MEASURE, PHASE, RX, RY, RZ, X
 from pyquil.pyqvm import PyQVM
 from pyquil.reference_simulator import ReferenceDensitySimulator, _is_valid_quantum_state
 from pyquil.unitary_tools import lifted_gate_matrix
diff --git a/pyquil/tests/test_reference_wavefunction_simulator.py b/pyquil/tests/test_reference_wavefunction_simulator.py
--- a/pyquil/tests/test_reference_wavefunction_simulator.py
+++ b/pyquil/tests/test_reference_wavefunction_simulator.py
@@ -922,7 +922,7 @@ def include_measures(request):
 
 
 def test_vs_lisp_qvm(qvm, n_qubits, prog_length):
-    for repeat_i in range(10):
+    for _ in range(10):
         prog = _generate_random_program(n_qubits=n_qubits, length=prog_length)
         lisp_wf = WavefunctionSimulator()
         # force lisp wfs to allocate all qubits
@@ -960,7 +960,7 @@ def _generate_random_pauli(n_qubits, n_terms):
 
 
 def test_expectation_vs_lisp_qvm(qvm, n_qubits):
-    for repeat_i in range(20):
+    for _ in range(20):
         prog = _generate_random_program(n_qubits=n_qubits, length=10)
         operator = _generate_random_pauli(n_qubits=n_qubits, n_terms=5)
         lisp_wf = WavefunctionSimulator()
diff --git a/pyquil/tests/test_unitary_tools.py b/pyquil/tests/test_unitary_tools.py
--- a/pyquil/tests/test_unitary_tools.py
+++ b/pyquil/tests/test_unitary_tools.py
@@ -3,7 +3,7 @@
 
 from pyquil import Program
 from pyquil import gate_matrices as mat
-from pyquil.gates import *
+from pyquil.gates import CCNOT, CNOT, CZ, H, MEASURE, PHASE, RX, RY, RZ, X, Y, Z
 from pyquil.experiment import plusX, minusZ
 from pyquil.paulis import sX, sY, sZ
 from pyquil.unitary_tools import (