Best Python code snippet using autotest_python
plot_data.py
Source:plot_data.py
...101 if selection == "annotations":102 obj._add_annotations(plot_data)103 continue104 if not obj._add_label(plot_data, selection):105 obj._add_additional_data(obj, plot_data, selection)106 obj.annotations["events"] = AnnotationData()107 obj._add_events(getattr(plot_data, "events", None))108 return obj109 @staticmethod110 def _add_additional_data(obj, plot_data, selection):111 if not obj.additional_data:112 obj.additional_data = {}113 obj.additional_data[selection] = plot_data[selection]114 def _add_annotations(self, plot_data: Dict):115 if not plot_data.get("annotations", None):116 return117 for label in plot_data["annotations"].keys():118 self._add_label(plot_data, label)119 def _add_events(self, events: pd.DataFrame):120 if not events:121 return122 global_labels = [label for label in self.parent().global_data.labels if label.name in self.annotations]123 for _, event in events.iterrows():124 for label in global_labels:...
sensor_info_item.py
Source:sensor_info_item.py
...35 self._check_columns(data)36 if not self._key:37 self._add_first_data(data)38 else:39 return self._add_additional_data(data)40 return self._key41 def _add_first_data(self, data):42 self._key = self.get_key(data)43 self._data = data44 self._add_info(data)45 def _add_additional_data(self, data):46 if self.get_key(data) != self._key:47 return False48 self._add_info(data)49 return self._key50 def _add_info(self, data):51 self._set_valid_from(data)52 self._set_valid_to(data)53 self._add_calibration_date(data)54 def _set_valid_from(self, data):55 if not self._valid_from:56 self._valid_from = self._get_time_object(data['TIME'])57 else:58 self._valid_from = min(self._valid_from, self._get_time_object(data['TIME']))59 def _set_valid_to(self, data):...
metrocaller.py
Source:metrocaller.py
...21 if _anormal_status_lines_pdf.size > 0:22 return [str(x) for x in _anormal_status_lines_pdf['metro_line'].values]23 else:24 return []25 def _add_additional_data(self):26 for key in self.data_dict.keys():27 self.data_dict[key].loc[:, self._db_tablename + '_date'] \28 = datetime.now().strftime('%Y-%m-%d %H:%M:%S')29 return self.data_dict30 def _clean_decoded_API_data(self, json_data):31 _metro_data_pdf = pd.json_normalize(json_data['result']['metros'])32 _metro_data_pdf.columns = ['metro_line','slug','title','metro_message']33 _metro_data_pdf.loc[:,'metro_line'] = _metro_data_pdf.loc[:,'metro_line'].astype('string')34 _lines = json.loads(os.getenv('METRO_LINES'))35 _lines = [str(x) for x in _lines]36 _metro_data_pdf = _metro_data_pdf[_metro_data_pdf['metro_line'].isin(_lines)]37 # old treatment in old metro.py file38 self.data_dict = {39 'metro_status': _metro_data_pdf...
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!!