Skip to content

Commit 012f1c4

Browse files
committed
Fix RUF012 mutable-class-default
1 parent 1bc6386 commit 012f1c4

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

newrelic/api/application.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222

2323
class Application:
2424
_lock = threading.Lock()
25-
_instances = {}
25+
_instances = {} # noqa: RUF012
2626

27-
_delayed_callables = {}
27+
_delayed_callables = {} # noqa: RUF012
2828

2929
@staticmethod
3030
def _instance(name, activate=True):

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 = {"message", "msg"}
134+
IGNORED_LOG_RECORD_KEYS = frozenset(("message", "msg"))
135135

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

newrelic/common/agent_http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ class ApplicationModeClient(SupportabilityMixin, HttpClient):
500500

501501

502502
class DeveloperModeClient(SupportabilityMixin, BaseClient):
503-
RESPONSES = {
503+
RESPONSES = { # noqa: RUF012
504504
"preconnect": {"redirect_host": "fake-collector.newrelic.com"},
505505
"agent_settings": [],
506506
"connect": {

newrelic/common/utilization.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class AWSUtilization(CommonUtilization):
158158
METADATA_HOST = "169.254.169.254"
159159
METADATA_PATH = "/latest/dynamic/instance-identity/document"
160160
METADATA_TOKEN_PATH = "/latest/api/token" # noqa: S105
161-
HEADERS = {"X-aws-ec2-metadata-token-ttl-seconds": "21600"}
161+
HEADERS = {"X-aws-ec2-metadata-token-ttl-seconds": "21600"} # noqa: RUF012
162162
VENDOR_NAME = "aws"
163163

164164
@classmethod
@@ -201,18 +201,18 @@ def fetch(cls):
201201
class AzureUtilization(CommonUtilization):
202202
METADATA_HOST = "169.254.169.254"
203203
METADATA_PATH = "/metadata/instance/compute"
204-
METADATA_QUERY = {"api-version": "2017-03-01"}
204+
METADATA_QUERY = {"api-version": "2017-03-01"} # noqa: RUF012
205205
EXPECTED_KEYS = ("location", "name", "vmId", "vmSize")
206-
HEADERS = {"Metadata": "true"}
206+
HEADERS = {"Metadata": "true"} # noqa: RUF012
207207
VENDOR_NAME = "azure"
208208

209209

210210
class GCPUtilization(CommonUtilization):
211211
EXPECTED_KEYS = ("id", "machineType", "name", "zone")
212-
HEADERS = {"Metadata-Flavor": "Google"}
212+
HEADERS = {"Metadata-Flavor": "Google"} # noqa: RUF012
213213
METADATA_HOST = "metadata.google.internal"
214214
METADATA_PATH = "/computeMetadata/v1/instance/"
215-
METADATA_QUERY = {"recursive": "true"}
215+
METADATA_QUERY = {"recursive": "true"} # noqa: RUF012
216216
VENDOR_NAME = "gcp"
217217

218218
@classmethod

newrelic/core/agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ class Agent:
121121

122122
_instance_lock = threading.Lock()
123123
_instance = None
124-
_startup_callables = []
125-
_registration_callables = {}
124+
_startup_callables = [] # noqa: RUF012
125+
_registration_callables = {} # noqa: RUF012
126126

127127
@staticmethod
128128
def run_on_startup(callable): # noqa: A002

newrelic/core/agent_protocol.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
class AgentProtocol:
4848
VERSION = 17
4949

50-
STATUS_CODE_RESPONSE = {
50+
STATUS_CODE_RESPONSE = { # noqa: RUF012
5151
400: DiscardDataForRequest,
5252
401: ForceAgentRestart,
5353
403: DiscardDataForRequest,
@@ -67,7 +67,7 @@ class AgentProtocol:
6767
500: RetryDataForRequest,
6868
503: RetryDataForRequest,
6969
}
70-
LOG_MESSAGES = {
70+
LOG_MESSAGES = { # noqa: RUF012
7171
401: (
7272
logging.ERROR,
7373
(
@@ -144,7 +144,7 @@ class AgentProtocol:
144144
"ai_monitoring.enabled",
145145
)
146146

147-
LOGGER_FUNC_MAPPING = {
147+
LOGGER_FUNC_MAPPING = { # noqa: RUF012
148148
"ERROR": _logger.error,
149149
"WARN": _logger.warning,
150150
"INFO": _logger.info,

newrelic/core/agent_streaming.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class StreamingRpc:
3434
"""
3535

3636
RETRY_POLICY = ((15, False), (15, False), (30, False), (60, False), (120, False), (300, True))
37-
OPTIONS = [("grpc.enable_retries", 0)]
37+
OPTIONS = (("grpc.enable_retries", 0),)
3838

3939
def __init__(self, endpoint, stream_buffer, metadata, record_metric, ssl=True, compression=None):
4040
self._endpoint = endpoint

0 commit comments

Comments
 (0)