How to use separator method in tox

Best Python code snippet using tox_python

bookstore_manangement_system.py

Source:bookstore_manangement_system.py Github

copy

Full Screen

...17 delete="delete from books where Numbers_of_book<=0"18 mycur.execute(delete)19 mycon.commit()20 21def separator():22 print()23 print("\t\t========================================")24 print()25 26def end_separator():27 print()28 print()29 30def login():31 32 user_name=input(" USER NAME --- ")33 passw=input(" PASSWORD --- ")34 display='select * from login'35 mycur.execute(display)36 data2=mycur.fetchall()37 for y in data2:38 if y[1]==user_name and y[2]==passw:39 pass40 else:41 42 43 separator()44 45 print(" Username or Password is Incorrect Try Again")46 separator()47 48 user_name=input(" USER NAME --- ")49 passw=input(" PASSWORD --- ")50 if y[1]==user_name and y[2]==passw:51 52 pass53 else:54 separator()55 56 print(" Username or Password is Again Incorrect")57 exit()58 59def ViewAll():60 61 print("\u0332".join("BOOK NAMES~~"))62 print("------------------------------------")63 64 display='select * from books'65 mycur.execute(display)66 data2=mycur.fetchall()67 c=068 69 for y in data2:70 c=c+171 print(c,"-->",y[1])72 73def CNB1():74 if y[6]==0:75 separator()76 print(" NOW THIS BOOK IS NOT AVAILABLE ")77 elif y[6]>0 and y[6]<=8:78 separator()79 print("WARNING!!!!!!!!!!!!!!!!!!!!!!!")80 print("NO. OF THIS BOOK IS LOW","\tONLY",y[6]-1,"LEFT")81 print()82 print()83 84 85 86 elif y[6]>8:87 separator()88 89 print("NO. OF BOOKS LEFT IS ",y[6]-1)90 print()91 print()92def CNB2():93 if y[6]<=8:94 separator()95 print("WARNING!!!!!!!!!!!!!!!!!!!!!!!")96 print("NO. OF THIS BOOK IS LOW","\tONLY",y[6],"LEFT")97 98 99 else:100 separator()101 print("NO. OF BOOKS LEFT IS ",y[6])102 103 104separator()105# LOGIN106display12='select * from visit'107mycur.execute(display12)108data2222=mycur.fetchall()109for m in data2222:110 if m[0]==0:111 112 c=m[0] 113 display11='select * from login'114 mycur.execute(display11)115 data222=mycur.fetchall()116 if c==0:117 118 if c==0:119 120 print("\t\t\t\t REGESTER ")121 print("\t\t\t\t----------------------------")122 print()123 print()124 125 user_name=input("ENTER USER NAME -- ")126 passw=input("ENTER PASSWORD limit 8-20 -- ")127 lenght=len(passw)128 129 if lenght>=8 and lenght<=20:130 c=c+1131 insert55=(c,user_name,passw)132 insert22="insert into login values(%s,%s,%s)"133 mycur.execute(insert22,insert55)134 mycon.commit()135 separator()136 137 login()138 139 else:140 141 if lenght<8:142 143 separator()144 145 print(" Password Is less than 8 Characters Enter Again")146 147 separator()148 149 150 user_name2=input("ENTER USER NAME -- ")151 passw2=input("ENTER PASSWORD AGAIN (limit 8-20) -- ")152 lenght1=len(passw2)153 154 155 if lenght1>=8 and lenght1<=20:156 157 c=c+1158 insert555=(c,user_name2,passw2)159 insert222="insert into login values(%s,%s,%s)"160 mycur.execute(insert222,insert555)161 mycon.commit()162 163 separator()164 165 166 login()167 168 elif lenght>20:169 separator()170 171 print(" Password Is Greater than 20 Characters Enter Again")172 separator()173 174 user_name=input("ENTER USER NAME -- ")175 passw=input("ENTER PASSWORD AGAIN (limit 8-20) -- ")176 lenght=len(passw)177 178 if lenght>=8 and lenght>=20:179 180 c=c+1181 insert55=(c,user_name,passw)182 insert22="insert into login values(%s,%s,%s)"183 mycur.execute(insert22,insert55)184 mycon.commit()185 separator()186 187 login()188 update33="update visit set visits=%s"%(c)189 mycur.execute(update33)190 mycon.commit()191 192 193 elif m[0]==1:194 if m[0]==1:195 login()196 197separator()198DBZ()199# REPETITION200a=True201while a==True:202 # PROGRAM STARTED203 print(" *TO VIEW ALL ENTER 1")204 print(" *TO SEARCH and BUY BOOK ENTER 2")205 print(" *TO ADD BOOK ENTER 3")206 print(" *TO UPDATE ENTER 4")207 print(" *TO DELETE BOOK ENTER 5")208 print(" *TO CLOSE ENTER 6")209 print()210 choice=int(input("ENTER YOUR CHOICE -- "))211 separator()212 #VIEW213 if choice==1:214 print()215 216 ViewAll()217 218 separator()219 rep=input("Do You Want To Restart ?? yes / no -- ").lower()220 if rep=="yes":221 end_separator()222 separator()223 DBZ()224 continue225 else:226 end_separator()227 DBZ()228 229 os._exit(0)230 end_separator()231 232 233 #SEARCH / BUY234 if choice==2:235 236 book_name=input("ENTER BOOK NAME ---- ")237 separator()238 239 display="select * from books where Name='%s'"%(book_name)240 mycur.execute(display)241 data2=mycur.fetchone()242 243 if data2!=None:244 245 print("BOOK IS AVAILABLE")246 247 #BUY OR NOT248 separator()249 print("\t*WANT TO BUY PRESS 1")250 print("\t*IF NOT PRESS 2")251 print()252 253 choice2=int(input("ENTER YOUR CHOICE -- "))254 255 if choice2==1:256 257 #BUY 1 OR MORE258 separator()259 print("\t*IF YOU WANT ONE BOOK PRESS 1")260 print("\t*IF YOU WANT MORE THAN ONE BOOK PRESS 2")261 print()262 263 choice3=int(input("ENTER YOUR CHOICE -- "))264 265 if choice3==1:266 display='select * from books'267 mycur.execute(display)268 data2=mycur.fetchall()269 270 for y in data2:271 272 if y[1]==book_name:273 274 if y[6]>0:275 separator()276 u="update books set Numbers_of_book=Numbers_of_book - 1 where name='%s';"%(book_name)277 mycur.execute(u)278 mycon.commit()279 print("BOOK WAS BOUGHT")280 separator()281 print("THANKS FOR COMING")282 CNB1()283 separator()284 rep=input("Do You Want To Restart ?? yes / no -- ").lower()285 if rep=="yes":286 end_separator()287 separator()288 DBZ()289 continue290 else:291 end_separator()292 DBZ()293 294 os._exit(0)295 296 if choice3==2:297 separator()298 wb=int(input("ENTER NO. OF BOOKS -- "))299 separator()300 display='select * from books'301 mycur.execute(display)302 data2=mycur.fetchall()303 304 for y in data2:305 if y[1]==book_name:306 if wb>y[6]:307 308 if y[6]>0:309 310 print("YOU CAN'T BUT THAT MUCH BOOKS")311 separator()312 print("BUT YOU CAN BUY",y[6],"BOOKS MAX")313 separator()314 315 choice44=input("DO YOU WANT TO BUY BOOK ? Y/N -- ")316 separator()317 318 k=y[6]319 320 if choice44=="y" or choice44=="Y":321 322 u2="update books set numbers_of_book=numbers_of_book -%s where name='%s'"%(k,book_name)323 mycur.execute(u2)324 mycon.commit()325 print("BOOK WAS BOUGHT")326 separator()327 328 print("THANKS FOR COMING")329 330 separator()331 display='select * from books'332 mycur.execute(display)333 data2=mycur.fetchall()334 335 for y in data2:336 337 if y[1]==book_name:338 339 if y[6]<=8:340 341 print("WARNING!!!!!!!!!!!!!!!!!!!!!!!")342 print("NO. OF THIS BOOK IS LOW","\tONLY",y[6],"LEFT")343 end_separator()344 345 break346 separator()347 rep=input("Do You Want To Restart ?? yes / no -- ").lower()348 if rep=="yes":349 end_separator()350 separator()351 DBZ()352 continue353 else:354 end_separator()355 DBZ()356 357 os._exit(0)358 elif choice44=="n" or choice44=="N":359 360 print("SORRY FOR INCONVENIENCE WE WILL TRY TO FULLFILL YOUR REQUIREMENT AS SOON AS POSSIBLE")361 end_separator()362 363 separator()364 365 rep=input("Do You Want To Restart ?? yes / no -- ").lower()366 if rep=="yes":367 separator()368 DBZ()369 continue370 else:371 end_separator()372 DBZ()373 os._exit(0)374 375 elif y[6]==0:376 377 print("SORRY NO BOOK LEFT WE WILL TRY TO FULLFILL YOUR REQUIREMENT AS SOON AS POSSIBLE")378 end_separator()379 380 separator()381 382 rep=input("Do You Want To Restart ?? yes / no -- ").lower()383 if rep=="yes":384 separator()385 DBZ()386 continue387 else:388 389 end_separator()390 DBZ()391 os._exit(0)392 393 else:394 395 u2="update books set numbers_of_book=numbers_of_book -%s where name='%s'"%(wb,book_name)396 mycur.execute(u2)397 mycon.commit()398 print("BOOK WAS BOUGHT")399 separator()400 401 print("THANKS FOR COMING")402 403 display='select * from books'404 mycur.execute(display)405 data2=mycur.fetchall()406 407 for y in data2:408 409 if y[1]==book_name:410 411 CNB2()412 separator()413 414 rep=input("Do You Want To Restart ?? yes / no -- ").lower()415 if rep=="yes":416 separator()417 DBZ()418 continue419 else:420 end_separator()421 DBZ()422 os._exit(0)423 424 else:425 separator()426 427 print("NO BOOK IS BOUGHT")428 end_separator()429 430 separator()431 432 rep=input("Do You Want To Restart ?? yes / no -- ").lower()433 if rep=="yes":434 separator()435 DBZ()436 continue437 else:438 end_separator()439 DBZ()440 os._exit(0)441 442 else:443 separator()444 445 print("SORRY NO BOOK WITH THIS NAME EXIST / NAME IS INCORRECT")446 end_separator()447 448 separator()449 450 rep=input("Do You Want To Restart ?? yes / no -- ").lower()451 if rep=="yes":452 separator()453 DBZ()454 continue455 else:456 end_separator()457 DBZ()458 os._exit(0)459 460 # ADDING BOOK461 if choice==3:462 463 q10=int(input("ENTER NO. OF BOOKS TO ADD -- "))464 separator()465 466 for k in range(q10):467 468 SNo10=int(input("ENTER SNo OF BOOK -- "))469 name10=input("ENTER NAME OF BOOK --- ")470 author10=input("ENTER NAME OF AUTHOR -- ")471 year10=int(input("ENTER YEAR OF PUBLISHING -- "))472 ISBN10=input("ENTER ISBN OF BOOK -- ")473 price10=int(input("ENTER PRICE OF BOOK -- "))474 nob10=int(input("ENTER NO. OF BOOKS -- "))475 display10="select * from books where ISBN='%s'"%(ISBN10)476 mycur.execute(display10)477 data20=mycur.fetchone()478 479 if data20!=None:480 481 print("This ISBN Already Exists")482 os._exit(0)483 else:484 485 insert=(SNo10,name10,author10,year10,ISBN10,price10,nob10)486 insert20="insert into books values(%s,%s,%s,%s,%s,%s,%s)"487 mycur.execute(insert20,insert)488 mycon.commit()489 separator()490 491 print("BOOK IS ADDED")492 separator()493 494 495 rep=input("Do You Want To Restart ?? yes / no -- ").lower()496 if rep=="yes":497 separator()498 DBZ()499 continue500 501 else:502 end_separator()503 DBZ()504 os._exit(0)505 506 # UPDATING BOOK507 if choice==4:508 choice4=input("ENTER ISBN OF BOOK -- ")509 510 separator()511 512 display="select * from books where ISBN='%s'"%(choice4)513 mycur.execute(display)514 data2=mycur.fetchone()515 516 if data2!=None:517 518 SNo1=int(input("ENTER NEW SNo OF BOOK -- "))519 name1=input("ENTER NEW NAME OF BOOK --- ")520 author1=input("ENTER NEW NAME OF AUTHOR -- ")521 year1=int(input("ENTER NEW YEAR OF PUBLISHING -- "))522 ISBN1=input("ENTER NEW ISBN OF BOOK -- ")523 price1=int(input("ENTER NEW PRICE OF BOOK -- "))524 nob=int(input("ENTER NEW NO. OF BOOKS -- "))525 insert=(SNo1,name1,author1,year1,ISBN1,price1,nob,choice4)526 update="update books set SNo=%s,Name=%s,Author=%s,Year=%s,ISBN=%s,Price=%s,numbers_of_book=%s where ISBN=%s"527 mycur.execute(update,insert)528 mycon.commit()529 530 separator()531 532 print("BOOK IS UPDATED")533 534 separator()535 536 rep=input("Do You Want To Restart ?? yes / no -- ").lower()537 if rep=="yes":538 separator()539 DBZ()540 continue541 542 else:543 end_separator()544 DBZ()545 os._exit(0)546 547 else:548 549 print("SORRY NO BOOK WITH THIS ISBN IS EXIST / INCORRECT ISBN")550 print()551 print()552 separator()553 554 rep=input("Do You Want To Restart ?? yes / no -- ").lower()555 if rep=="yes":556 separator()557 DBZ()558 continue559 560 else:561 end_separator()562 DBZ()563 os._exit(0)564 565 # DELETING A BOOK566 if choice==5:567 568 ISBN1=input("ENTER ISBN OF THAT BOOK THAT YOU WANT TO DELETE -- ")569 display="select * from books where ISBN='%s'"%(ISBN1)570 mycur.execute(display)571 data2=mycur.fetchone()572 573 if data2!=None:574 separator()575 576 choice5=input("ARE YOU SURE TO DELETE THIS BOOK ENTER Y/N -- ")577 578 if choice5=='Y' or choice5=='y':579 separator()580 581 ISBN2=input("PLEASE ENTER ISBN AGAIN -- ")582 delete="delete from books where ISBN='%s'"%(ISBN2)583 mycur.execute(delete)584 mycon.commit()585 586 separator()587 print("BOOK IS DELETED")588 print()589 print()590 separator()591 592 rep=input("Do You Want To Restart ?? yes / no -- ").lower()593 if rep=="yes":594 separator()595 DBZ()596 continue597 598 else:599 end_separator()600 DBZ()601 os._exit(0)602 603 else:604 605 separator()606 607 print("NO BOOK IS DELETED")608 print()609 print()610 separator()611 612 rep=input("Do You Want To Restart ?? yes / no -- ").lower()613 if rep=="yes":614 separator()615 DBZ()616 continue617 618 else:619 end_separator()620 DBZ()621 os._exit(0)622 623 else:624 separator()625 626 print("SORRY NO BOOK WITH THIS ISBN AVAILABLE / ISBN IS INCORRECT")627 print()628 print()629 separator()630 631 rep=input("Do You Want To Restart ?? yes / no -- ").lower()632 if rep=="yes":633 separator()634 DBZ()635 continue636 637 else:638 end_separator()639 DBZ()640 os._exit(0)641 642 # CLOSE643 if choice==6:644 exit()645 os._exit(0)646 647# IF NO. OF BOOKS IS ZERO( 0 ) THAN DELETE IT AUTOMATICALLY648display="select * from books"649mycur.execute(display)650data2=mycur.fetchall()651for y in data2:652 ...

Full Screen

Full Screen

label_reader_writer.py

Source:label_reader_writer.py Github

copy

Full Screen

...8 has_id = any(character.isdigit() for character in labels[0])9 names = labels[0]10 id_separator = ""11 if has_id:12 id_separator = get_id_separator(labels[0])13 names = labels[0].split(id_separator, 1)[1]14 names_separator = get_names_separator(names)15 id_list = []16 name_list = []17 for label in labels:18 if has_id:19 id_and_names = label.split(id_separator, 1)20 name_list.append(id_and_names[1].split(names_separator))21 id_list.append(id_and_names[0])22 else:23 name_list.append(label.split(names_separator))24 id_list.append("")25 return {"id_list": id_list, "name_list": name_list, "id_separator": id_separator, "name_separator": names_separator}26def write_labels_file(file_location: str, translations: List[List[str]], reader_output: dict):27 id_separator = reader_output["id_separator"].encode('utf8')28 writer = open(file_location, 'wb')29 for i in range(len(reader_output["id_list"])):30 writer.write(reader_output["id_list"][i].encode('utf8'))31 writer.write(id_separator)32 writer.write(reader_output["name_separator"].join(translations[i]).encode('utf8'))33 writer.write("\n".encode('utf8'))34 writer.close()35def get_id_separator(id_and_names: str) -> str:36 id_length = id_and_names.find(" ")37 id_separator = " "38 for sep in __separators:39 separated_length = id_and_names.find(sep)40 if id_length > separated_length != -1 or id_length == -1:41 id_length = separated_length42 id_separator = sep43 index = id_and_names.find(id_separator)44 if index != -1:45 if id_and_names[index + 1] == " ":46 id_separator += " "47 else:48 return ""49 return id_separator50def get_names_separator(names: str) -> str:51 for sep in __separators:52 if sep in names:53 index = names.index(sep)54 if names[index + 1] == " ":55 sep += " "56 return sep57 return ""58def read_labels_code(file_location: str) -> dict:59 with open(file_location, 'r') as f:60 text = f.read()61 result = re.search(__pattern, text).group(0)62 if "\"" in result:63 separator = "\""64 else:...

Full Screen

Full Screen

StreamTokenWriter.py

Source:StreamTokenWriter.py Github

copy

Full Screen

...30 Wpisuje zawartosc buffora do strumienia31 """32 buffer = buffer if isinstance(buffer, (bytes, bytearray)) else buffer.encode('utf8')33 self._stream.write_all(buffer)34 def write_separator(self, separator=None):35 """36 Wpisuje sam separator37 """38 if separator:39 separator = separator if isinstance(separator, (bytes, bytearray)) else separator.encode('utf8')40 separator = separator or self.separator...

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 tox 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