Skip to content

Commit 07d6d87

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix-linter-pyteststyle
2 parents faf8502 + 846ddbf commit 07d6d87

File tree

126 files changed

+375
-976
lines changed

Some content is hidden

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

126 files changed

+375
-976
lines changed

newrelic/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
THIS_DIR = os.path.dirname(__file__)
1818

1919
try:
20-
with open(os.path.join(THIS_DIR, "version.txt"), "r") as f:
20+
with open(os.path.join(THIS_DIR, "version.txt")) as f:
2121
version = f.read()
2222
except:
2323
version = "0.0.0"

newrelic/admin/generate_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def generate_config(args):
3232

3333
config_file = os.path.join(package_root, "newrelic.ini")
3434

35-
content = open(config_file, "r").read()
35+
with open(config_file) as f:
36+
content = f.read()
3637

3738
if len(args) >= 1:
3839
content = content.replace("*** REPLACE ME ***", args[0])

newrelic/api/asgi_application.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def __init__(self, application, scope, receive, send, source=None):
209209
request_path = scope["path"]
210210
query_string = scope["query_string"]
211211
headers = scope["headers"] = tuple(scope["headers"])
212-
super(ASGIWebTransaction, self).__init__(
212+
super().__init__(
213213
application=application,
214214
name=None,
215215
scheme=scheme,

newrelic/api/background_task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class BackgroundTask(Transaction):
2525
def __init__(self, application, name, group=None, source=None):
2626
# Initialise the common transaction base class.
2727

28-
super(BackgroundTask, self).__init__(application, source=source)
28+
super().__init__(application, source=source)
2929

3030
# Mark this as a background task even if disabled.
3131

newrelic/api/cat_header_mixin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class CatHeaderMixin:
3434
settings = None
3535

3636
def __enter__(self):
37-
result = super(CatHeaderMixin, self).__enter__()
37+
result = super().__enter__()
3838
if result is self and self.transaction:
3939
self.settings = self.transaction.settings or None
4040
return result

newrelic/api/database_trace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def __init__(
6969
if kwargs:
7070
raise TypeError("Invalid keyword arguments:", kwargs)
7171

72-
super(DatabaseTrace, self).__init__(parent=parent, source=source)
72+
super().__init__(parent=parent, source=source)
7373

7474
self.sql = sql
7575

@@ -84,7 +84,7 @@ def __init__(
8484
self.database_name = database_name
8585

8686
def __enter__(self):
87-
result = super(DatabaseTrace, self).__enter__()
87+
result = super().__enter__()
8888
if result and self.transaction:
8989
self.sql = self.transaction._intern_string(self.sql)
9090
return result

newrelic/api/datastore_trace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def __init__(self, product, target, operation, host=None, port_path_or_id=None,
6161
if kwargs:
6262
raise TypeError("Invalid keyword arguments:", kwargs)
6363

64-
super(DatastoreTrace, self).__init__(parent=parent, source=source)
64+
super().__init__(parent=parent, source=source)
6565

6666
self.instance_reporting_enabled = False
6767
self.database_name_enabled = False
@@ -75,7 +75,7 @@ def __init__(self, product, target, operation, host=None, port_path_or_id=None,
7575
self.database_name = database_name
7676

7777
def __enter__(self):
78-
result = super(DatastoreTrace, self).__enter__()
78+
result = super().__enter__()
7979
if result and self.transaction:
8080
transaction = self.transaction
8181

newrelic/api/external_trace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self, library, url, method=None, **kwargs):
2828
if kwargs:
2929
raise TypeError("Invalid keyword arguments:", kwargs)
3030

31-
super(ExternalTrace, self).__init__(parent=parent, source=source)
31+
super().__init__(parent=parent, source=source)
3232

3333
self.library = library
3434
self.url = url

newrelic/api/function_trace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self, name, group=None, label=None, params=None, terminal=False, ro
2828
if kwargs:
2929
raise TypeError("Invalid keyword arguments:", kwargs)
3030

31-
super(FunctionTrace, self).__init__(parent=parent, source=source)
31+
super().__init__(parent=parent, source=source)
3232

3333
# Handle incorrect groupings and leading slashes. This will
3434
# cause an empty segment which we want to avoid. In that case

newrelic/api/graphql_trace.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self, **kwargs):
2828
if kwargs:
2929
raise TypeError("Invalid keyword arguments:", kwargs)
3030

31-
super(GraphQLOperationTrace, self).__init__(parent=parent, source=source)
31+
super().__init__(parent=parent, source=source)
3232

3333
self.operation_name = "<anonymous>"
3434
self.operation_type = "<unknown>"
@@ -70,7 +70,7 @@ def finalize_data(self, transaction, exc=None, value=None, tb=None):
7070
self.graphql = graphql = self.formatted[:limit]
7171
self._add_agent_attribute("graphql.operation.query", graphql)
7272

73-
return super(GraphQLOperationTrace, self).finalize_data(transaction, exc=None, value=None, tb=None)
73+
return super().finalize_data(transaction, exc=None, value=None, tb=None)
7474

7575
def create_node(self):
7676
return GraphQLOperationNode(
@@ -136,7 +136,7 @@ def __init__(self, field_name=None, field_parent_type=None, field_return_type=No
136136
if kwargs:
137137
raise TypeError("Invalid keyword arguments:", kwargs)
138138

139-
super(GraphQLResolverTrace, self).__init__(parent=parent, source=source)
139+
super().__init__(parent=parent, source=source)
140140

141141
self.field_name = field_name
142142
self.field_parent_type = field_parent_type
@@ -148,7 +148,7 @@ def __repr__(self):
148148
return f"<{self.__class__.__name__} object at 0x{id(self):x} { {'field_name': self.field_name} }>"
149149

150150
def __enter__(self):
151-
super(GraphQLResolverTrace, self).__enter__()
151+
super().__enter__()
152152
_ = self.product # Cache product value
153153
return self
154154

@@ -173,7 +173,7 @@ def finalize_data(self, *args, **kwargs):
173173
self._add_agent_attribute("graphql.field.returnType", self.field_return_type)
174174
self._add_agent_attribute("graphql.field.path", self.field_path)
175175

176-
return super(GraphQLResolverTrace, self).finalize_data(*args, **kwargs)
176+
return super().finalize_data(*args, **kwargs)
177177

178178
def create_node(self):
179179
return GraphQLResolverNode(

0 commit comments

Comments
 (0)