Skip to content

Commit 3e6133d

Browse files
authored
Merge pull request #1353 from newrelic/fix-linter-flake8-comprehensions
Enable flake8-comprehensions
2 parents a7fb3af + bd62da0 commit 3e6133d

File tree

67 files changed

+227
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+227
-225
lines changed

newrelic/admin/validate_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def validate_config(args):
187187
_settings.debug.log_data_collector_payloads = True
188188
_settings.debug.log_transaction_trace_payload = True
189189

190-
print(_user_message % dict(app_name=app_name, log_file=log_file))
190+
print(_user_message % {"app_name": app_name, "log_file": log_file})
191191

192192
_logger.debug("Register test application.")
193193

newrelic/api/database_trace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __enter__(self):
9090
return result
9191

9292
def __repr__(self):
93-
return f"<{self.__class__.__name__} object at 0x{id(self):x} {dict(sql=self.sql, dbapi2_module=self.dbapi2_module)}>"
93+
return f"<{self.__class__.__name__} object at 0x{id(self):x} { {'sql': self.sql, 'dbapi2_module': self.dbapi2_module} }>"
9494

9595
@property
9696
def is_async_mode(self):

newrelic/api/datastore_trace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def __enter__(self):
9292
return result
9393

9494
def __repr__(self):
95-
return f"<{self.__class__.__name__} object at 0x{id(self):x} {dict(product=self.product, target=self.target, operation=self.operation, host=self.host, port_path_or_id=self.port_path_or_id, database_name=self.database_name)}>"
95+
return f"<{self.__class__.__name__} object at 0x{id(self):x} { {'product': self.product, 'target': self.target, 'operation': self.operation, 'host': self.host, 'port_path_or_id': self.port_path_or_id, 'database_name': self.database_name} }>"
9696

9797
def finalize_data(self, transaction, exc=None, value=None, tb=None):
9898
if not self.instance_reporting_enabled:

newrelic/api/external_trace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(self, library, url, method=None, **kwargs):
3636
self.params = {}
3737

3838
def __repr__(self):
39-
return f"<{self.__class__.__name__} object at 0x{id(self):x} {dict(library=self.library, url=self.url, method=self.method)}>"
39+
return f"<{self.__class__.__name__} object at 0x{id(self):x} { {'library': self.library, 'url': self.url, 'method': self.method} }>"
4040

4141
def process_response(self, status_code, headers):
4242
self._add_agent_attribute("http.statusCode", status_code)

newrelic/api/function_trace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __enter__(self):
5555
return result
5656

5757
def __repr__(self):
58-
return f"<{self.__class__.__name__} object at 0x{id(self):x} {dict(name=self.name, group=self.group, label=self.label, params=self.params, terminal=self.terminal, rollup=self.rollup)}>"
58+
return f"<{self.__class__.__name__} object at 0x{id(self):x} { {'name': self.name, 'group': self.group, 'label': self.label, 'params': self.params, 'terminal': self.terminal, 'rollup': self.rollup} }>"
5959

6060
def terminal_node(self):
6161
return self.terminal

newrelic/api/graphql_trace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(self, **kwargs):
3939
self.product = "GraphQL"
4040

4141
def __repr__(self):
42-
return f"<{self.__class__.__name__} object at 0x{id(self):x} {dict(operation_name=self.operation_name, operation_type=self.operation_type, deepest_path=self.deepest_path, graphql=self.graphql)}>"
42+
return f"<{self.__class__.__name__} object at 0x{id(self):x} { {'operation_name': self.operation_name, 'operation_type': self.operation_type, 'deepest_path': self.deepest_path, 'graphql': self.graphql} }>"
4343

4444
@property
4545
def formatted(self):
@@ -145,7 +145,7 @@ def __init__(self, field_name=None, field_parent_type=None, field_return_type=No
145145
self._product = None
146146

147147
def __repr__(self):
148-
return f"<{self.__class__.__name__} object at 0x{id(self):x} {dict(field_name=self.field_name)}>"
148+
return f"<{self.__class__.__name__} object at 0x{id(self):x} { {'field_name': self.field_name} }>"
149149

150150
def __enter__(self):
151151
super(GraphQLResolverTrace, self).__enter__()

newrelic/api/log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def format(self, record):
131131

132132

133133
class NewRelicLogForwardingHandler(logging.Handler):
134-
IGNORED_LOG_RECORD_KEYS = set(["message", "msg"])
134+
IGNORED_LOG_RECORD_KEYS = {"message", "msg"}
135135

136136
def emit(self, record):
137137
try:

newrelic/api/memcache_trace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, command, **kwargs):
3232
self.command = command
3333

3434
def __repr__(self):
35-
return f"<{self.__class__.__name__} object at 0x{id(self):x} {dict(command=self.command)}>"
35+
return f"<{self.__class__.__name__} object at 0x{id(self):x} { {'command': self.command} }>"
3636

3737
def terminal_node(self):
3838
return True

newrelic/api/message_trace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __enter__(self):
6464
return result
6565

6666
def __repr__(self):
67-
return f"<{self.__class__.__name__} object at 0x{id(self):x} {dict(library=self.library, operation=self.operation)}>"
67+
return f"<{self.__class__.__name__} object at 0x{id(self):x} { {'library': self.library, 'operation': self.operation} }>"
6868

6969
def terminal_node(self):
7070
return self.terminal

newrelic/api/solr_trace.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ def __init__(self, library, command, **kwargs):
3131
self.command = command
3232

3333
def __repr__(self):
34-
return (
35-
f"<{self.__class__.__name__} object at 0x{id(self):x} {dict(library=self.library, command=self.command)}>"
36-
)
34+
return f"<{self.__class__.__name__} object at 0x{id(self):x} { {'library': self.library, 'command': self.command} }>"
3735

3836
def terminal_node(self):
3937
return True

0 commit comments

Comments
 (0)