@@ -32,20 +32,21 @@ def __init__(self, batches_api, **kwargs):
32
32
33
33
def update (self , ** kwargs ):
34
34
self .batch_id = kwargs .get ("id" )
35
+ self .total_operations = kwargs .get ("total_operations" )
36
+ self .finished_operations = kwargs .get ("finished_operations" )
37
+ self .errored_operations = kwargs .get ("errored_operations" )
38
+ self .submitted_at = kwargs .get ("submitted_at" )
39
+ self .completed_at = kwargs .get ("completed_at" )
40
+ self .response_body_url = kwargs .get ("response_body_url" )
35
41
self ._status = kwargs .get ("status" )
36
- self ._total_operations = kwargs .get ("total_operations" )
37
- self ._finished_operations = kwargs .get ("finished_operations" )
38
- self ._errored_operations = kwargs .get ("errored_operations" )
39
- self ._submitted_at = kwargs .get ("submitted_at" )
40
- self ._completed_at = kwargs .get ("completed_at" )
41
- self ._response_body_url = kwargs .get ("response_body_url" )
42
42
43
43
def __repr__ (self ):
44
- return "<{module}.{name}: {total} operation{s} ({status})>" .format (
44
+ return "<{module}.{name}: {finished}/{ total} operation{s} ({status})>" .format (
45
45
module = self .__class__ .__module__ ,
46
46
name = self .__class__ .__name__ ,
47
- total = self ._total_operations ,
48
- s = "s" if self ._total_operations != 1 else "" ,
47
+ finished = self .finished_operations ,
48
+ total = self .total_operations ,
49
+ s = "s" if self .total_operations != 1 else "" ,
49
50
status = self ._status ,
50
51
)
51
52
@@ -58,8 +59,8 @@ def response(self):
58
59
if self .response :
59
60
return self .response
60
61
batch = self .status (refresh = True )
61
- if batch ._status == "finished" and batch ._response_body_url :
62
- content = requests .get (batch ._response_body_url ).content
62
+ if batch ._status == "finished" and batch .response_body_url :
63
+ content = requests .get (batch .response_body_url ).content
63
64
tf = tarfile .open (fileobj = BytesIO (content ))
64
65
output = []
65
66
for member in tf .getmembers ():
0 commit comments