Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
asasvari committed Jul 14, 2024
1 parent 4b1a16a commit 33e35c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 4 additions & 5 deletions opentelemetry-api/src/opentelemetry/attributes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,8 @@ def __init__(
self.dropped = 0
self.max_value_len = max_value_len
# OrderedDict is not used until the maxlen is reached for efficiency.
# self._dict type: dict | OrderedDict

self._dict = {} # type: ignore
self._dict: dict | OrderedDict = {}
self._lock = threading.RLock()
if attributes:
for key, value in attributes.items():
Expand Down Expand Up @@ -185,7 +184,7 @@ def __setitem__(self, key, value): # type: ignore

self._dict[key] = value # type: ignore

def __delitem__(self, key): # type: ignore
def __delitem__(self, key) -> None:
if getattr(self, "_immutable", False): # type: ignore
raise TypeError
with self._lock:
Expand All @@ -195,8 +194,8 @@ def __iter__(self): # type: ignore
with self._lock:
return iter(self._dict.copy()) # type: ignore

def __len__(self): # type: ignore
return len(self._dict) # type: ignore
def __len__(self) -> int:
return len(self._dict)

def copy(self): # type: ignore
return self._dict.copy() # type: ignore
6 changes: 3 additions & 3 deletions opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
psutil: Optional[ModuleType] = None

try:
import psutil as pustil_module
import psutil as psutil_module

pustil = pustil_module
pustil = psutil_module
except ImportError:
pass

Expand Down Expand Up @@ -373,7 +373,7 @@ def detect(self) -> "Resource":
resource_info[PROCESS_PARENT_PID] = os.getppid()

if psutil is not None:
process: pustil_module.Process = psutil.Process()
process: psutil_module.Process = psutil.Process()
username = process.username()
resource_info[PROCESS_OWNER] = username

Expand Down

0 comments on commit 33e35c2

Please sign in to comment.