Skip to content

Commit

Permalink
typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaelias committed Dec 18, 2023
1 parent 42e6183 commit 9f00475
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions baseplate/lib/propagator_redditb3.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import logging

from re import compile as re_compile
from typing import Any
from typing import Iterable
from typing import Optional
from typing import Set

from re import compile as re_compile
from typing import Union

from opentelemetry import trace
from opentelemetry.context import Context
Expand Down Expand Up @@ -40,9 +41,9 @@ def extract(
) -> Context:
if context is None:
context = Context()
trace_id: Optional[int] = trace.INVALID_TRACE_ID
span_id: Optional[int] = trace.INVALID_SPAN_ID
sampled: Optional[int] = "0"
trace_id: Union[int, str] = trace.INVALID_TRACE_ID
span_id: Union[int, str] = trace.INVALID_SPAN_ID
sampled: Union[int, str] = "0"
flags: Optional[Iterable[str]] = None

trace_id = _extract_first_element(getter.get(carrier, self.TRACE_ID_KEY), default=trace_id)
Expand Down Expand Up @@ -154,8 +155,8 @@ def fields(self) -> Set[str]:


def _extract_first_element(
items: Iterable[CarrierT],
default: Optional[Any] = None,
items: Optional[Iterable[CarrierT]],
default: Any,
) -> Optional[CarrierT]:
if items is None:
return default
Expand Down

0 comments on commit 9f00475

Please sign in to comment.