Skip to content

Commit

Permalink
Switch type hints to strings for 3.4 (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
c24t committed Jun 25, 2019
1 parent 5d1632a commit 132ef43
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions opentelemetry-api/opentelemetry/trace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
.. versionadded:: 0.1.0
"""

from __future__ import annotations

from contextlib import contextmanager
from typing import Iterator

Expand All @@ -75,7 +73,7 @@ class Tracer:
and controlling spans' lifecycles.
"""

def get_current_span(self) -> Span:
def get_current_span(self) -> 'Span':
"""Gets the currently active span from the context.
If there is no current span, return a placeholder span with an invalid
Expand All @@ -88,7 +86,7 @@ def get_current_span(self) -> Span:


@contextmanager
def start_span(self, name: str, parent: Span) -> Iterator[Span]:
def start_span(self, name: str, parent: 'Span') -> Iterator['Span']:
"""Context manager for span creation.
Create a new child of the current span, or create a root span if no
Expand Down Expand Up @@ -129,7 +127,7 @@ def start_span(self, name: str, parent: Span) -> Iterator[Span]:
The newly-created span.
"""

def create_span(self, name: str, parent: Span) -> Span:
def create_span(self, name: str, parent: 'Span') -> 'Span':
"""Creates a new child span of the given parent.
Creating the span does not start it, and should not affect the tracer's
Expand Down Expand Up @@ -157,7 +155,7 @@ def create_span(self, name: str, parent: Span) -> Span:
"""

@contextmanager
def use_span(self, span: Span) -> Iterator[None]:
def use_span(self, span: 'Span') -> Iterator[None]:
"""Context manager for controlling a span's lifetime.
Start the given span and set it as the current span in this tracer's
Expand Down Expand Up @@ -193,7 +191,7 @@ def end(self) -> None:
implementations are free to ignore or raise on further calls.
"""

def get_context(self) -> SpanContext:
def get_context(self) -> 'SpanContext':
"""Gets the span's SpanContext.
Get an immutable, serializable identifier for this span that can be
Expand All @@ -220,8 +218,8 @@ class SpanContext:
def __init__(self,
trace_id: str,
span_id: str,
options: TraceOptions,
state: TraceState) -> None:
options: 'TraceOptions',
state: 'TraceState') -> None:
pass


Expand Down

0 comments on commit 132ef43

Please sign in to comment.