Best Python code snippet using autotest_python
menearead.py
Source:menearead.py  
1###############################################2# This script reads and converts the menaion. #3#        Glory to God in the Highest          #4###############################################5import re6months = ['JANUÃR','FEBRUÃR','MÃRCIUS','ÃRPILIS','MÃJUS','JÃNIUS','JÃLIUS','AUGUSZTUS','SZEPTEMBER','OKTÃBER','NOVEMBER','DECEMBER']7# Check if there is a date in the line8def checkDate(st) :9    result = '0'10    i = 011    for i in months :12        if i in st :13            mth = str(months.index(i)+1).rstrip()14            if int(mth) < 10 : mth = '0'+mth15            day = re.sub('[^0-9]','',st.split(i)[1])16            if day != '' :17                if int(day) < 10 : day = '0'+day18                result = '['+mth+'.'+day+']'19    return result20def replaceHungarian(st) :21    st = st.replace(' ','')22    st = st.replace('á','a')23    st = st.replace('é','e')24    st = st.replace('Ã','i')25    st = st.replace('ó','o')26    st = st.replace('ö','o')27    st = st.replace('Å','o')28    st = st.replace('ú','u')29    st = st.replace('ü','u')30    st = st.replace('ű','u')31    st = st.replace('Ã','A')32    st = st.replace('Ã','E')33    st = st.replace('Ã','I')34    st = st.replace('Ã','O')35    st = st.replace('Ã','O')36    st = st.replace('Å','O')37    st = st.replace('Ã','U')38    st = st.replace('Ã','U')39    st = st.replace('Ű','U')40    return st41# Check similarity between strings42def checkSimilar(template,st) :43    ratio = 0.044    template = replaceHungarian(template)45    st = replaceHungarian(st)46    maxmatch = 047    tmp = template48    i = len(tmp)49    while i > 2 :50        i = len(tmp)51        if tmp in st and i > maxmatch : maxmatch = i52        tmp = tmp[1:]53    tmp = template54    i = len(tmp)55    while i > 2 :56        i = len(tmp)57        if tmp in st and i > maxmatch : maxmatch = i58        tmp = tmp[:-1]59    ratio = maxmatch/len(template)    60    return ratio61# Main loop62fname = 'menea_5_6'63date = '00.00'64section = ''65ode = 066tone = ''67### Normalizing68print('+++ '+fname+' is being normalzed. +++')69new = open('Books/'+fname+'_normalized.txt','w',encoding='utf8')70with open('Books/'+fname+'.txt','rb') as file :71    while True :72        line = file.readline().decode('utf8')73        if not line : break74        render = False75        line = line.rstrip('-\r\n')+' '76        if section != '' : render = True77        linedate = checkDate(line)78        newsection = ''79        # Check for section starts80        if checkSimilar('Uram, tehozzád...',line) > 0.6 : newsection = 'LIC'81        if checkSimilar('ElÅverses sztihirák:',line) > 0.6 : newsection = 'APO'82        if checkSimilar('Tropár. hang.',line) > 0.6 : newsection = 'TRP'83        if checkSimilar('Kathizma:',line) > 0.6 : newsection = 'KTH'84        if checkSimilar('Az elsÅ zsoltárcsoport után',line) > 0.6 : newsection = '1ST'85        if checkSimilar('A második zsoltárcsoport után',line) > 0.6 : newsection = '2ST'86        if checkSimilar('. óda.',line) > 0.6 :87            if ode == 1 : ode = 288            ode += 189            newsection = 'OD'+str(ode)90        if checkSimilar('Konták:',line) > 0.6 : newsection = 'KNT'91        if checkSimilar('Ikosz.',line) > 0.6 : newsection = 'IKS'92        if checkSimilar('Fényének:',line) > 0.6 : newsection = 'EXA'93        if checkSimilar('Dicséreti sztihirák:',line) > 0.6 : newsection = 'PRS'94        if newsection != '' :95            new.write('[/]\n')96            new.write('['+newsection+']\n')97            if 'OD' in newsection and ode > 1 : new.write('[T'+tone+']')98            section = newsection99            render = False100        # Inline checks101        if 'Theotokion:' in line and 'OD' in section : line = line.replace('Theotokion:','[M]')102        if '. hang.' in line :103            newtone = line[line.find('. hang.')-1]104            if newtone.isnumeric() == True :105                new.write('[T'+newtone+']')106                tone = newtone107                render = False108        # Check for dates109        if linedate != '0' and linedate == date : render = False110        if linedate != '0' and linedate != date :111            date = linedate112            new.write('[//]\n')113            new.write(date+'\n')114            section = ''115            ode = 0116        # Do not copy too short or empty lines    117        if len(line) < 3 : render = False118        # Copy idiom119        if render == True :120            line = line.replace('m ','m') # Typical scanalation error fix attempt121            if line[-2] == '.' or line[-2] == '!' or line[-2] == '?' : line += '\n'122            new.write(line)123new.close()124print('+++ Done. +++')125print(' ')126print('+++ Vespers file for '+fname+' is being built. +++')127section = ''128new = open('Books/vsp_'+fname+'.txt','w',encoding='utf8')129with open('Books/'+fname+'_normalized.txt','rb') as file :130    while True :131        line = file.readline().decode('utf8').rstrip('\r\n')132        if not line : break133        render = False134        newday = False135        newsection = ''136        if section == 'LIC' or section == 'APO' or section == 'TRP' : render = True137        if '[' in line and '/' not in line :138            pos = line.find('[')139            if line[pos+4] == ']' : newsection = line[pos+1:pos+4]140            if line[pos+3] == '.' : newday = True141        if newsection == 'LIC' or newsection == 'APO' or newsection == 'TRP' :142            new.write('['+newsection+']\n')143            section = newsection144            render = False145        if '[/]' in line :146            if section != '' : new.write('[/]\n')147            section = ''148            render = False149        if '[//]' in line :150            new.write('[//]\n')151            section = ''152            render = False153        if newday == True :154            new.write(line+'\n')155            section = ''156            render = False157        if render == True :158            line = line.replace(' ','')159            new.write(line+'\n')160new.close()161print('+++ Done. +++')162print(' ')163print('+++ Matins file for '+fname+' is being built. +++')164section = ''165new = open('Books/mtn_'+fname+'.txt','w',encoding='utf8')166with open('Books/'+fname+'_normalized.txt','rb') as file :167    while True :168        line = file.readline().decode('utf8').rstrip('\r\n')169        if not line : break170        render = False171        newday = False172        newsection = ''173        if 'OD' in section or 'ST' in section or section == 'KTH' or section == 'KNT' or section == 'IKS' or section == 'EXA' or section == 'PRS' : render = True174        if '[' in line and '/' not in line :175            pos = line.find('[')176            if line[pos+4] == ']' : newsection = line[pos+1:pos+4]177            if line[pos+3] == '.' : newday = True178        if 'OD' in newsection or 'ST' in newsection or newsection == 'KTH' or newsection == 'KNT' or newsection == 'IKS' or newsection == 'EXA' or newsection == 'PRS' :179            new.write('['+newsection+']\n')180            section = newsection181            render = False182        if '[/]' in line :183            if section != '' : new.write('[/]\n')184            section = ''185            render = False186        if '[//]' in line :187            new.write('[//]\n')188            section = ''189            render = False190        if newday == True :191            new.write(line+'\n')192            section = ''193            render = False194        if render == True :195            line = line.replace(' ','')196            new.write(line+'\n')197new.close()198print('+++ Done. +++')199print(' ')...main.py
Source:main.py  
1 local kavoUi = loadstring(game:HttpGet("https://pastebin.com/raw/vff1bQ9F"))()2local window = kavoUi.CreateLib("Bedwars | Master","DarkTheme")3---Tabs4local Tab1 = window:NewTab("Combat")5local Tab1Section = Tab1:NewSection("Nuker")6local Tab1Section = Tab1:NewSection("KillAura")7local Tab1Section = Tab1:NewSection("No Fall Damage")8local Tab1Section = Tab1:NewSection("Walkspeed")9local Tab1Section = Tab1:NewSection("Jumppower")10local Tab2 = window:NewTab("Player")11local Tab2Section = Tab2:NewSection("Inf Jumps")12local Tab2Section = Tab2:NewSection("Autosprint")13local Tab2Section = Tab2:NewSection("NoSlowdown")14local Tab2Section = Tab2:NewSection("Fly-Bypass")15local Tab3 = window:NewTab("Animations")16local Tab3Section = Tab3:NewSection("Zombie")17local Tab3Section = Tab3:NewSection("Astronaut")18local Tab3Section = Tab3:NewSection("Bubbly")19local Tab3Section = Tab3:NewSection("Cartoony")20local Tab3Section = Tab3:NewSection("Elder")21local Tab3Section = Tab3:NewSection("Night")22local Tab3Section = Tab3:NewSection("Elder")23local Tab3Section = Tab3:NewSection("Superhero")24local Tab3Section = Tab3:NewSection("Toy")25local Tab3Section = Tab3:NewSection("Mage")26local Tab3Section = Tab3:NewSection("Levitation")27local Tab3Section = Tab3:NewSection("Robot")28local Tab3Section = Tab3:NewSection("Ninja")29local Tab3Section = Tab3:NewSection("Vampire")30local Tab3Section = Tab3:NewSection("Werewolf")31local Tab3Section = Tab3:NewSection("Stylish")32local Tab3Section = Tab3:NewSection("Pirate")33local Tab3Section = Tab3:NewSection("Oldschool")34local Tab4 = window:NewTab("Credits")35local Tab4Section = Tab4:NewSection("Made By SubTobacon")36local Tab4Section = Tab4:NewSection("Oditor By SubTo_bacon")37local Tab4Section = Tab4:NewSection("Others Name")38local Tab5 = window:NewTab("All Hubs")39local Tab5Section = Tab5:NewSection("Inf Yield")40local Tab5Section = Tab5:NewSection("Keyboard")41---Buttons42Tab1Section:NewButton("Hitbox","Increase Range",function()43_G.HeadSize = 2544_G.Disabled = true45game:GetService('RunService').RenderStepped:connect(function()46if _G.Disabled then47for i,v in next, game:GetService('Players'):GetPlayers() do48if v.Name ~= game:GetService('Players').LocalPlayer.Name then49pcall(function()50v.Character.HumanoidRootPart.Size = Vector3.new(_G.HeadSize,_G.HeadSize,_G.HeadSize)51v.Character.HumanoidRootPart.Transparency = 0.752v.Character.HumanoidRootPart.BrickColor = BrickColor.new("Really black")53v.Character.HumanoidRootPart.Material = "Neon"54v.Character.HumanoidRootPart.CanCollide = false...IngameSettings.py
Source:IngameSettings.py  
1# Authors: Vladislav Ignatenko <gpcracker@mail.ru>2# ------------ #3#    Python    #4# ------------ #5import base646import cPickle7import functools8# -------------- #9#    BigWorld    #10# -------------- #11import ResMgr12# ---------------- #13#    WoT Client    #14# ---------------- #15import Settings16# ------------------- #17#    X-Mod Library    #18# ------------------- #19from . import XMLConfigReader20# -------------------- #21#    Module Content    #22# -------------------- #23def openPreferences(sectionPath, newSection=False):24	section = Settings.g_instance.userPrefs[sectionPath]25	if section is None and newSection:26		section = Settings.g_instance.userPrefs.createSection(sectionPath)27	return section28def savePreferences():29	return Settings.g_instance.save()30class IngameSettingsAbstractDataObject(object):31	__slots__ = ()32	@staticmethod33	def openPreferences(sectionPath, sectionDefault, newSection=False):34		section = openPreferences(sectionPath)35		if section is None and newSection:36			section = openPreferences(sectionPath, newSection)37			if section is not None:38				section.asString = sectionDefault39		return section40	savePreferences = staticmethod(savePreferences)41	@staticmethod42	def _encode(data):43		return base64.b64encode(cPickle.dumps(data))44	@staticmethod45	def _decode(data):46		return cPickle.loads(base64.b64decode(data))47	@classmethod48	def load(cls, sectionPath, sectionDefault=None, newSection=False):49		raise NotImplementedError50		return None51	@classmethod52	def loader(cls, sectionPath, newSection=False):53		raise NotImplementedError54		return None55	def save(self):56		raise NotImplementedError57		return58class IngameSettingsDictDataObject(IngameSettingsAbstractDataObject, dict):59	__slots__ = ('section', )60	@classmethod61	def load(cls, sectionPath, sectionDefault='KGRwMQou', newSection=False):62		section = cls.openPreferences(sectionPath, sectionDefault, newSection)63		return cls(section, cls._decode(section.asString if section is not None else sectionDefault))64	@classmethod65	def loader(cls, sectionPath, newSection=False):66		return functools.partial(cls.load, sectionPath, newSection=newSection)67	def __new__(cls, section, *args, **kwargs):68		return super(IngameSettingsAbstractDataObject, cls).__new__(cls, *args, **kwargs)69	def __init__(self, section, *args, **kwargs):70		super(IngameSettingsAbstractDataObject, self).__init__(*args, **kwargs)71		self.section = section72		return73	def save(self):74		if self.section is not None:75			self.section.asString = self._encode(self.copy())76			self.savePreferences()77		return78class IngameSettingsXMLReaderMeta(XMLConfigReader.XMLReaderMeta):79	__slots__ = ()80	@classmethod81	def construct(cls, className, constructor):82		readerClass = super(IngameSettingsXMLReaderMeta, cls).construct(className)83		readerClass.constructor = staticmethod(constructor)84		return readerClass85	def _readSection(self, xmlSection, defSection):86		if getattr(self, 'constructor', None) is None:87			raise AttributeError('Constructor is undefined or None.')...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!!
