How to use aton method in autotest

Best Python code snippet using autotest_python

registNaverToOther.py

Source:registNaverToOther.py Github

copy

Full Screen

1from tkinter import filedialog, filedialog2import xlrd, xlwt3import os,getpass4stock = 495def AtoN(alphabet):6 idxAlp = {"A":1,"B":2,"C":3,"D":4,"E":5,"F":6,"G":7,"H":8,"I":9,"J":10,"K":11,"L":12,"M":13,"N":14,"O":15,"P":16,"Q":17,"R":18,"S":19,"T":20,"U":21,"V":22,"W":23,"X":24,"Y":25,"Z":26}7 alphabet = alphabet.upper()8 idx = -19 for i in range(len(alphabet)):10 idx += idxAlp[alphabet[len(alphabet)-1-i]]*(26**i)11 return idx12def cartegoryConverter(code):13 if code == 50000567:14 return ['00110007000500000000','16692000','100000064200001420300026288','1009448']15 else:16 return ['need','insert','code','to here']17def shipFeeEMS(fee):18 # 유료/4,000원/선결제 3942622119 # 유료/3,000원/선결제 3768789120 # 유료/2,500원/선결제 3841374221 # 무료 3713196822 fee = int(fee)23 if fee == 0:24 return 3713196825 elif 0 < fee <= 2500:26 return 3841374227 elif 2500 < fee <= 3000:28 return 3768789129def priceConverter(naverPrice):30 if naverPrice < 1000:31 return round(naverPrice*1.075+5,-1)32 elif naverPrice < 10000:33 return round(naverPrice*1.075+50,-2)-1034 elif naverPrice < 30000:35 return round(naverPrice*1.075+500,-3)-1036 else:37 return round(naverPrice*1.075+5000,-4)-10038def optionConverter(opT, opV):39 tail = ',정상,노출,'+str(stock)+','+str(stock)40 if opT != '' and opV != '':41 opTitle = opT.split('/')42 tempOpTitle = []43 for ii in opTitle:44 ii = ii.strip()45 if '색상'==ii or '사이즈'==ii:46 tempOpTitle.append(ii)47 elif 'size'==ii or '크기'==ii:48 tempOpTitle.append('사이즈')49 elif '컬러'==ii or '칼라'==ii:50 tempOpTitle.append('색상')51 elif '선택옵션'==ii:52 tempOpTitle.append('색상')53 elif '선택'==ii:54 tempOpTitle.append('색상')55 elif '옵션'==ii:56 tempOpTitle.append('색상')57 else: 58 tempOpTitle = []59 opTitle = tempOpTitle60 if len(opTitle)==1:61 # EMS62 singeArray = opV.split(',')63 tempCell = ''64 for j in singeArray:65 tempCell += (j+tail+'\n')66 return ['선택형',opTitle[0],tempCell,'01' if opTitle[0] == '색상' else '02',opV.replace(',','|'),("0|"*len(singeArray))[:-1],((str(stock)+"|")*len(singeArray))[:-1],'']67 elif len(opTitle)==2:68 # EMS69 doubleArray = opV.split(',')70 ary0 = []71 ary1 = []72 for doub in doubleArray:73 if len(doub.split('/'))==2:74 ary0.append(doub.split('/')[0].strip())75 ary1.append(doub.split('/')[1].strip())76 ary0 = list(dict.fromkeys(ary0))77 ary0.sort()78 ary1 = list(dict.fromkeys(ary1))79 ary1.sort()80 tempDoubCell = ''81 for j in ary0:82 for jj in ary1:83 tempDoubCell += '{},{}{}\n'.format(j.strip(),jj.strip(),tail)84 opTitle11 =[]85 for ot in opTitle:86 if ot == '색상':87 opTitle11.append('01')88 elif ot == '사이즈':89 opTitle11.append('02')90 return ['조합형',','.join(opTitle),tempDoubCell,'\n'.join(opTitle11),'{}\n{}'.format('|'.join(ary0),'|'.join(ary1)),("0|"*len(doubleArray))[:-1],((str(stock)+"|")*len(doubleArray))[:-1],'']91 else:92 return ['error','error','error','error','error','error','error','error']93 else:94 return ['','','','','','','',stock]95def convertTo():96 downloadPath = os.environ['USERPROFILE'] +'\\Downloads'97 openFile = filedialog.askopenfile(initialdir=downloadPath,filetypes=[("Excel files", ".xls")])98 if openFile != None: 99 book = xlrd.open_workbook(openFile.name)100 # book = xlrd.open_workbook('C:/Users/titel/Downloads/new_1017/naver_1017.xls')101 sheetNaver = book.sheet_by_index(0)102 103 wtBook = xlwt.Workbook()104 sheetEMS = wtBook.add_sheet('EMS')105 sheet11 = wtBook.add_sheet('11st')106 # nrows, ncols107 for i in range(1, sheetNaver.nrows):108 cartegory = cartegoryConverter(sheetNaver.cell_value(rowx=i,colx=AtoN('b')))109 sheetEMS.write(i,AtoN('j'),cartegory[0])110 sheetEMS.write(i,AtoN('k'),cartegory[1])111 sheetEMS.write(i,AtoN('l'),cartegory[2])112 sheet11.write(i,AtoN('b'),cartegory[3])113 sheetEMS.write(i,AtoN('e'),sheetNaver.cell_value(rowx=i,colx=AtoN('c')))114 sheet11.write(i,AtoN('e'),sheetNaver.cell_value(rowx=i,colx=AtoN('c')))115 price = priceConverter(sheetNaver.cell_value(rowx=i,colx=AtoN('d')))116 sheetEMS.write(i,AtoN('n'),price)117 sheetEMS.write(i,AtoN('o'),price)118 sheet11.write(i,AtoN('ab'),price)119 sheetEMS.write(i,AtoN('aa'),sheetNaver.cell_value(rowx=i,colx=AtoN('j')))120 sheet11.write(i,AtoN('n'),sheetNaver.cell_value(rowx=i,colx=AtoN('j')))121 sheet11.write(i,AtoN('ar'),sheetNaver.cell_value(rowx=i,colx=AtoN('k')))122 sheetEMS.write(i,AtoN('ad'),shipFeeEMS(sheetNaver.cell_value(rowx=i,colx=AtoN('z'))))123 sheet11.write(i,AtoN('dd'),sheetNaver.cell_value(rowx=i,colx=AtoN('z')))124 sheetEMS.write(i,AtoN('ai'),sheetNaver.cell_value(rowx=i,colx=AtoN('ad')))125 sheet11.write(i,AtoN('di'),sheetNaver.cell_value(rowx=i,colx=AtoN('ad')))126 sheet11.write(i,AtoN('dk'),sheetNaver.cell_value(rowx=i,colx=AtoN('ae')))127 options = optionConverter(sheetNaver.cell_value(rowx=i,colx=AtoN('ay')),sheetNaver.cell_value(rowx=i,colx=AtoN('az')))128 sheetEMS.write(i,AtoN('v'),options[0])129 sheetEMS.write(i,AtoN('w'),options[1])130 sheetEMS.write(i,AtoN('x'),options[2])131 sheet11.write(i,AtoN('ad'),options[3])132 sheet11.write(i,AtoN('ae'),options[4])133 sheet11.write(i,AtoN('af'),options[5])134 sheet11.write(i,AtoN('ag'),options[6])135 sheet11.write(i,AtoN('aj'),options[7])136 # sheetEMS.write(i,AtoN(''),sheetNaver.cell_value(rowx=i,colx=AtoN('')))137 # sheet11.write(i,AtoN(''),sheetNaver.cell_value(rowx=i,colx=AtoN('')))138 sheetEMS.write(i,AtoN('b'),'옥션/G마켓')139 sheetEMS.write(i,AtoN('c'),'h7minor')140 sheetEMS.write(i,AtoN('d'),'h7minor')141 sheetEMS.write(i,AtoN('m'),'90')142 sheetEMS.write(i,AtoN('t'),stock)143 sheetEMS.write(i,AtoN('u'),stock)144 sheetEMS.write(i,AtoN('y'),'PUT IN IMAGE LINK')145 sheetEMS.write(i,AtoN('ab'),'일반택배')146 sheetEMS.write(i,AtoN('ac'),15676256)147 sheetEMS.write(i,AtoN('ae'),4640254)148 sheetEMS.write(i,AtoN('af'),1052181)149 sheetEMS.write(i,AtoN('ag'),1052184)150 sheetEMS.write(i,AtoN('ah'),10034)151 sheetEMS.write(i,AtoN('aj'),35)152 sheetEMS.write(i,AtoN('ak'),171104)153 sheetEMS.write(i,AtoN('al'),'인증대상아님')154 sheetEMS.write(i,AtoN('as'),'인증대상아님')155 sheetEMS.write(i,AtoN('aw'),'인증대상아님')156 sheetEMS.write(i,AtoN('bf'),'과세상품')157 sheet11.write(i,AtoN('i'),'PUT IN IMAGE LINK')158 sheet11.write(i,AtoN('p'),'01')159 sheet11.write(i,AtoN('r'),'01')160 sheet11.write(i,AtoN('s'),'01')161 sheet11.write(i,AtoN('t'),'108')162 sheet11.write(i,AtoN('ao'),'러나트')163 sheet11.write(i,AtoN('ap'),'Y')164 sheet11.write(i,AtoN('aq'),'01')165 sheet11.write(i,AtoN('as'),'01')166 sheet11.write(i,AtoN('aw'),'01|03\n02|03\n03|03\n04|05')167 sheet11.write(i,AtoN('ax'),'01')168 sheet11.write(i,AtoN('ba'),'891045')169 sheet11.write(i,AtoN('bb'),'23759100')170 sheet11.write(i,AtoN('bc'),'상품상세설명 참조')171 sheet11.write(i,AtoN('bd'),'23756033')172 sheet11.write(i,AtoN('be'),'상품상세설명 참조')173 sheet11.write(i,AtoN('bf'),'11905')174 sheet11.write(i,AtoN('bg'),'상품상세설명 참조')175 sheet11.write(i,AtoN('bh'),'23760413')176 sheet11.write(i,AtoN('bi'),'상품상세설명 참조')177 sheet11.write(i,AtoN('bj'),'11800')178 sheet11.write(i,AtoN('bk'),'상품상세설명 참조')179 sheet11.write(i,AtoN('cs'),'Y')180 sheet11.write(i,AtoN('ct'),'N')181 sheet11.write(i,AtoN('cy'),'01')182 sheet11.write(i,AtoN('cz'),'01')183 sheet11.write(i,AtoN('da'),'00099')184 sheet11.write(i,AtoN('db'),'1249484')185 sheet11.write(i,AtoN('dc'),'02')186 sheet11.write(i,AtoN('df'),'N')187 sheet11.write(i,AtoN('dg'),'03')188 sheet11.write(i,AtoN('dj'),'01')189 sheet11.write(i,AtoN('dl'),'상품 출고지/반품교환 주소가 달라서 자동수거접수가 불가합니다. A/S를 원하실 경우 판매자에게 연락주시거나 게시판에 남겨주시면 안내해 드리겠습니다. 단, 일부 품목의 경우 A/S가 불가능 할 수 있습니다.')190 sheet11.write(i,AtoN('dm'),'상품 출고지/반품교환 주소가 달라서 자동수거접수가 불가합니다. 반품을 원하실 경우 판매자에게 연락주시거나 게시판에 남겨주시면 안내해 드리겠습니다.')191 # print('\\'.join(openFile.name.split('/')[0:-1])+'\\Naver_To_EMS_11st.xls')192 wtBook.save('\\'.join(openFile.name.split('/')[0:-1])+'\\Naver_To_EMS_11st.xls')...

Full Screen

Full Screen

netutils.py

Source:netutils.py Github

copy

Full Screen

...8 except socket.error:9 raise #ValueError, "La stringa %s non e' un valido indirizzo IP" % addr10 return addr_ntoa11inet_ntoa = addr_ntoa12def addr_aton(addr):13 try:14 addr_aton = struct.unpack('!L', socket.inet_aton(addr))[0]15 except socket.error:16 raise ValueError, "La stringa %s non e' un valido indirizzo IP" % addr17 return addr_aton18inet_aton = addr_aton19def get_aton_bounds_from_cidr(base, bits):20 aton_base = inet_aton(base)21 full_aton_mask = 2**32 - 122 aton_mask = 2**(32 - bits) - 123 aton_haddr = aton_base | aton_mask24 aton_laddr = aton_base & (full_aton_mask - aton_mask)25 return (aton_laddr, aton_haddr)26def get_bounds_from_cidr(base, bits):27 aton_laddr, aton_haddr = get_aton_bounds_from_cidr(base, bits)28 return addr_ntoa(aton_laddr), addr_ntoa(aton_haddr)29def get_aton_bounds_from_ip_mask(ip, mask):30 aton_base = inet_aton(ip)31 aton_mask = 2**32 - 1 - inet_aton(mask)32 full_aton_mask = 2**32 - 133 aton_haddr = aton_base | aton_mask34 aton_laddr = aton_base & (full_aton_mask - aton_mask)35 return (aton_laddr, aton_haddr)36def ip_is_inside_inet_aton_range(ip, laddr_aton, haddr_aton):37 ip_aton = addr_aton(ip)38 if (ip_aton <= haddr_aton) and (ip_aton >= laddr_aton):39 return True40 else:41 return False42def ip_is_inside_inet_aton_ranges(ip, aton_ranges):43 ip_aton = addr_aton(ip)44 for laddr_aton, haddr_aton in aton_ranges:45 if (ip_aton <= haddr_aton) and (ip_aton >= laddr_aton):46 return True47 return False48def ip_is_inside_range(ip, laddr, haddr):49 laddr_aton = addr_aton(laddr)50 haddr_aton = addr_aton(haddr)51 return ip_is_inside_inet_aton_range(ip, laddr_aton, haddr_aton)52def explode_ip_range(laddr, haddr):53 laddr_aton = addr_aton(laddr)54 haddr_aton = addr_aton(haddr)55 ip_addrs = map(lambda x: addr_ntoa(x), range(laddr_aton, haddr_aton))56 return ip_addrs57private_ip_ranges = [58 ('192.168.0.0', '192.168.255.255'), ('172.16.0.0', '172.31.255.255'),59 ('10.0.0.0', '10.255.255.255')60]61exp_ip_ranges = [('224.0.0.0', '255.255.255.255')]62aton_private_ranges = map(lambda r: (addr_aton(r[0]), addr_aton(r[1])),63 private_ip_ranges)64aton_exp_ip_ranges = map(lambda r: (addr_aton(r[0]), addr_aton(r[1])),65 exp_ip_ranges)66#------------------------------------------------------------------------------67# TEST network utilities68def aaaa(addr):69 public_srv_addrs = []70 c = 071 for aton_r in aton_private_ranges:72 if ip_is_inside_inet_aton_range(addr, aton_r[0], aton_r[1]):73 break74 else:75 c += 176 if c == len(aton_private_ranges):77 public_srv_addrs.append(addr)78 return public_srv_addrs...

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