How to use parse_entry method in autotest

Best Python code snippet using autotest_python

model.py

Source:model.py Github

copy

Full Screen

...42 doc = cls()43 if len(line[0]) == 0:44 return None45 doc.meta.id = int(line[0])46 doc.datum = parse_entry(line[1])47 doc.naam = parse_entry(line[2])48 doc.inhoud = parse_entry(line[3])49 doc.bron = parse_entry(line[4])50 doc.getuigen = parse_entry(line[5])51 doc.bijzonderheden = parse_entry(line[6])52 if not doc.is_valid():53 return None54 if doc.naam is not None:55 doc.naam_keyword = create_name_keyword(str(doc.naam))56 if doc.datum is not None:57 doc.jaar = create_year(str(doc.datum))58 return doc59 def is_valid(self):60 # At the end of a file there may be empty lines, skip them.61 if getattr(self.meta, 'id', None) is None:62 return False63 # Skip row if there is no data except an id. This happens a lot at the end of a file.64 if self.naam is None and self.datum is None:65 return False66 return True67 @staticmethod68 def get_multimatch_fields() -> List[str]:69 return ['naam^3', 'datum^3', 'inhoud^2', 'getuigen', 'bron']70 @staticmethod71 def get_index_name_pretty():72 return 'Achternamenindex'73 def get_title(self) -> str:74 return '{} | {}'.format(self.naam or '', self.datum or '')75 def get_subtitle(self) -> str:76 return self.bron or ''77 def get_body_lines(self) -> List[str]:78 out = [self.inhoud, self.getuigen, self.bijzonderheden]79 return [value for value in out if value]80def create_name_keyword(naam: str) -> str:81 """Get a single keyword from the name field."""82 # todo: fix this one: Albrecht (St), van83 if len(naam.split(',')) >= 2:84 return naam.split(',')[0]85 elif len(naam.split('~')) >= 2:86 return naam.split('~')[0]87 elif len(naam.split(' ')) >= 2:88 return naam.split(' ')[0]89 else:90 return naam91def create_year(datum: str) -> Optional[int]:92 """Parse a year from the datum field."""93 if datum is None or len(datum) < 4 or not datum[:4].isdigit():94 return None95 jaar = int(datum[:4])96 if 1000 < jaar < 2000:97 return jaar98 return None99class VoornamenDoc(BaseDocument):100 datum: Optional[str] = Text(fields={'keyword': Keyword()})101 voornaam: Optional[str] = Text(fields={'keyword': Keyword()})102 patroniem: Optional[str] = Text(fields={'keyword': Keyword()})103 inhoud: Optional[str] = Text(fields={'keyword': Keyword()})104 bron: Optional[str] = Text(fields={'keyword': Keyword()})105 getuigen: Optional[str] = Text(fields={'keyword': Keyword()})106 bijzonderheden: Optional[str] = Text(fields={'keyword': Keyword()})107 jaar: Optional[int] = Short()108 class Index:109 name: str = 'voornamenindex'110 def __new__(cls):111 return Index(name=cls.name)112 @classmethod113 def from_csv_line(cls, line: List[str]) -> Optional['VoornamenDoc']:114 doc = cls()115 if len(line[0]) == 0:116 return None117 doc.meta.id = int(line[0])118 doc.datum = parse_entry(line[1])119 doc.voornaam = parse_entry(line[2])120 doc.patroniem = parse_entry(line[3])121 doc.inhoud = parse_entry(line[4])122 doc.bron = parse_entry(line[5])123 doc.getuigen = parse_entry(line[6])124 doc.bijzonderheden = parse_entry(line[7])125 if not doc.is_valid():126 return None127 if doc.datum is not None:128 doc.jaar = create_year(str(doc.datum))129 return doc130 def is_valid(self):131 # At the end of a file there may be empty lines, skip them.132 if getattr(self.meta, 'id', None) is None:133 return False134 # Skip row if there is no data except an id. This happens a lot at the end of a file.135 if self.voornaam is None and self.datum is None:136 return False137 return True138 @staticmethod139 def get_multimatch_fields() -> List[str]:140 return ['voornaam^3', 'patroniem^3', 'datum^3', 'inhoud^2', 'getuigen', 'bron']141 @staticmethod142 def get_index_name_pretty():143 return 'Voornamenindex'144 def get_title(self) -> str:145 return '{} {} | {}'.format(self.voornaam or '', self.patroniem or '', self.datum or '')146 def get_subtitle(self) -> str:147 return self.bron or ''148 def get_body_lines(self) -> List[str]:149 out = [self.inhoud, self.getuigen, self.bijzonderheden]150 return [value for value in out if value]151class JaartallenDoc(BaseDocument):152 datum: Optional[str] = Text(fields={'keyword': Keyword()})153 locatie: Optional[str] = Text(fields={'keyword': Keyword()})154 inhoud: Optional[str] = Text()155 bron: Optional[str] = Text(fields={'keyword': Keyword()})156 getuigen: Optional[str] = Text()157 bijzonderheden: Optional[str] = Text()158 jaar: Optional[int] = Short()159 class Index:160 name: str = 'jaartallenindex'161 def __new__(cls):162 return Index(name=cls.name)163 @classmethod164 def from_csv_line(cls, line: List[str]) -> Optional['JaartallenDoc']:165 doc = cls()166 if len(line[0]) == 0:167 return None168 doc.meta.id = int(line[0])169 doc.datum = parse_entry(line[1])170 doc.locatie = parse_entry(line[2])171 doc.inhoud = parse_entry(line[3])172 doc.bron = parse_entry(line[4])173 doc.getuigen = parse_entry(line[5])174 doc.bijzonderheden = parse_entry(line[6])175 if not doc.is_valid():176 return None177 if doc.datum is not None:178 doc.jaar = create_year(str(doc.datum))179 return doc180 def is_valid(self):181 # At the end of a file there may be empty lines, skip them.182 if getattr(self.meta, 'id', None) is None:183 return False184 # Skip row if there is no data except an id. This happens a lot at the end of a file.185 if self.datum is None:186 return False187 return True188 @staticmethod189 def get_multimatch_fields() -> List[str]:190 return ['datum^3', 'locatie^3', 'inhoud^2', 'getuigen', 'bron']191 @staticmethod192 def get_index_name_pretty():193 return 'Jaartallenindex'194 def get_title(self) -> str:195 return '{} | {}'.format(self.datum or '', self.locatie or '')196 def get_subtitle(self) -> str:197 return self.bron or ''198 def get_body_lines(self) -> List[str]:199 out = [self.inhoud, self.getuigen, self.bijzonderheden]200 return [value for value in out if value]201class MaatboekHeemskerkDoc(BaseDocument):202 locatie: Optional[str] = Text(fields={'keyword': Keyword()})203 sector: Optional[str] = Text(fields={'keyword': Keyword()})204 eigenaar: Optional[str] = Text(fields={'keyword': Keyword()})205 huurder: Optional[str] = Text(fields={'keyword': Keyword()})206 oppervlakte: Optional[str] = Text(fields={'keyword': Keyword()})207 prijs: Optional[str] = Text(fields={'keyword': Keyword()})208 datum: Optional[str] = Text(fields={'keyword': Keyword()})209 jaar: Optional[int] = Short()210 bron: Optional[str] = Text(fields={'keyword': Keyword()})211 opmerkingen: Optional[str] = Text(fields={'keyword': Keyword()})212 class Index:213 name: str = 'heemskerk_maatboek_index'214 def __new__(cls):215 return Index(name=cls.name)216 @classmethod217 def from_csv_line(cls, line: List[str]) -> Optional['MaatboekHeemskerkDoc']:218 # Return early, we'll discard it later using `is_valid`.219 if not parse_entry(line[0]) or not any(parse_entry(value) for value in line[1:]):220 return None221 doc = cls()222 doc.meta.id = line[0]223 doc.locatie = parse_entry(line[1])224 doc.sector = parse_entry(line[2])225 doc.oppervlakte = parse_entry(line[3])226 doc.eigenaar = parse_entry(line[4])227 doc.huurder = parse_entry(line[5])228 doc.prijs = parse_entry(line[6])229 doc.datum = parse_entry(line[7])230 doc.bron = parse_entry(line[8])231 doc.opmerkingen = parse_entry(line[9])232 doc.jaar = cls.parse_year(doc.datum)233 return doc234 @staticmethod235 def parse_year(datum: Optional[str]) -> Optional[int]:236 res = re.search(r'\d{4}', datum or '')237 return int(res[0]) if res else None238 @staticmethod239 def get_multimatch_fields() -> List[str]:240 return ['locatie^3', 'sector^3', 'datum^3', 'eigenaar^2', 'huurder^2', 'oppervlakte', 'bron']241 @staticmethod242 def get_index_name_pretty():243 return 'Maatboek Heemskerk'244 def get_title(self) -> str:245 title = self.sector or self.locatie or self.eigenaar or self.huurder or ''246 if self.datum:247 title += ' | ' + self.datum248 return title249 def get_subtitle(self) -> str:250 return self.bron or ''251 def get_body_lines(self) -> List[str]:252 out = [253 self.locatie,254 self.sector,255 'eigenaar: ' + self.eigenaar if self.eigenaar else None,256 'huurder: ' + self.huurder if self.huurder else None,257 self.oppervlakte,258 self.prijs,259 self.opmerkingen,260 ]261 return [value for value in out if value]262class MaatboekHeemstedeDoc(BaseDocument):263 ligging: Optional[str] = Text(fields={'keyword': Keyword()})264 eigenaar: Optional[str] = Text(fields={'keyword': Keyword()})265 huurder: Optional[str] = Text(fields={'keyword': Keyword()})266 prijs: Optional[str] = Text(fields={'keyword': Keyword()})267 datum: Optional[str] = Text(fields={'keyword': Keyword()})268 jaar: Optional[int] = Short()269 bron: Optional[str] = Text(fields={'keyword': Keyword()})270 opmerkingen: Optional[str] = Text(fields={'keyword': Keyword()})271 class Index:272 name: str = 'maatboek_heemstede_index'273 def __new__(cls):274 return Index(name=cls.name)275 @classmethod276 def from_csv_line(cls, line: List[str]) -> Optional['MaatboekHeemstedeDoc']:277 # Return early, we'll discard it later using `is_valid`.278 if not any(parse_entry(value) for value in line[1:]):279 return None280 doc = cls()281 doc.meta.id = line[0]282 doc.ligging = parse_entry(line[1])283 doc.eigenaar = parse_entry(line[2])284 doc.huurder = parse_entry(line[3])285 doc.prijs = parse_entry(line[4])286 doc.datum = parse_entry(line[5])287 doc.bron = parse_entry(line[6])288 doc.opmerkingen = parse_entry(line[7])289 doc.jaar = cls.parse_year(doc.datum)290 return doc291 @staticmethod292 def parse_year(datum: Optional[str]) -> Optional[int]:293 res = re.search(r'\d{4}', datum or '')294 return int(res[0]) if res else None295 @staticmethod296 def get_multimatch_fields() -> List[str]:297 return ['liggng^3', 'datum^3', 'eigenaar^2', 'huurder^2', 'bron']298 @staticmethod299 def get_index_name_pretty():300 return 'Maatboek Heemstede'301 def get_title(self) -> str:302 title = self.ligging or self.eigenaar or self.huurder or ''303 if self.datum:304 title += ' | ' + self.datum305 return title306 def get_subtitle(self) -> str:307 return self.bron or ''308 def get_body_lines(self) -> List[str]:309 out = [310 self.ligging,311 'eigenaar: ' + self.eigenaar if self.eigenaar else None,312 'huurder: ' + self.huurder if self.huurder else None,313 self.prijs,314 self.opmerkingen,315 ]316 return [value for value in out if value]317class MaatboekBroekInWaterlandDoc(BaseDocument):318 sector: Optional[str] = Text(fields={'keyword': Keyword()})319 ligging: Optional[str] = Text(fields={'keyword': Keyword()})320 oppervlakte: Optional[str] = Text(fields={'keyword': Keyword()})321 eigenaar: Optional[str] = Text(fields={'keyword': Keyword()})322 datum: Optional[str] = Text(fields={'keyword': Keyword()})323 jaar: Optional[int] = Short()324 bron: Optional[str] = Text(fields={'keyword': Keyword()})325 opmerkingen: Optional[str] = Text(fields={'keyword': Keyword()})326 class Index:327 name: str = 'maatboek_broek_in_waterland_index'328 def __new__(cls):329 return Index(name=cls.name)330 @classmethod331 def from_csv_line(cls, line: List[str]) -> Optional['MaatboekBroekInWaterlandDoc']:332 # Return early, we'll discard it later using `is_valid`.333 if not any(parse_entry(value) for value in line[1:]):334 return None335 doc = cls()336 doc.meta.id = line[0]337 doc.sector = parse_entry(line[1])338 doc.ligging = parse_entry(line[2])339 doc.oppervlakte = parse_entry(line[3])340 doc.eigenaar = parse_entry(line[4])341 doc.datum = parse_entry(line[5])342 doc.bron = parse_entry(line[6])343 doc.opmerkingen = parse_entry(line[7])344 doc.jaar = cls.parse_year(doc.datum)345 return doc346 @staticmethod347 def parse_year(datum: Optional[str]) -> Optional[int]:348 res = re.search(r'\d{4}', datum or '')349 return int(res[0]) if res else None350 @staticmethod351 def get_multimatch_fields() -> List[str]:352 return ['sector^3', 'ligging^3', 'datum^3', 'eigenaar^2', 'oppervlakte', 'bron']353 @staticmethod354 def get_index_name_pretty():355 return 'Maatboek Broek in Waterland'356 def get_title(self) -> str:357 title = self.sector or self.ligging or self.eigenaar or ''358 if self.datum:359 title += ' | ' + self.datum360 return title361 def get_subtitle(self) -> str:362 return self.bron or ''363 def get_body_lines(self) -> List[str]:364 out = [365 self.sector,366 self.ligging,367 self.oppervlakte,368 'eigenaar: ' + self.eigenaar if self.eigenaar else None,369 self.opmerkingen,370 ]371 return [value for value in out if value]372class MaatboekSuderwoude(BaseDocument):373 sector: Optional[str] = Text(fields={'keyword': Keyword()})374 ligging: Optional[str] = Text(fields={'keyword': Keyword()})375 oppervlakte: Optional[str] = Text(fields={'keyword': Keyword()})376 eigenaar: Optional[str] = Text(fields={'keyword': Keyword()})377 datum: Optional[str] = Text(fields={'keyword': Keyword()})378 jaar: Optional[int] = Short()379 bron: Optional[str] = Text(fields={'keyword': Keyword()})380 opmerkingen: Optional[str] = Text(fields={'keyword': Keyword()})381 class Index:382 name: str = 'maatboek_suderwoude_index'383 def __new__(cls):384 return Index(name=cls.name)385 @classmethod386 def from_csv_line(cls, line: List[str]) -> Optional['MaatboekSuderwoude']:387 # Return early, we'll discard it later using `is_valid`.388 if not any(parse_entry(value) for value in line[1:]):389 return None390 doc = cls()391 doc.meta.id = line[0]392 doc.sector = parse_entry(line[1])393 doc.ligging = parse_entry(line[2])394 doc.oppervlakte = parse_entry(line[3])395 doc.eigenaar = parse_entry(line[4])396 doc.datum = parse_entry(line[5])397 doc.bron = parse_entry(line[6])398 doc.opmerkingen = parse_entry(line[7])399 doc.jaar = cls.parse_year(doc.datum)400 return doc401 @staticmethod402 def parse_year(datum: Optional[str]) -> Optional[int]:403 res = re.search(r'\d{4}', datum or '')404 return int(res[0]) if res else None405 @staticmethod406 def get_multimatch_fields() -> List[str]:407 return ['sector^3', 'ligging^3', 'datum^3', 'eigenaar^2', 'oppervlakte', 'bron']408 @staticmethod409 def get_index_name_pretty():410 return 'Maatboek Suderwoude'411 def get_title(self) -> str:412 title = self.sector or self.ligging or self.eigenaar or ''413 if self.datum:414 title += ' | ' + self.datum415 return title416 def get_subtitle(self) -> str:417 return self.bron or ''418 def get_body_lines(self) -> List[str]:419 out = [420 self.sector,421 self.ligging,422 self.oppervlakte,423 'eigenaar: ' + self.eigenaar if self.eigenaar else None,424 self.opmerkingen,425 ]426 return [value for value in out if value]427class EigendomsaktenHeemskerk(BaseDocument):428 datum: Optional[str] = Text(fields={'keyword': Keyword()})429 plaats: Optional[str] = Text(fields={'keyword': Keyword()})430 verkoper: Optional[str] = Text(fields={'keyword': Keyword()})431 koper: Optional[str] = Text(fields={'keyword': Keyword()})432 omschrijving: Optional[str] = Text(fields={'keyword': Keyword()})433 belending: Optional[str] = Text(fields={'keyword': Keyword()})434 bron: Optional[str] = Text(fields={'keyword': Keyword()})435 opmerkingen: Optional[str] = Text(fields={'keyword': Keyword()})436 jaar: Optional[int] = Short()437 class Index:438 name: str = 'eigendomsakten_heemskerk_index'439 def __new__(cls):440 return Index(name=cls.name)441 @classmethod442 def from_csv_line(cls, line: List[str]) -> Optional['EigendomsaktenHeemskerk']:443 # Return early, we'll discard it later using `is_valid`.444 if not any(parse_entry(value) for value in line[1:]):445 return None446 doc = cls()447 doc.meta.id = line[0]448 doc.datum = parse_entry(line[1])449 doc.plaats = parse_entry(line[2])450 doc.verkoper = parse_entry(line[3])451 doc.koper = parse_entry(line[4])452 doc.omschrijving = parse_entry(line[5])453 doc.belending = parse_entry(line[6])454 doc.bron = parse_entry(line[7])455 doc.opmerkingen = parse_entry(line[7])456 doc.jaar = cls.parse_year(doc.datum)457 return doc458 @staticmethod459 def parse_year(datum: Optional[str]) -> Optional[int]:460 res = re.search(r'\d{4}', datum or '')461 return int(res[0]) if res else None462 @staticmethod463 def get_multimatch_fields() -> List[str]:464 return ['datum^3', 'plaats^3', 'verkoper', 'koper', 'omschrijving', 'belending', 'bron']465 @staticmethod466 def get_index_name_pretty():467 return 'Eigendomsakten Heemskerk'468 def get_title(self) -> str:469 title = self.datum or ''470 return title471 def get_subtitle(self) -> str:472 return self.bron or ''473 def get_body_lines(self) -> List[str]:474 out = [475 'verkoper: ' + self.verkoper if self.verkoper else None,476 'koper: ' + self.koper if self.koper else None,477 self.omschrijving,478 'belending: ' + self.belending if self.belending else None,479 self.opmerkingen,480 ]481 return [value for value in out if value]482class BaseTransportregisterDoc(BaseDocument):483 datum: Optional[str] = Text(fields={'keyword': Keyword()})484 inhoud: Optional[str] = Text()485 bron: Optional[str] = Text(fields={'keyword': Keyword()})486 getuigen: Optional[str] = Text()487 bijzonderheden: Optional[str] = Text()488 jaar: Optional[int] = Short()489 @classmethod490 def from_csv_line(cls, line: List[str]) -> Optional['BaseTransportregisterDoc']:491 doc = cls()492 if len(line[0]) == 0:493 return None494 doc.meta.id = int(line[0])495 doc.datum = parse_entry(line[1])496 doc.inhoud = parse_entry(line[2])497 doc.bron = parse_entry(line[3])498 doc.getuigen = parse_entry(line[4])499 doc.bijzonderheden = parse_entry(line[5])500 if not doc.is_valid():501 return None502 if doc.datum is not None:503 doc.jaar = create_year(str(doc.datum))504 return doc505 def is_valid(self):506 # At the end of a file there may be empty lines, skip them.507 if getattr(self.meta, 'id', None) is None:508 return False509 # Skip row if there is no data except an id. This happens a lot at the end of a file.510 if self.datum is None:511 return False512 return True513 @staticmethod514 def get_multimatch_fields() -> List[str]:515 return ['datum^3', 'inhoud^2', 'getuigen', 'bron']516 def get_title(self) -> str:517 return '{}'.format(self.datum or '')518 def get_subtitle(self) -> str:519 return self.bron or ''520 def get_body_lines(self) -> List[str]:521 out = [self.inhoud, self.getuigen, self.bijzonderheden]522 return [value for value in out if value]523class TransportRegisterEgmondDoc(BaseTransportregisterDoc):524 class Index:525 name: str = 'transportregister_egmond'526 def __new__(cls):527 return Index(name=cls.name)528 @staticmethod529 def get_index_name_pretty():530 return 'Transportregister Egmond'531class TransportRegisterBloemendaalDoc(BaseTransportregisterDoc):532 class Index:533 name: str = 'transportregister_bloemendaal'534 def __new__(cls):535 return Index(name=cls.name)536 @staticmethod537 def get_index_name_pretty():538 return 'Transportregister Bloemendaal'539def parse_entry(entry: str) -> Optional[str]:540 return entry.strip() or None541def list_doctypes() -> List[Type[BaseDocument]]:542 return [543 CardNameDoc,544 VoornamenDoc,545 JaartallenDoc,546 MaatboekHeemskerkDoc,547 MaatboekHeemstedeDoc,548 MaatboekBroekInWaterlandDoc,549 MaatboekSuderwoude,550 EigendomsaktenHeemskerk,551 TransportRegisterEgmondDoc,552 TransportRegisterBloemendaalDoc,553 ]...

Full Screen

Full Screen

run_05_scrape_gpu.py

Source:run_05_scrape_gpu.py Github

copy

Full Screen

...17# pip3 install --user fuzzywuzzy18def gen_url(keywords="", categoryId="225", locationStr="", locationId="", radius="", sortingField="SORTING_DATE", adType="", posterType="", pageNum="1", action="find", maxPrice="", minPrice="", extra=""):19 return (("https://www.ebay-kleinanzeigen.de/s-suchanfrage.html?&keywords={}&categoryId={}&locationStr={}&locationId={}&radius={}&sortingField={}&adType={}&posterType={}&pageNum={}&action={}&maxPrice={}&minPrice={}")+(extra)).format(urllib.parse.quote(keywords), urllib.parse.quote(categoryId), urllib.parse.quote(locationStr), urllib.parse.quote(locationId), urllib.parse.quote(radius), urllib.parse.quote(sortingField), urllib.parse.quote(adType), urllib.parse.quote(posterType), urllib.parse.quote(pageNum), urllib.parse.quote(action), urllib.parse.quote(maxPrice), urllib.parse.quote(minPrice))20df=pd.read_csv("techpowerup_gpu-specs_details_1560095490.csv")21def parse_entry(row, column=None, value_p=None):22 try:23 entry=row[column]24 if ( ((pd.isnull(entry)) or (((entry)==("unknown")))) ):25 value=np.nan26 unit=""27 else:28 entry_stripped=entry.strip()29 entry_parts=entry_stripped.split(" ")30 value_string=entry_parts[0].replace(",", "")31 value=((((((value_string)==("System"))) and (np.nan))) or (float(value_string)))32 unit=" ".join(entry_parts[1:])33 if ( ("GFLOPS" in unit) ):34 unit=unit.replace("GFLOPS", "TFLOPS")35 value=((value)/(1000))36 if ( ("MPixel" in unit) ):37 unit=unit.replace("MPixel", "GPixel")38 value=((value)/(1000))39 if ( ("MTexel" in unit) ):40 unit=unit.replace("MTexel", "GTexel")41 value=((value)/(1000))42 if ( ("MVertices" in unit) ):43 unit=unit.replace("MVertices", "GVertices")44 value=((value)/(1000))45 except Exception as e:46 print("warn {}".format(e))47 return np.nan48 if ( value_p ):49 return value50 else:51 return unit52def parse_date(row, column=None, value_p=None):53 str=row[column]54 try:55 return pd.to_datetime(str)56 except Exception as e:57 return np.nan58df["tflops16"]=df.apply(lambda row: parse_entry(row, column="Theoretical Performance FP16 (half) performance", value_p=True), axis=1)59df["tflops16_unit"]=df.apply(lambda row: parse_entry(row, column="Theoretical Performance FP16 (half) performance", value_p=False), axis=1)60df["tflops32"]=df.apply(lambda row: parse_entry(row, column="Theoretical Performance FP32 (float) performance", value_p=True), axis=1)61df["tflops32_unit"]=df.apply(lambda row: parse_entry(row, column="Theoretical Performance FP32 (float) performance", value_p=False), axis=1)62df["tflops64"]=df.apply(lambda row: parse_entry(row, column="Theoretical Performance FP64 (double) performance", value_p=True), axis=1)63df["tflops64_unit"]=df.apply(lambda row: parse_entry(row, column="Theoretical Performance FP64 (double) performance", value_p=False), axis=1)64df["pixel_rate"]=df.apply(lambda row: parse_entry(row, column="Theoretical Performance Pixel Rate", value_p=True), axis=1)65df["pixel_rate_unit"]=df.apply(lambda row: parse_entry(row, column="Theoretical Performance Pixel Rate", value_p=False), axis=1)66df["tex_rate"]=df.apply(lambda row: parse_entry(row, column="Theoretical Performance Texture Rate", value_p=True), axis=1)67df["tex_rate_unit"]=df.apply(lambda row: parse_entry(row, column="Theoretical Performance Texture Rate", value_p=False), axis=1)68df["vertex_rate"]=df.apply(lambda row: parse_entry(row, column="Theoretical Performance Vertex Rate", value_p=True), axis=1)69df["vertex_rate_unit"]=df.apply(lambda row: parse_entry(row, column="Theoretical Performance Vertex Rate", value_p=False), axis=1)70df["transistors"]=df.apply(lambda row: parse_entry(row, column="Graphics Processor Transistors", value_p=True), axis=1)71df["transistors_unit"]=df.apply(lambda row: parse_entry(row, column="Graphics Processor Transistors", value_p=False), axis=1)72df["mem_bandwidth"]=df.apply(lambda row: parse_entry(row, column="Memory Bandwidth", value_p=True), axis=1)73df["mem_bandwidth_unit"]=df.apply(lambda row: parse_entry(row, column="Memory Bandwidth", value_p=False), axis=1)74df["die_size"]=df.apply(lambda row: parse_entry(row, column="Graphics Processor Die Size", value_p=True), axis=1)75df["die_size_unit"]=df.apply(lambda row: parse_entry(row, column="Graphics Processor Die Size", value_p=False), axis=1)76df["tdp"]=df.apply(lambda row: parse_entry(row, column="Board Design TDP", value_p=True), axis=1)77df["tdp_unit"]=df.apply(lambda row: parse_entry(row, column="Board Design TDP", value_p=False), axis=1)78df["release_date"]=df.apply(lambda row: parse_date(row, column="Graphics Card Release Date", value_p=True), axis=1)79# no unit80df["launch_price"]=df.apply(lambda row: parse_entry(row, column="Graphics Card Launch Price", value_p=True), axis=1)81df["launch_price_unit"]=df.apply(lambda row: parse_entry(row, column="Graphics Card Launch Price", value_p=False), axis=1)82df["process_size"]=df.apply(lambda row: parse_entry(row, column="Graphics Processor Process Size", value_p=True), axis=1)83df["process_size_unit"]=df.apply(lambda row: parse_entry(row, column="Graphics Processor Process Size", value_p=False), axis=1)84url=gen_url(keywords="", categoryId="225", maxPrice="350", minPrice="120", locationStr="Kempen+-+Nordrhein-Westfalen", locationId="1139", radius="4000", extra="&attributeMap[pc_zubehoer_software.art_s]=grafikkarten")85print("get {}".format(url))86r=requests.get(url)87content=r.text.replace("&#8203", "")88soup=BeautifulSoup(content, "html.parser")89articles=soup.find_all("article", {("class"):("aditem")})90if ( articles is None ):91 logging.info("No graphics cards.")92# parse articles93print("found {} articles.".format(len(articles)))94res=[]95for article in articles:96 try:97 details=article.find("div", {("class"):("aditem-details")})...

Full Screen

Full Screen

test_parser.py

Source:test_parser.py Github

copy

Full Screen

1#!/usr/bin/env python2# -*- encoding: utf-8 -*-3import os.path4from tests.conftest import get_testcount5from tests.parser.test_conll import conll_tests, parse_test_f6import itertools7import inspect8def test_parse(parse_entry):9 testpadas = [t[1] for t in parse_entry]10 status, parse = parse_test_f(parse_entry, testpadas)11 assert status12def pytest_generate_tests(metafunc):13 test_count = get_testcount(metafunc.config)14 if 'parse_entry' in metafunc.fixturenames:15 base_dir = os.path.dirname(os.path.abspath(16 inspect.getfile(inspect.currentframe())))17 data_dir = os.path.join(base_dir, 'parser')18 manual_file = open(os.path.join(data_dir, "golden.conll"), "rt")19 if test_count > 0:20 parse_entries = itertools.islice(conll_tests(manual_file), test_count)21 else:22 parse_entries = conll_tests(manual_file)23 metafunc.parametrize("parse_entry", list(parse_entries))...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful