Skip to content

Commit

Permalink
fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
asasvari committed Jul 23, 2024
1 parent fb47e31 commit bbbb7aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@

# FIXME: Use importlib.metadata when support for 3.11 is dropped if the rest of
# the supported versions at that time have the same API.
from importlib_metadata import (
EntryPoint,
EntryPoints,
entry_points,
version,
)
from importlib_metadata import EntryPoint, EntryPoints, entry_points, version

# The importlib-metadata library has introduced breaking changes before to its
# API, this module is kept just to act as a layer between the
Expand Down
17 changes: 10 additions & 7 deletions opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
from json import dumps
from os import environ
from types import ModuleType
from typing import List, MutableMapping, Optional, Sequence, Union, cast
from typing import List, MutableMapping, Optional, cast
from urllib import parse

from opentelemetry.attributes import BoundedAttributes
Expand Down Expand Up @@ -211,9 +211,10 @@ def create(

if not resource.attributes.get(SERVICE_NAME, None):
default_service_name = "unknown_service"
process_executable_name = cast(Optional[str], resource.attributes.get(
PROCESS_EXECUTABLE_NAME, None
))
process_executable_name = cast(
Optional[str],
resource.attributes.get(PROCESS_EXECUTABLE_NAME, None),
)
if process_executable_name:
default_service_name += ":" + process_executable_name
resource = resource.merge(
Expand Down Expand Up @@ -266,7 +267,7 @@ def merge(self, other: "Resource") -> "Resource":
other.schema_url,
)
return self
return Resource(merged_attributes, schema_url) # type: ignore
return Resource(merged_attributes, schema_url) # type: ignore

def __eq__(self, other: object) -> bool:
if not isinstance(other, Resource):
Expand All @@ -278,11 +279,13 @@ def __eq__(self, other: object) -> bool:

def __hash__(self) -> int:
return hash(
f"{dumps(self._attributes.copy(), sort_keys=True)}|{self._schema_url}" # type: ignore
f"{dumps(self._attributes.copy(), sort_keys=True)}|{self._schema_url}" # type: ignore
)

def to_json(self, indent: int = 4) -> str:
attributes: MutableMapping[str, AttributeValue] = dict(self._attributes)
attributes: MutableMapping[str, AttributeValue] = dict(
self._attributes
)
return dumps(
{
"attributes": attributes, # type: ignore
Expand Down

0 comments on commit bbbb7aa

Please sign in to comment.