@@ -219,7 +219,7 @@ def _submit_and_await(
219
219
self ,
220
220
func : Callable [[SpanProcessor ], Callable [..., None ]],
221
221
* args : Any ,
222
- ** kwargs : Any
222
+ ** kwargs : Any ,
223
223
):
224
224
futures = []
225
225
for sp in self ._span_processors :
@@ -442,12 +442,10 @@ def to_json(self, indent=4):
442
442
if self .parent is not None :
443
443
if isinstance (self .parent , Span ):
444
444
ctx = self .parent .context
445
- parent_id = "0x{}" .format (
446
- trace_api .format_span_id (ctx .span_id )
447
- )
445
+ parent_id = f"0x{ trace_api .format_span_id (ctx .span_id )} "
448
446
elif isinstance (self .parent , SpanContext ):
449
- parent_id = "0x{}" . format (
450
- trace_api .format_span_id (self .parent .span_id )
447
+ parent_id = (
448
+ f"0x { trace_api .format_span_id (self .parent .span_id )} "
451
449
)
452
450
453
451
start_time = None
@@ -484,12 +482,8 @@ def to_json(self, indent=4):
484
482
@staticmethod
485
483
def _format_context (context ):
486
484
x_ctx = OrderedDict ()
487
- x_ctx ["trace_id" ] = "0x{}" .format (
488
- trace_api .format_trace_id (context .trace_id )
489
- )
490
- x_ctx ["span_id" ] = "0x{}" .format (
491
- trace_api .format_span_id (context .span_id )
492
- )
485
+ x_ctx ["trace_id" ] = f"0x{ trace_api .format_trace_id (context .trace_id )} "
486
+ x_ctx ["span_id" ] = f"0x{ trace_api .format_span_id (context .span_id )} "
493
487
x_ctx ["trace_state" ] = repr (context .trace_state )
494
488
return x_ctx
495
489
@@ -612,16 +606,7 @@ def __init__(
612
606
)
613
607
614
608
def __repr__ (self ):
615
- return "{}(max_span_attributes={}, max_events_attributes={}, max_link_attributes={}, max_attributes={}, max_events={}, max_links={}, max_attribute_length={})" .format (
616
- type (self ).__name__ ,
617
- self .max_span_attribute_length ,
618
- self .max_event_attributes ,
619
- self .max_link_attributes ,
620
- self .max_attributes ,
621
- self .max_events ,
622
- self .max_links ,
623
- self .max_attribute_length ,
624
- )
609
+ return f"{ type (self ).__name__ } (max_span_attributes={ self .max_span_attribute_length } , max_events_attributes={ self .max_event_attributes } , max_link_attributes={ self .max_link_attributes } , max_attributes={ self .max_attributes } , max_events={ self .max_events } , max_links={ self .max_links } , max_attribute_length={ self .max_attribute_length } )"
625
610
626
611
@classmethod
627
612
def _from_env_if_absent (
@@ -759,9 +744,7 @@ def __init__(
759
744
self ._links = BoundedList .from_seq (self ._limits .max_links , links )
760
745
761
746
def __repr__ (self ):
762
- return '{}(name="{}", context={})' .format (
763
- type (self ).__name__ , self ._name , self ._context
764
- )
747
+ return f'{ type (self ).__name__ } (name="{ self ._name } ", context={ self ._context } )'
765
748
766
749
def _new_events (self ):
767
750
return BoundedList (self ._limits .max_events )
@@ -889,9 +872,7 @@ def __exit__(
889
872
self .set_status (
890
873
Status (
891
874
status_code = StatusCode .ERROR ,
892
- description = "{}: {}" .format (
893
- exc_type .__name__ , exc_val
894
- ),
875
+ description = f"{ exc_type .__name__ } : { exc_val } " ,
895
876
)
896
877
)
897
878
0 commit comments