Best Python code snippet using localstack_python
simple_example.py
Source:simple_example.py
...50 f'X coordinate:\t\t{x_pos}\n'51 f'Y coordinate:\t\t{y_pos}\n'52 f'Z coordinate:\t\t{z_pos}\n'53 f'Vergence angle:\t\t{vergence}\n')54 def _handle_event_stream(self, event_type, _timestamp, *_args):55 ''' Prints event data to the console '''56 if self._allow_output:57 # We discriminate between events based on their type58 if event_type == Events.BLINK.value:59 print('Blink!')60 elif event_type == Events.SACCADE.value:61 print('Saccade!')62 def _handle_connect_response(self, error):63 ''' Handler for backend connections '''64 # Starts the camera and sets the stream rate65 if not error:66 print('Connected to AdHawk Backend Service')67 # Sets the GAZE data stream rate to 125Hz68 self._api.set_stream_control(PacketType.GAZE, 125, callback=(lambda *_args: None))...
parsers.py
Source:parsers.py
...22 parsed = {}23 if shape is not None:24 event_name = shape.event_stream_name25 if event_name:26 parsed = await self._handle_event_stream(response, shape, event_name)27 else:28 parsed = self._handle_json_body(response['body'], shape)29 self._inject_response_metadata(parsed, response['headers'])30 return parsed31 def _create_event_stream(self, response, shape):32 parser = self._event_stream_parser33 name = response['context'].get('operation_name')34 return AioEventStream(response['body'], shape, parser, name)35 async def _handle_event_stream(self, response, shape, event_name):36 event_stream_shape = shape.members[event_name]37 event_stream = self._create_event_stream(response, event_stream_shape)38 try:39 event = await event_stream.get_initial_response()40 except NoInitialResponseError:41 error_msg = 'First event was not of type initial-response'42 raise ResponseParserError(error_msg)43 parsed = self._handle_json_body(event.payload, shape)44 parsed[event_name] = event_stream45 return parsed46 # this is actually from ResponseParser however for now JSONParser is the47 # only class that needs this async48 async def parse(self, response, shape):49 LOG.debug('Response headers: %s', response['headers'])...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!