| 
76 | 76 | ---  | 
77 | 77 | """  | 
78 | 78 | 
 
  | 
 | 79 | +from __future__ import annotations  | 
 | 80 | + | 
79 | 81 | import gc  | 
80 | 82 | import logging  | 
81 | 83 | import os  | 
82 | 84 | import sys  | 
83 | 85 | import threading  | 
84 | 86 | from platform import python_implementation  | 
85 |  | -from typing import Collection, Dict, Iterable, List, Optional  | 
 | 87 | +from typing import Any, Collection, Iterable  | 
86 | 88 | 
 
  | 
87 | 89 | import psutil  | 
88 | 90 | 
 
  | 
89 |  | -# FIXME Remove this pylint disabling line when Github issue is cleared  | 
90 |  | -# pylint: disable=no-name-in-module  | 
91 | 91 | from opentelemetry.instrumentation.instrumentor import BaseInstrumentor  | 
92 | 92 | from opentelemetry.instrumentation.system_metrics.package import _instruments  | 
93 | 93 | from opentelemetry.instrumentation.system_metrics.version import __version__  | 
 | 
96 | 96 | _logger = logging.getLogger(__name__)  | 
97 | 97 | 
 
  | 
98 | 98 | 
 
  | 
99 |  | -_DEFAULT_CONFIG = {  | 
 | 99 | +_DEFAULT_CONFIG: dict[str, list[str] | None] = {  | 
100 | 100 |     "system.cpu.time": ["idle", "user", "system", "irq"],  | 
101 | 101 |     "system.cpu.utilization": ["idle", "user", "system", "irq"],  | 
102 | 102 |     "system.memory.usage": ["used", "free", "cached"],  | 
 | 
129 | 129 | class SystemMetricsInstrumentor(BaseInstrumentor):  | 
130 | 130 |     def __init__(  | 
131 | 131 |         self,  | 
132 |  | -        labels: Optional[Dict[str, str]] = None,  | 
133 |  | -        config: Optional[Dict[str, List[str]]] = None,  | 
 | 132 | +        labels: dict[str, str] | None = None,  | 
 | 133 | +        config: dict[str, list[str] | None] | None = None,  | 
134 | 134 |     ):  | 
135 | 135 |         super().__init__()  | 
136 | 136 |         if config is None:  | 
@@ -176,7 +176,7 @@ def __init__(  | 
176 | 176 |     def instrumentation_dependencies(self) -> Collection[str]:  | 
177 | 177 |         return _instruments  | 
178 | 178 | 
 
  | 
179 |  | -    def _instrument(self, **kwargs):  | 
 | 179 | +    def _instrument(self, **kwargs: Any):  | 
180 | 180 |         # pylint: disable=too-many-branches  | 
181 | 181 |         meter_provider = kwargs.get("meter_provider")  | 
182 | 182 |         self._meter = get_meter(  | 
@@ -408,7 +408,7 @@ def _instrument(self, **kwargs):  | 
408 | 408 |                 description="Number of file descriptors in use by the process.",  | 
409 | 409 |             )  | 
410 | 410 | 
 
  | 
411 |  | -    def _uninstrument(self, **__):  | 
 | 411 | +    def _uninstrument(self, **kwargs: Any):  | 
412 | 412 |         pass  | 
413 | 413 | 
 
  | 
414 | 414 |     def _get_open_file_descriptors(  | 
 | 
0 commit comments