@@ -125,24 +125,21 @@ def create_exception(self, exception, loading_exception=False):
125125 })
126126 return response
127127
128- def process_loop (self ):
129- for line in sys .stdin :
130- request = json .loads (line )
131- formatted_input = self .format_data (request )
132- result = self .apply (formatted_input )
133- self .write_to_pipe (result )
134-
135128 def process_local (self , local_payload , pprint ):
136129 result = self .apply (local_payload )
137130 self .write_to_pipe (result , pprint = pprint )
138131
139132 def init (self , local_payload = None , pprint = print ):
140- while True :
141133 self .load ()
142- if self .loading_exception :
143- load_error = self .create_exception (self .loading_exception , loading_exception = True )
144- self .write_to_pipe (load_error , pprint = pprint )
145- elif self .is_local and local_payload :
134+ if self .is_local and local_payload :
146135 self .process_local (local_payload , pprint )
147136 else :
148- self .process_loop ()
137+ for line in sys .stdin :
138+ request = json .loads (line )
139+ if self .loading_exception :
140+ load_error = self .create_exception (self .loading_exception , loading_exception = True )
141+ self .write_to_pipe (load_error , pprint = pprint )
142+ formatted_input = self .format_data (request )
143+ else :
144+ result = self .apply (formatted_input )
145+ self .write_to_pipe (result )
0 commit comments