@@ -13,12 +13,17 @@ def __init__(self, **kwargs):
1313 self .status_code = kwargs ["status_code" ]
1414 self .body = json .loads (kwargs ["response" ])
1515
16+ def __str__ (self ):
17+ return "{operation_id} ({status_code}" .format (
18+ operation_id = self .operation_id ,
19+ status_code = self .status_code ,
20+ )
21+
1622 def __repr__ (self ):
17- return "<{module}.{name}: {operation_id} ({status_code}) >" .format (
23+ return "<{module}.{name}: {str_rep} >" .format (
1824 module = self .__class__ .__module__ ,
1925 name = self .__class__ .__name__ ,
20- operation_id = self .operation_id ,
21- status_code = self .status_code ,
26+ str_rep = str (self ),
2227 )
2328
2429
@@ -39,16 +44,21 @@ def update(self, **kwargs):
3944 self .response_body_url = kwargs .get ("response_body_url" )
4045 self ._status = kwargs .get ("status" )
4146
42- def __repr__ (self ):
43- return "<{module}.{name}: {finished}/{total} operation{s} ({status})>" .format (
44- module = self .__class__ .__module__ ,
45- name = self .__class__ .__name__ ,
47+ def __str__ (self ):
48+ return "{finished}/{total} operation{s} ({status})" .format (
4649 finished = self .finished_operations ,
4750 total = self .total_operations ,
4851 s = "s" if self .total_operations != 1 else "" ,
4952 status = self ._status ,
5053 )
5154
55+ def __repr__ (self ):
56+ return "<{module}.{name}: {str_rep}>" .format (
57+ module = self .__class__ .__module__ ,
58+ name = self .__class__ .__name__ ,
59+ str_rep = str (self ),
60+ )
61+
5262 def status (self , refresh = False ):
5363 if refresh :
5464 self ._batches_api .status (self .batch_id , refresh = refresh )
0 commit comments