Skip to content

Commit 807ec1c

Browse files
committed
Fix more pylint errors
1 parent 8690fe3 commit 807ec1c

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

newrelic/admin/validate_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def validate_config(args):
212212

213213
if not _application.active:
214214
_logger.error(
215-
"Unable to register application for test, " "connection could not be established within %s seconds.",
215+
"Unable to register application for test, connection could not be established within %s seconds.",
216216
_timeout,
217217
)
218218
return

newrelic/api/transaction.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from collections import OrderedDict
2727

2828
import newrelic.core.database_node
29-
import newrelic.core.error_node
3029
import newrelic.core.root_node
3130
import newrelic.core.transaction_node
3231
from newrelic.api.application import application_instance
@@ -61,6 +60,7 @@
6160
)
6261
from newrelic.core.config import DEFAULT_RESERVOIR_SIZE, LOG_EVENT_RESERVOIR_SIZE
6362
from newrelic.core.custom_event import create_custom_event
63+
from newrelic.core.error_node import ErrorNode
6464
from newrelic.core.log_event_node import LogEventNode
6565
from newrelic.core.stack_trace import exception_stack
6666
from newrelic.core.stats_engine import CustomMetrics, SampledDataSet
@@ -1558,7 +1558,7 @@ def _create_error_node(self, settings, fullname, message, expected, custom_param
15581558
if error.type == fullname and error.message == message:
15591559
return
15601560

1561-
node = newrelic.core.error_node.ErrorNode(
1561+
node = ErrorNode(
15621562
timestamp=time.time(),
15631563
type=fullname,
15641564
message=message,
@@ -1609,7 +1609,8 @@ def _process_node(self, node):
16091609
node.node_count = self._trace_node_count
16101610
self.total_time += node.exclusive
16111611

1612-
if type(node) is newrelic.core.database_node.DatabaseNode:
1612+
# if type(node) is newrelic.core.database_node.DatabaseNode:
1613+
if isinstance(newrelic.core.database_node.DatabaseNode, ErrorNode):
16131614
settings = self._settings
16141615
if not settings:
16151616
return
@@ -1675,15 +1676,15 @@ def add_custom_attributes(self, items):
16751676
def add_custom_parameter(self, name, value):
16761677
# Deprecation warning
16771678
warnings.warn(
1678-
("The add_custom_parameter API has been deprecated. " "Please use the add_custom_attribute API."),
1679+
("The add_custom_parameter API has been deprecated. Please use the add_custom_attribute API."),
16791680
DeprecationWarning,
16801681
)
16811682
return self.add_custom_attribute(name, value)
16821683

16831684
def add_custom_parameters(self, items):
16841685
# Deprecation warning
16851686
warnings.warn(
1686-
("The add_custom_parameters API has been deprecated. " "Please use the add_custom_attributes API."),
1687+
("The add_custom_parameters API has been deprecated. Please use the add_custom_attributes API."),
16871688
DeprecationWarning,
16881689
)
16891690
return self.add_custom_attributes(items)
@@ -1779,7 +1780,7 @@ def add_custom_attributes(items):
17791780
def add_custom_parameter(key, value):
17801781
# Deprecation warning
17811782
warnings.warn(
1782-
("The add_custom_parameter API has been deprecated. " "Please use the add_custom_attribute API."),
1783+
("The add_custom_parameter API has been deprecated. Please use the add_custom_attribute API."),
17831784
DeprecationWarning,
17841785
)
17851786
return add_custom_attribute(key, value)
@@ -1788,7 +1789,7 @@ def add_custom_parameter(key, value):
17881789
def add_custom_parameters(items):
17891790
# Deprecation warning
17901791
warnings.warn(
1791-
("The add_custom_parameter API has been deprecated. " "Please use the add_custom_attribute API."),
1792+
("The add_custom_parameter API has been deprecated. Please use the add_custom_attribute API."),
17921793
DeprecationWarning,
17931794
)
17941795
return add_custom_attributes(items)

newrelic/core/attribute.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -243,19 +243,19 @@ def process_user_attribute(name, value, max_length=MAX_ATTRIBUTE_LENGTH, ending=
243243
value = sanitize(value)
244244

245245
except NameIsNotStringException:
246-
_logger.debug("Attribute name must be a string. Dropping " "attribute: %r=%r", name, value)
246+
_logger.debug("Attribute name must be a string. Dropping attribute: %r=%r", name, value)
247247
return FAILED_RESULT
248248

249249
except NameTooLongException:
250-
_logger.debug("Attribute name exceeds maximum length. Dropping " "attribute: %r=%r", name, value)
250+
_logger.debug("Attribute name exceeds maximum length. Dropping attribute: %r=%r", name, value)
251251
return FAILED_RESULT
252252

253253
except IntTooLargeException:
254-
_logger.debug("Attribute value exceeds maximum integer value. " "Dropping attribute: %r=%r", name, value)
254+
_logger.debug("Attribute value exceeds maximum integer value. Dropping attribute: %r=%r", name, value)
255255
return FAILED_RESULT
256256

257257
except CastingFailureException:
258-
_logger.debug("Attribute value cannot be cast to a string. " "Dropping attribute: %r=%r", name, value)
258+
_logger.debug("Attribute value cannot be cast to a string. Dropping attribute: %r=%r", name, value)
259259
return FAILED_RESULT
260260

261261
else:
@@ -268,7 +268,7 @@ def process_user_attribute(name, value, max_length=MAX_ATTRIBUTE_LENGTH, ending=
268268
trunc_value = truncate(value, maxsize=max_length, ending=ending)
269269
if value != trunc_value:
270270
_logger.debug(
271-
"Attribute value exceeds maximum length " "(%r bytes). Truncating value: %r=%r.",
271+
"Attribute value exceeds maximum length (%r bytes). Truncating value: %r=%r.",
272272
max_length,
273273
name,
274274
trunc_value,
@@ -296,8 +296,6 @@ def sanitize(value):
296296
except Exception:
297297
raise CastingFailureException()
298298
else:
299-
_logger.debug(
300-
"Attribute value is of type: %r. Casting %r to " "string: %s", type(original), original, value
301-
)
299+
_logger.debug("Attribute value is of type: %r. Casting %r to string: %s", type(original), original, value)
302300

303301
return value

tests/agent_features/test_span_events.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,11 @@ def _test():
413413
@pytest.mark.parametrize("span_events_enabled", (False, True))
414414
def test_collect_span_events_override(collect_span_events, span_events_enabled):
415415

416-
if collect_span_events and span_events_enabled:
417-
spans_expected = True
418-
else:
419-
spans_expected = False
416+
# if collect_span_events and span_events_enabled:
417+
# spans_expected = True
418+
# else:
419+
# spans_expected = False
420+
spans_expected = collect_span_events and span_events_enabled
420421

421422
span_count = 2 if spans_expected else 0
422423

tests/testing_support/sample_asgi_applications.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async def __call__(self, receive, send):
3434

3535
if self.scope["path"] == "/exc":
3636
raise ValueError("whoopsies")
37-
elif self.scope["path"] == "/ignored":
37+
if self.scope["path"] == "/ignored":
3838
ignore_transaction()
3939

4040
await send({"type": "http.response.start", "status": 200})
@@ -57,7 +57,7 @@ async def simple_app_v3_raw(scope, receive, send):
5757

5858
if scope["path"] == "/exc":
5959
raise ValueError("whoopsies")
60-
elif scope["path"] == "/ignored":
60+
if scope["path"] == "/ignored":
6161
ignore_transaction()
6262

6363
await send({"type": "http.response.start", "status": 200})

0 commit comments

Comments
 (0)