Best Python code snippet using localstack_python
checksum.py
Source:checksum.py
...62 #return hex(s)63 #return hex( (1L<<32) + s) [-9:-1]64 #return ('%x' % ( (1L<<32) + s)) [-8:]65 return hexlify( pack( '>l', s) )66 class checksum_crc32( object):67 __slots__ = [ 's' ]68 crc32 = None69 hexlify = None70 def __init__( me, data=''):71 me.s = me.crc32( data)72 def update( me, data): #slow73 me.s = me.crc32( data, me.s)74 def digest( me): return me.s75 def digest2( me): return _digest4int( me.s)76 def hexdigest( me): return _hexdigest4int( me.s)77 def __str__( me):78 return 'checksum_crc32:'+me.hexdigest()79 def from_iter( klas, data):80 m = klas()...
build.py
Source:build.py
1#!/usr/bin/python2import os3import datetime4import shutil5BUILD_LOG_FILE = 'build_log.txt'6BUILD_COMMAND = 'D:\\Keil_v5\\UV4\\UV4.exe -sg -j0 -b oled_clock_th.uvproj -o ./build_log.txt'7COPY_OUT_FILE = 'copy output\\oled_clock_th.hex run'8OUT_FILE_NAME = 'oled_clock_th.hex'9CHECKSUM_ALL = 'checksum.exe oled_clock_th.hex ALL'10CHECKSUM_CHECKSUM = 'checksum.exe oled_clock_th.hex CHECKSUM'11CHECKSUM_CRC16 = 'checksum.exe oled_clock_th.hex CRC16'12CHECKSUM_CRC32 = 'checksum.exe oled_clock_th.hex CRC32'13CHECKSUM_SHA256 = 'checksum.exe oled_clock_th.hex SHA256'14def rm_output():15 # å é¤outputæ件夹16 name = "output"17 path = "./" + name18 if os.path.exists(path):19 shutil.rmtree(path)20def build():21 # ç¼è¯é¡¹ç®22 os.system(BUILD_COMMAND)23def log_file_print():24 # è¾åºç¼è¯logæ件25 with open(BUILD_LOG_FILE, "r") as f:26 data = f.read()27 print(data)28def copy_hex_file():29 # å¤å¶è¾åºæ件å°runç®å½30 os.system(COPY_OUT_FILE)31def checksum_hex_file():32 # åæ¢ç®å½å°run33 path = "./run"34 os.chdir(path)35 # è¾åºæ件éè¦çä¿¡æ¯36 os.system(CHECKSUM_ALL)37 #os.system(CHECKSUM_CHECKSUM)38 #os.system(CHECKSUM_CRC16)39 #os.system(CHECKSUM_CRC32)40 #os.system(CHECKSUM_SHA256)41def main():42 start = datetime.datetime.now()43 rm_output()44 build()45 log_file_print()46 copy_hex_file()47 checksum_hex_file()48 end = datetime.datetime.now()49 print('run time: %s second' %(end - start))50if __name__ == "__main__":...
configuration_entry.py
Source:configuration_entry.py
1class ConfigurationEntry(object):2 def __init__(self, *args, **kwargs):3 self.label: str = ""4 self.description: str = ""5 self.file: str = ""6 self.version: str = ""7 self.address: str = ""8 self.size: str = ""...
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!!