diff --git a/dev-requirements.txt b/dev-requirements.txt index 0e63f79d1ae..849dec4e66c 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -pylint==3.0.2 +pylint==3.2.1 flake8==6.1.0 isort==5.12.0 black==24.3.0 diff --git a/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py b/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py index 7e6b2ecc01f..09ca1f901e5 100644 --- a/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py +++ b/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py @@ -209,8 +209,7 @@ def collect(self) -> Iterable[PrometheusMetric]: ) if metric_family_id_metric_family: - for metric_family in metric_family_id_metric_family.values(): - yield metric_family + yield from metric_family_id_metric_family.values() # pylint: disable=too-many-locals,too-many-branches def _translate_to_prometheus( diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py index 2564bbcd7f0..1c94733a3d3 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py @@ -210,6 +210,7 @@ def collect(self) -> Optional[MetricsData]: metrics.append( Metric( # pylint: disable=protected-access + # pylint: disable=possibly-used-before-assignment name=view_instrument_match._name, description=view_instrument_match._description, unit=view_instrument_match._instrument.unit, diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/util/__init__.pyi b/opentelemetry-sdk/src/opentelemetry/sdk/util/__init__.pyi index d42e0f018fa..b09cb9858a9 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/util/__init__.pyi +++ b/opentelemetry-sdk/src/opentelemetry/sdk/util/__init__.pyi @@ -33,6 +33,7 @@ def get_dict_as_key( labels: Mapping[str, AttributeValue] ) -> AttributesAsKey: ... +# pylint: disable=no-self-use class BoundedList(Sequence[_T]): """An append only list with a fixed max size. @@ -51,7 +52,9 @@ class BoundedList(Sequence[_T]): def append(self, item: _T): ... def extend(self, seq: Sequence[_T]): ... @classmethod - def from_seq(cls, maxlen: int, seq: Iterable[_T]) -> BoundedList[_T]: ... + def from_seq( + cls, maxlen: int, seq: Iterable[_T] + ) -> BoundedList[_T]: ... # pylint: disable=undefined-variable class BoundedDict(MutableMapping[_KT, _VT]): """An ordered dict with a fixed max capacity. @@ -70,4 +73,4 @@ class BoundedDict(MutableMapping[_KT, _VT]): @classmethod def from_map( cls, maxlen: int, mapping: Mapping[_KT, _VT] - ) -> BoundedDict[_KT, _VT]: ... + ) -> BoundedDict[_KT, _VT]: ... # pylint: disable=undefined-variable diff --git a/opentelemetry-sdk/tests/metrics/exponential_histogram/test_exponent_mapping.py b/opentelemetry-sdk/tests/metrics/exponential_histogram/test_exponent_mapping.py index cfd33ef4a15..e3fd6ae4448 100644 --- a/opentelemetry-sdk/tests/metrics/exponential_histogram/test_exponent_mapping.py +++ b/opentelemetry-sdk/tests/metrics/exponential_histogram/test_exponent_mapping.py @@ -389,7 +389,9 @@ def test_exponent_index_min(self): self.assertEqual( exponent_mapping.map_to_index( - nextafter(MIN_NORMAL_VALUE, inf) + nextafter( # pylint: disable=possibly-used-before-assignment + MIN_NORMAL_VALUE, inf + ) ), MIN_NORMAL_EXPONENT >> -scale, ) diff --git a/opentelemetry-sdk/tests/test_util.py b/opentelemetry-sdk/tests/test_util.py index 00099090cdc..db6d3b57873 100644 --- a/opentelemetry-sdk/tests/test_util.py +++ b/opentelemetry-sdk/tests/test_util.py @@ -17,6 +17,7 @@ from opentelemetry.sdk.util import BoundedList +# pylint: disable=unsubscriptable-object class TestBoundedList(unittest.TestCase): base = [52, 36, 53, 29, 54, 99, 56, 48, 22, 35, 21, 65, 10, 95, 42, 60]