Best Python code snippet using autotest_python
concrete_processor.py
Source:concrete_processor.py
...52 self._message['title'],53 )54 # Se la segnalazione consiste in una issue55 elif kind == 'issue' or 'issue-note':56 self._check_labels(self._message['labels'])57 return self._mongofacade.get_match_labels(58 users,59 self._message['project_id'],60 self._message['labels'],61 )62 else:63 raise NameError('Type doesn\'t exist')64 def _check_labels(self, labels: list):65 """Guarda se le label della segnalazione66 legate al progetto indicati esistono.67 Funzione ausiliaria per `_filter_user_by_project`.68 Lavora come RedmineProcessor._check_label69 :param labels: lista delle label della segnalazione70 """71 project = self._message['project_id']72 label_project = self._mongofacade.get_label_project(project)73 for label in labels:74 if label not in label_project:75 self._mongofacade.insert_label_by_project(project, label)76class RedmineProcessor(Processor):77 """78 Classe processore di Redmine79 """80 def _filter_users_by_topic(self, users: list, kind: str) -> list:81 """82 Cerca gli utenti disponibili nella data della notifica iscritti ai83 topic della segnalazione84 :param users: lista di utenti appartenenti al progetto della85 segnalazione e disponibili nel giorno della segnalazione86 :param kind: tipologia della segnalazione per redmine87 :return: lista di utenti iscritti a quel topic88 """89 # L'unico tipo di segnalazioni possono essere 'issue'90 if kind != 'issue':91 raise NameError('Type not exists')92 self._check_labels(self._message['labels'])93 return self._mongofacade.get_match_labels(94 users,95 self._message['project_id'],96 self._message['labels'],97 )98 def _check_labels(self, labels: list):99 """100 Guarda se le label della segnalazione legate al progetto indicati101 esistono102 :param labels: lista delle label della segnalazione103 """104 project = self._message['project_id']105 label_project = self._mongofacade.get_label_project(project)106 for label in labels:107 if label not in label_project:...
binary.py
Source:binary.py
...40 integer-valued labels), a :class:`.DPTransformer` can be used (e.g. :class:`.IntToString`).41 """42 def __init__(self, *, epsilon, value0, value1):43 super().__init__(epsilon=epsilon, delta=0.0)44 self.value0, self.value1 = self._check_labels(value0, value1)45 @classmethod46 def _check_labels(cls, value0, value1):47 if not isinstance(value0, str) or not isinstance(value1, str):48 raise TypeError("Binary labels must be strings. Use a DPTransformer (e.g. transformers.IntToString) for "49 "non-string labels")50 if len(value0) * len(value1) == 0:51 raise ValueError("Binary labels must be non-empty strings")52 if value0 == value1:53 raise ValueError("Binary labels must not match")54 return value0, value155 def _check_all(self, value):56 super()._check_all(value)57 self._check_labels(self.value0, self.value1)58 if not isinstance(value, str):59 raise TypeError("Value to be randomised must be a string")60 if value not in [self.value0, self.value1]:61 raise ValueError("Value to be randomised is not in the domain {\"%s\", \"%s\"}, got \"%s\"" %62 (self.value0, self.value1, value))63 return True64 @copy_docstring(DPMechanism.bias)65 def bias(self, value):66 raise NotImplementedError67 @copy_docstring(DPMechanism.variance)68 def variance(self, value):69 raise NotImplementedError70 def randomise(self, value):71 """Randomise `value` with the mechanism....
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!!