Best Python code snippet using pyatom_python
traitement_ressources.py
Source:traitement_ressources.py
...119def raise_error(buffer):120 raise BufferError('est-ce normal d\'avoir cela sur le buffer', buffer)121table_lefff = {122 "[": lambda x: None,123 "(": lambda x: globals().__setitem__('fac', True),124 ")": lambda x: [globals().__setitem__('fac', False),125 facultatif.add(buffer),126 relations.__setitem__(r_cles.pop(), {'facultatif': facultatif}),127 globals().__setitem__('buffer', str())],128 "]": lambda x: [129 (morphologie.add(buffer.strip()) if morpho else features.__setitem__(f_cles.pop(), buffer.strip(' ')),130 features.__setitem__('morphologie', morphologie)) if (features or f_cles or relations or obligatoire or facultatif or morphologie or lemme or number or morpho or rel or fac) else 0131 ],132 "|": lambda x: [facultatif.add(buffer) if fac else obligatoire.add(buffer), globals().__setitem__('buffer', str())],133 "=": lambda x: [f_cles.append(buffer.strip(' ')), globals().__setitem__('buffer', str())],134 ":": lambda x: [r_cles.append(buffer), globals().__setitem__('buffer', str())],135 ",": lambda x: [((obligatoire.add(buffer) if rel else (morphologie.add(buffer) if morpho else features.__setitem__(f_cles.pop(), {'lemme': lemme, 'number': number if number else None, 'relations': relations}))) if buffer else 0), globals().__setitem__('buffer', str())],136 "<": lambda x: [[globals().__setitem__(x, y.lstrip("'")) for (x, y) in zip(('lemme', 'number'), re.split(r'__+', buffer))], globals().__setitem__('rel', True), globals().__setitem__('buffer', str())],137 ">": lambda x: [globals().__setitem__('rel', False), obligatoire.add(buffer) if buffer else 0, (relations.__setitem__(r_cles.pop(), {'obligatoire': obligatoire}) if r_cles else relations.__setitem__('obligatoire', obligatoire))],138 "@": lambda x: globals().__setitem__('morpho', True),139 '!': lambda x: globals().__setitem__("buffer", buffer+x),140 '"': lambda x: globals().__setitem__("buffer", buffer+x),141 '#': lambda x: globals().__setitem__("buffer", buffer+x),142 '$': lambda x: globals().__setitem__("buffer", buffer+x),143 '%': lambda x: globals().__setitem__("buffer", buffer+x),144 '&': lambda x: globals().__setitem__("buffer", buffer+x),145 "'": lambda x: globals().__setitem__("buffer", buffer+x),146 '*': lambda x: globals().__setitem__("buffer", buffer+x),147 "+": lambda x: globals().__setitem__("buffer", buffer+x),148 '-': lambda x: globals().__setitem__("buffer", buffer+x),149 ".": lambda x: globals().__setitem__("buffer", buffer+x),150 "/": lambda x: globals().__setitem__("buffer", buffer+x),151 '0': lambda x: globals().__setitem__("buffer", buffer+x),152 '1': lambda x: globals().__setitem__("buffer", buffer+x),153 '2': lambda x: globals().__setitem__("buffer", buffer+x),154 '3': lambda x: globals().__setitem__("buffer", buffer+x),155 '4': lambda x: globals().__setitem__("buffer", buffer+x),156 '5': lambda x: globals().__setitem__("buffer", buffer+x),157 '6': lambda x: globals().__setitem__("buffer", buffer+x),158 '7': lambda x: globals().__setitem__("buffer", buffer+x),159 '8': lambda x: globals().__setitem__("buffer", buffer+x),160 '9': lambda x: globals().__setitem__("buffer", buffer+x),161 ";": lambda x: globals().__setitem__("buffer", buffer+x),162 '?': lambda x: globals().__setitem__("buffer", buffer+x),163 "A": lambda x: globals().__setitem__("buffer", buffer+x),164 "B": lambda x: globals().__setitem__("buffer", buffer+x),165 "C": lambda x: globals().__setitem__("buffer", buffer+x),166 "D": lambda x: globals().__setitem__("buffer", buffer+x),167 "E": lambda x: globals().__setitem__("buffer", buffer+x),168 "F": lambda x: globals().__setitem__("buffer", buffer+x),169 "G": lambda x: globals().__setitem__("buffer", buffer+x),170 "H": lambda x: globals().__setitem__("buffer", buffer+x),171 "I": lambda x: globals().__setitem__("buffer", buffer+x),172 "J": lambda x: globals().__setitem__("buffer", buffer+x),173 "K": lambda x: globals().__setitem__("buffer", buffer+x),174 "L": lambda x: globals().__setitem__("buffer", buffer+x),175 "M": lambda x: globals().__setitem__("buffer", buffer+x),176 "N": lambda x: globals().__setitem__("buffer", buffer+x),177 "O": lambda x: globals().__setitem__("buffer", buffer+x),178 "P": lambda x: globals().__setitem__("buffer", buffer+x),179 "Q": lambda x: globals().__setitem__("buffer", buffer+x),180 "R": lambda x: globals().__setitem__("buffer", buffer+x),181 "S": lambda x: globals().__setitem__("buffer", buffer+x),182 "T": lambda x: globals().__setitem__("buffer", buffer+x),183 "U": lambda x: globals().__setitem__("buffer", buffer+x),184 "V": lambda x: globals().__setitem__("buffer", buffer+x),185 "W": lambda x: globals().__setitem__("buffer", buffer+x),186 "X": lambda x: globals().__setitem__("buffer", buffer+x),187 "Y": lambda x: globals().__setitem__("buffer", buffer+x),188 "Z": lambda x: globals().__setitem__("buffer", buffer+x),189 "_": lambda x: globals().__setitem__("buffer", buffer+x),190 "a": lambda x: globals().__setitem__("buffer", buffer+x),191 "b": lambda x: globals().__setitem__("buffer", buffer+x),192 "c": lambda x: globals().__setitem__("buffer", buffer+x),193 "d": lambda x: globals().__setitem__("buffer", buffer+x),194 "e": lambda x: globals().__setitem__("buffer", buffer+x),195 "f": lambda x: globals().__setitem__("buffer", buffer+x),196 "g": lambda x: globals().__setitem__("buffer", buffer+x),197 "h": lambda x: globals().__setitem__("buffer", buffer+x),198 "i": lambda x: globals().__setitem__("buffer", buffer+x),199 "j": lambda x: globals().__setitem__("buffer", buffer+x),200 "k": lambda x: globals().__setitem__("buffer", buffer+x),201 "l": lambda x: globals().__setitem__("buffer", buffer+x),202 "m": lambda x: globals().__setitem__("buffer", buffer+x),203 "n": lambda x: globals().__setitem__("buffer", buffer+x),204 "o": lambda x: globals().__setitem__("buffer", buffer+x),205 "p": lambda x: globals().__setitem__("buffer", buffer+x),206 "q": lambda x: globals().__setitem__("buffer", buffer+x),207 "r": lambda x: globals().__setitem__("buffer", buffer+x),208 "s": lambda x: globals().__setitem__("buffer", buffer+x),209 "t": lambda x: globals().__setitem__("buffer", buffer+x),210 "u": lambda x: globals().__setitem__("buffer", buffer+x),211 "v": lambda x: globals().__setitem__("buffer", buffer+x),212 "w": lambda x: globals().__setitem__("buffer", buffer+x),213 "x": lambda x: globals().__setitem__("buffer", buffer+x),214 "y": lambda x: globals().__setitem__("buffer", buffer+x),215 "z": lambda x: globals().__setitem__("buffer", buffer+x),216 '~': lambda x: globals().__setitem__("buffer", buffer+x),217 "§": lambda x: globals().__setitem__("buffer", buffer+x),218 "©": lambda x: globals().__setitem__("buffer", buffer+x),219 "«": lambda x: globals().__setitem__("buffer", buffer+x),220 "¯": lambda x: globals().__setitem__("buffer", buffer+x),221 "°": lambda x: globals().__setitem__("buffer", buffer+x),222 "±": lambda x: globals().__setitem__("buffer", buffer+x),223 "²": lambda x: globals().__setitem__("buffer", buffer+x),224 "µ": lambda x: globals().__setitem__("buffer", buffer+x),225 "»": lambda x: globals().__setitem__("buffer", buffer+x),226 "½": lambda x: globals().__setitem__("buffer", buffer+x),227 "Ã": lambda x: globals().__setitem__("buffer", buffer+x),228 "Ã": lambda x: globals().__setitem__("buffer", buffer+x),229 "Ã": lambda x: globals().__setitem__("buffer", buffer+x),230 "à ": lambda x: globals().__setitem__("buffer", buffer+x),231 "â": lambda x: globals().__setitem__("buffer", buffer+x),232 "ç": lambda x: globals().__setitem__("buffer", buffer+x),233 "è": lambda x: globals().__setitem__("buffer", buffer+x),234 "é": lambda x: globals().__setitem__("buffer", buffer+x),235 "ê": lambda x: globals().__setitem__("buffer", buffer+x),236 "ë": lambda x: globals().__setitem__("buffer", buffer+x),237 "î": lambda x: globals().__setitem__("buffer", buffer+x),238 "ï": lambda x: globals().__setitem__("buffer", buffer+x),239 "ñ": lambda x: globals().__setitem__("buffer", buffer+x),240 "ô": lambda x: globals().__setitem__("buffer", buffer+x),241 "ö": lambda x: globals().__setitem__("buffer", buffer+x),242 "ù": lambda x: globals().__setitem__("buffer", buffer+x),243 "û": lambda x: globals().__setitem__("buffer", buffer+x),244 "ü": lambda x: globals().__setitem__("buffer", buffer+x),245 " ": lambda x: globals().__setitem__("buffer", buffer+x)246}247def calculer_morpho(chaine):248 return chaine249def main():250 # filename = "../LEFFF/lefff-2.1_utf8.txt"251 # traiter_lefff(filename=filename, encoding='utf-8', buffering=53213)252 tmp = traiter_lexique(253 filename="../LEFFF/lefff-2.1_utf8.txt",254 mode='r',255 encoding='utf-8',256 errors='strict',257 buffering=1258 )259 cur = next(tmp, False)260 i = 0261 liste = collections.deque()262 while cur:263 liste.append(cur)264 cur = next(tmp, False)265 dump(liste, open("lexique_lefff.pickle", "wb"))266clear_buffer = lambda : globals().__setitem__('buffer', '')267def test():268 from nltk.featstruct import unify269 from pprint import pprint270 from _functools import reduce271 from yaml import dump272 sf = 'fs'273 # print(dump(lefff_codex(), default_flow_style=False))274 reduire = lambda x, y: dico_add(x, y)275 print(reduce(reduire, [lefff_codex()[x] for x in ('1', '2', '3')]))276def dico_add(dico1, dico2):277 for k, v in dico2.items():278 print(k, v)279 dico1[k]|=(v)280 return dico1...
__init__.py
Source:__init__.py
...164 inAppendix = False165 166 def __init__(self):167 Renderer.__init__(self)168 self.__setitem__('active::~', handle_nobreak)169 self.__setitem__('active::_', handle_subscript)170 self.__setitem__('active::^', handle_superscript)171 self.__setitem__('appendix', handle_appendix)172 self.__setitem__('ArrayCell', handle_arraycell)173 self.__setitem__('ArrayRow', handle_arrayrow)174 self.__setitem__('appendix', handle_appendix)175 self.__setitem__('bibitem', handle_bibitem)176 self.__setitem__('bigskip', omit)177 self.__setitem__('bf', handle_textbf)178 self.__setitem__('bfseries', handle_textbf)179 self.__setitem__('bibliographystyle', omit)180 self.__setitem__('bgroup', enter)181 self.__setitem__('cite', handle_cite)182 self.__setitem__('center', enter)183 self.__setitem__('centering', enter)184 self.__setitem__('description', handle_description)185 self.__setitem__('document', handle_document)186 self.__setitem__('em', handle_textit)187 self.__setitem__('emph', handle_textit)188 self.__setitem__('enumerate', handle_enumerate)189 self.__setitem__('figure', handle_figure)190 self.__setitem__('footnote', handle_footnote)191 self.__setitem__('input', omit)192 self.__setitem__('it', handle_textit)193 self.__setitem__('item', handle_item)194 self.__setitem__('itemize', handle_itemize)195 self.__setitem__('label', omit)196 self.__setitem__('large', enter)197 self.__setitem__('maketitle', omit)198 self.__setitem__('math', handle_math)199 self.__setitem__('medskip', omit)200 self.__setitem__('noindent', omit)201 self.__setitem__('pagebreak', omit)202 self.__setitem__('par', handle_par)203 self.__setitem__('paragraph', handle_paragraph)204 self.__setitem__('ref', handle_ref)205 self.__setitem__('relax', omit)206 self.__setitem__('section', handle_section)207 self.__setitem__('smallskip', omit)208 self.__setitem__('subsection', handle_subsection)209 self.__setitem__('subsubsection', handle_subsubsection)210 self.__setitem__('table', handle_table)211 self.__setitem__('textbf', handle_textbf)212 self.__setitem__('textit', handle_textit)213 self.__setitem__('texttt', handle_texttt)214 self.__setitem__('tt', handle_texttt)215 self.__setitem__('thebibliography', handle_thebibliography)216 self.__setitem__('verb', handle_texttt)217 self.__setitem__('verbatim', handle_verbatim)218 self.__setitem__('vspace', omit)219 def default(self, node):220 """ Rendering method for all non-text nodes """221 s = []222 # Handle characters like \&, \$, \%, etc.223 if len(node.nodeName) == 1 and node.nodeName not in string.letters:224 return self.textDefault(node.nodeName)225 # Start tag226 s.append('<%s>' % node.nodeName)227 # See if we have any attributes to render228 if node.hasAttributes():229 s.append('<attributes>')230 for key, value in node.attributes.items():231 # If the key is 'self', don't render it232 # these nodes are the same as the child nodes...
yachayParser.py
Source:yachayParser.py
...29 fecha = datetime.strptime(datosArr[0].replace('"',''), '%Y-%m-%d %H:%M:%S')30 existeF = Clima.objects(Q(record=int(datosArr[1])) & Q(fecha=fecha)).count()31 if(existeF==0):32 climaObj = Clima()33 climaObj.__setitem__("Estacion","Yachay")34 # string_date = "2013-09-28 20:30:55.78200"35 climaObj.__setitem__("fecha", fecha)36 climaObj.__setitem__("record",int(datosArr[1]))37 climaObj.__setitem__("voltajeMinimoBateria",float(datosArr[2]))38 climaObj.__setitem__("temperaturaAirePromedio",float(datosArr[3]))39 climaObj.__setitem__("humedadAirePromedio",float(datosArr[4]))40 climaObj.__setitem__("vientoVelocidadPromedio",float(datosArr[5]))41 climaObj.__setitem__("vientoDireccionPromedio",float(datosArr[6]))42 climaObj.__setitem__("radiacioSolarPromedioW",float(datosArr[7]))43 climaObj.__setitem__("radiacioSolarPromedioMJ",float(datosArr[8]))44 climaObj.__setitem__("presionBarometricaPromedio",float(datosArr[9]))45 climaObj.__setitem__("nivelSonidoInternoPromedio",float(datosArr[10]))46 climaObj.__setitem__("nivelSonidoInternoExterno",float(datosArr[11]))47 climaObj.__setitem__("iluminacion3Promedio",float(datosArr[12]))48 climaObj.__setitem__("iluminacion7Promedio",float(datosArr[13]))49 climaObj.__setitem__("iluminacion7Promedio",float(datosArr[14]))50 climaObj.__setitem__("dioxidoCarbono3Promedio",float(datosArr[15]))51 climaObj.__setitem__("dioxidoCarbono6Promedio",float(datosArr[16]))52 climaObj.__setitem__("dioxidoCarbono7Promedio",float(datosArr[17]))53 climaObj.__setitem__("termocuplaPromedio1",float(datosArr[18]))54 climaObj.__setitem__("termocuplaPromedio2",float(datosArr[19]))55 climaObj.__setitem__("termocuplaPromedio3",float(datosArr[20]))56 climaObj.__setitem__("termocuplaPromedio4",float(datosArr[21]))57 climaObj.__setitem__("termocuplaPromedio5",float(datosArr[22]))58 climaObj.__setitem__("termocuplaPromedio6",float(datosArr[23]))59 climaObj.__setitem__("termocuplaPromedio7",float(datosArr[24]))60 climaObj.__setitem__("termocuplaPromedio8",float(datosArr[25]))61 climaObj.__setitem__("termocuplaPromedio9",float(datosArr[26]))62 climaObj.__setitem__("termocuplaPromedio10",float(datosArr[27]))63 climaObj.__setitem__("termocuplaPromedio11",float(datosArr[28]))64 climaObj.__setitem__("termocuplaPromedio12",float(datosArr[29]))65 climaObj.__setitem__("termocuplaPromedio13",float(datosArr[30]))66 climaObj.__setitem__("termocuplaPromedio14",float(datosArr[31]))67 climaObj.__setitem__("termocuplaPromedio15",float(datosArr[32]))68 climaObj.__setitem__("termocuplaPromedio16",float(datosArr[33]))69 climaObj.__setitem__("termocuplaPromedio17",float(datosArr[34]))70 climaObj.__setitem__("termocuplaPromedio18",float(datosArr[35]))71 climaObj.__setitem__("termocuplaPromedio19",float(datosArr[36]))72 climaObj.__setitem__("termocuplaPromedio20",float(datosArr[37]))73 climaObj.__setitem__("termocuplaPromedio21",float(datosArr[38]))74 climaObj.__setitem__("termocuplaPromedio22",float(datosArr[39]))75 climaObj.__setitem__("termocuplaPromedio23",float(datosArr[40]))76 climaObj.__setitem__("termocuplaPromedio24",float(datosArr[41]))77 climaObj.__setitem__("termocuplaPromedio25",float(datosArr[42]))78 climaObj.__setitem__("termocuplaPromedio26",float(datosArr[43]))79 climaObj.__setitem__("termocuplaPromedio27",float(datosArr[44]))80 climaObj.__setitem__("termocuplaPromedio28",float(datosArr[45]))81 climaObj.__setitem__("termocuplaPromedio29",float(datosArr[46]))82 climaObj.__setitem__("termocuplaPromedio20",float(datosArr[47]))83 climaObj.__setitem__("termocuplaPromedio31",float(datosArr[48]))84 climaObj.__setitem__("termocuplaPromedio32",float(datosArr[49]))85 # print datosArr.__len__()86 if(datosArr.__len__() > 50):87 climaObj.__setitem__("dioxidocarbono3V",float(datosArr[50]))88 climaObj.__setitem__("dioxidocarbono6V",float(datosArr[51]))89 climaObj.__setitem__("dioxidocarbono7V",float(datosArr[52]))90 objetos.append(climaObj)91 del contenido92 del contenidoF93 return objetos...
estacionQuito.py
Source:estacionQuito.py
...29 hora = datosArr[1].split(":")30 minuto = int(hora[1])31 hora = int(hora[0])32 climaObj = Clima()33 climaObj.__setitem__("Estacion","EstacionQuito")34 climaObj.__setitem__("fecha", datetime.datetime(anno,mes,dia,hora,minuto,00))35 climaObj.__setitem__("temperaturaExterior",float(datosArr[2]))36 climaObj.__setitem__("temperaturaExteriorMaxima",float(datosArr[3]))37 climaObj.__setitem__("temperaturaExteriorMinima",float(datosArr[4]))38 climaObj.__setitem__("temperaturaAparente",float(datosArr[12]))39 climaObj.__setitem__("temperaturaAparenteIndiceCalentamiento",float(datosArr[13]))40 climaObj.__setitem__("temperaturaAparenteTHW",float(datosArr[14]))41 climaObj.__setitem__("temperaturaAparenteTHSW",float(datosArr[15]))42 climaObj.__setitem__("temperaturaSuperficie",float(datosArr[37]))43 climaObj.__setitem__("temperaturaInternaPuntoRocioDL",float(datosArr[29]))44 climaObj.__setitem__("temperaturaCalentamientoDL",float(datosArr[30]))45 climaObj.__setitem__("temperaturaCalentamiento",float(datosArr[25]))46 climaObj.__setitem__("temperaturaEnfriamiento",float(datosArr[26]))47 climaObj.__setitem__("temperaturaInternaDL",float(datosArr[27]))48 climaObj.__setitem__("temperaturaSensorAdicional",float(datosArr[33]))49 climaObj.__setitem__("humedadExterior",datosArr[5])50 climaObj.__setitem__("humedadRelativaSensorAdicional",datosArr[34])51 climaObj.__setitem__("humedadInternaDL",int(datosArr[28]))52 climaObj.__setitem__("humedadEquilibrioContenido",datosArr[31])53 climaObj.__setitem__("humedadSuperficie",datosArr[36])54 climaObj.__setitem__("puntoRocio",datosArr[6])55 climaObj.__setitem__("vientoVelocidad",datosArr[7])56 climaObj.__setitem__("vientoDireccion",datosArr[8])57 climaObj.__setitem__("vientoRecorrido",datosArr[9])58 climaObj.__setitem__("vientoVelocidadMaxima",datosArr[10])59 climaObj.__setitem__("vientoDireccionMaxima",datosArr[11])60 climaObj.__setitem__("vientoVelocidadMuestrasTiempo",int(datosArr[38]))61 climaObj.__setitem__("presionBarometrica",datosArr[16])62 climaObj.__setitem__("precipitacionAcumulada",datosArr[17])63 climaObj.__setitem__("precipitacionIntensidad",datosArr[18])64 climaObj.__setitem__("solarRadiacion",datosArr[19])65 climaObj.__setitem__("solarEnergia",datosArr[20])66 climaObj.__setitem__("solarEnergiaMaximo",datosArr[21])67 climaObj.__setitem__("solarRadiacionIndiceExpoUV",datosArr[22])68 climaObj.__setitem__("solarDosisEritematicaMinima",datosArr[23])69 climaObj.__setitem__("solarRadiacionIndiceExpMaxIndiceUV",datosArr[24])70 climaObj.__setitem__("aireDensidadInternaDL",datosArr[32])71 climaObj.__setitem__("evapotranspiracionPotencial",datosArr[35])72 climaObj.__setitem__("canalTransmisionDatosRF",int(datosArr[39]))73 climaObj.__setitem__("canalRecepcionRF_ISS",datosArr[40])74 climaObj.__setitem__("intervalosRecoleccionInformacion",int(datosArr[41]))75 climaObj.__setattr__("fichero",file)76 objetos.append(climaObj)77 # todo cambiar los destino por arreglo78 # os.rename(current_file,self.getCaminoDestino()+file)79 else:80 # print "Fichero duplicado" + file81 self.ficherosR.append(file)82 # os.rename(current_file,self.getCaminoDuplicados()+file)83 del contenido,datosArr...
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!!