Skip to content

Commit dfd95ab

Browse files
Enable pyflakes (#1354)
* Enable Pyflakes * Fix F901 raise-not-implemented * Fix missing early exit in psycopg2 wrappers * Drop unused vars from kombu instrumentation * Remove multiple unused variables from openai instrumentation * Fix F841 unused-variable * Fix F401 unused-import * Fix F821 undefined-name * Fix F541 f-string-missing-placeholders * Remove Py37+ test gating on async generators * Fix F403 undefined-local-with-import-star * Fix F811 redefined-while-unused * Fix naming error in async generator trace tests * Fix monkeypatch setenv with incorrect type --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 612c671 commit dfd95ab

38 files changed

+62
-77
lines changed

newrelic/admin/record_deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import pwd
1717

1818
from newrelic.admin import command, usage
19-
from newrelic.common import agent_http, certs, encoding_utils
19+
from newrelic.common import agent_http, encoding_utils
2020
from newrelic.config import initialize
2121
from newrelic.core.config import global_settings
2222

newrelic/admin/run_python.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from newrelic.admin import command, usage
15+
from newrelic.admin import command
1616

1717

1818
@command(
@@ -62,7 +62,6 @@ def log_message(text, *args):
6262
log_message("%s = %r", name, os.environ.get(name))
6363

6464
from newrelic import __file__ as root_directory
65-
from newrelic import version
6665

6766
root_directory = os.path.dirname(root_directory)
6867
boot_directory = os.path.join(root_directory, "bootstrap")

newrelic/api/in_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
# Use of these from this module will be deprecated.
1616

17-
from newrelic.common.object_wrapper import InFunctionWrapper, in_function, wrap_in_function
17+
from newrelic.common.object_wrapper import InFunctionWrapper, in_function, wrap_in_function # noqa: F401

newrelic/api/object_wrapper.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import sys
16-
1715
# These have been moved. They are retained here until all references to
1816
# them are moved at which point will mark as deprecated to ensure users
1917
# weren't using them directly.
20-
from newrelic.common.object_names import callable_name
21-
from newrelic.common.object_wrapper import ObjectWrapper, wrap_object
18+
from newrelic.common.object_names import callable_name # noqa: F401
19+
from newrelic.common.object_wrapper import ObjectWrapper, wrap_object # noqa: F401
2220

2321
# From Python 3.X. In older Python versions it fails if attributes do
2422
# not exist and don't maintain a __wrapped__ attribute.

newrelic/api/out_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
# Use of these from this module will be deprecated.
1616

17-
from newrelic.common.object_wrapper import OutFunctionWrapper, out_function, wrap_out_function
17+
from newrelic.common.object_wrapper import OutFunctionWrapper, out_function, wrap_out_function # noqa: F401

newrelic/api/post_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
# Use of these from this module will be deprecated.
1616

17-
from newrelic.common.object_wrapper import PostFunctionWrapper, post_function, wrap_post_function
17+
from newrelic.common.object_wrapper import PostFunctionWrapper, post_function, wrap_post_function # noqa: F401

newrelic/api/pre_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
# Use of these from this module will be deprecated.
1616

17-
from newrelic.common.object_wrapper import PreFunctionWrapper, pre_function, wrap_pre_function
17+
from newrelic.common.object_wrapper import PreFunctionWrapper, pre_function, wrap_pre_function # noqa: F401

newrelic/common/async_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ async def wrapper(*args, **kwargs):
6464
while True:
6565
try:
6666
sent = yield yielded
67-
except GeneratorExit as e:
67+
except GeneratorExit:
6868
await g.aclose()
6969
raise
7070
except BaseException as e:

newrelic/common/object_names.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import functools
1919
import inspect
2020
import sys
21-
import types
2221

2322
# Object model terminology for quick reference.
2423
#

newrelic/console.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,6 @@ def do_interpreter(self):
366366
interactive Python interpreter. Invoke 'exit()' or 'quit()' to
367367
escape the interpreter session."""
368368

369-
enabled = False
370-
371369
_settings = global_settings()
372370

373371
if not _settings.console.allow_interpreter_cmd:

0 commit comments

Comments
 (0)