Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add attribute check #1311

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion newrelic/samplers/gc_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2010 New Relic, Inc.

Check failure on line 1 in newrelic/samplers/gc_data.py

View workflow job for this annotation

GitHub Actions / Mega-Linter

Ruff (D100)

newrelic/samplers/gc_data.py:1:1: D100 Missing docstring in public module
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -26,19 +26,22 @@

@data_source_factory(name="Garbage Collector Metrics")
class _GCDataSource:
def __init__(self, settings, environ):

Check failure on line 29 in newrelic/samplers/gc_data.py

View workflow job for this annotation

GitHub Actions / Mega-Linter

Ruff (ANN204)

newrelic/samplers/gc_data.py:29:9: ANN204 Missing return type annotation for special method `__init__`

Check failure on line 29 in newrelic/samplers/gc_data.py

View workflow job for this annotation

GitHub Actions / Mega-Linter

Ruff (ANN101)

newrelic/samplers/gc_data.py:29:18: ANN101 Missing type annotation for `self` in method

Check failure on line 29 in newrelic/samplers/gc_data.py

View workflow job for this annotation

GitHub Actions / Mega-Linter

Ruff (ANN001)

newrelic/samplers/gc_data.py:29:24: ANN001 Missing type annotation for function argument `settings`

Check failure on line 29 in newrelic/samplers/gc_data.py

View workflow job for this annotation

GitHub Actions / Mega-Linter

Ruff (ARG002)

newrelic/samplers/gc_data.py:29:24: ARG002 Unused method argument: `settings`

Check failure on line 29 in newrelic/samplers/gc_data.py

View workflow job for this annotation

GitHub Actions / Mega-Linter

Ruff (ANN001)

newrelic/samplers/gc_data.py:29:34: ANN001 Missing type annotation for function argument `environ`

Check failure on line 29 in newrelic/samplers/gc_data.py

View workflow job for this annotation

GitHub Actions / Mega-Linter

Ruff (ARG002)

newrelic/samplers/gc_data.py:29:34: ARG002 Unused method argument: `environ`
self.gc_time_metrics = CustomMetrics()
self.start_time = 0.0
self.previous_stats = {}
self.pid = os.getpid()

@property
def enabled(self):

Check failure on line 36 in newrelic/samplers/gc_data.py

View workflow job for this annotation

GitHub Actions / Mega-Linter

Ruff (ANN202)

newrelic/samplers/gc_data.py:36:9: ANN202 Missing return type annotation for private function `enabled`

Check failure on line 36 in newrelic/samplers/gc_data.py

View workflow job for this annotation

GitHub Actions / Mega-Linter

Ruff (ANN101)

newrelic/samplers/gc_data.py:36:17: ANN101 Missing type annotation for `self` in method
settings = global_settings()
if platform.python_implementation() == "PyPy" or not settings:
return False
else:
# This might be inheriting from Settings instead of TopLevelSettings
elif settings and hasattr(settings, "gc_runtime_metrics"):

Check failure on line 41 in newrelic/samplers/gc_data.py

View workflow job for this annotation

GitHub Actions / Mega-Linter

Ruff (RET505)

newrelic/samplers/gc_data.py:41:9: RET505 Unnecessary `elif` after `return` statement
return settings.gc_runtime_metrics.enabled
else:
return False

@property
def top_object_count_limit(self):
Expand Down
Loading