Best Python code snippet using robotframework-pageobjects_python
fflogs_data.py
Source:fflogs_data.py
...23async def get_boss_data() -> list:24 """ è·å boss æ°æ® """25 data = await FFLOGS_DATA.data26 return data['boss']27async def get_job_data() -> list:28 """ è·å job æ°æ® """29 data = await FFLOGS_DATA.data30 return data['job']31async def get_boss_info_by_nickname(name: str) -> Optional[BossInfo]:32 """ æ ¹æ®æµç§°è·å BOSS çç¸å
³ä¿¡æ¯33 :param name: BOSS çæµç§°34 :returns: è¿åå
å« `name`, `zone`, `encounter`, `difficulty` ä¿¡æ¯çæ°æ®ç±»ï¼å¦ææ¾ä¸å°è¿å None35 """36 for boss in await get_boss_data():37 if name.lower() in [boss['name'], *boss['nicknames']]:38 return BossInfo(39 boss['name'],40 boss['zone'],41 boss['encounter'],42 boss['difficulty'],43 )44 return None45async def get_bosses_info() -> list[BossInfo]:46 """ è·åææ BOSS çç¸å
³ä¿¡æ¯ """47 boss_info = []48 for boss in await get_boss_data():49 boss_info.append(50 BossInfo(51 boss['name'],52 boss['zone'],53 boss['encounter'],54 boss['difficulty'],55 ))56 return boss_info57async def get_job_info_by_nickname(name: str) -> Optional[JobInfo]:58 """ æ ¹æ®æµç§°è·åèä¸çç¸å
³ä¿¡æ¯59 :param name: èä¸çæµç§°60 :returns: è¿åå
å« `name`, `spec` ä¿¡æ¯çæ°æ®ç±»ï¼å¦ææ¾ä¸å°è¿å None61 """62 for job in await get_job_data():63 if name in [job['name'], *job['nicknames']]:64 return JobInfo(job['name'], job['spec'])65 return None66async def get_jobs_info() -> list[JobInfo]:67 """ è·åææèä¸çç¸å
³ä¿¡æ¯ """68 job_info = []69 for job in await get_job_data():70 job_info.append(JobInfo(job['name'], job['spec']))...
async_monitor.py
Source:async_monitor.py
...30except:31 paa_installed = False32class AsyncMonitor(BrowserView):33 """ """34 def get_job_data(self, job):35 lastused = DateTime(job._p_mtime)36 if len(job.args) > 3:37 user = job.args[3]38 else:39 user = ""40 if len(job.args) > 4:41 intro = job.args[4]42 else:43 intro = {}44 if isinstance(job.args[0], list):45 object_path = "/".join(job.args[0])46 else:47 object_path = str(job.args[0])48 if job.status != "pending-status":49 timerunning = time_since(lastused)50 else:51 timerunning = "-"52 return {53 "status": job.status,54 "user": user,55 "object_path": object_path,56 "description": (57 getattr(intro, "__doc__", "") or getattr(intro, "__name__", "")58 ).strip(),59 "lastused": lastused.toZone("UTC").pCommon(),60 "timerunning": timerunning,61 }62 @property63 def jobs(self):64 results = []65 if paa_installed:66 async = getUtility(IAsyncService)67 queue = async.getQueues()[""]68 for quota in queue.quotas.values():69 for job in quota._data:70 results.append(self.get_job_data(job))71 jobs = [job for job in queue]72 for job in jobs:73 results.append(self.get_job_data(job))...
JobSubmissionService-remote
Source:JobSubmissionService-remote
...18 print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]'19 print ''20 print 'Functions:'21 print ' SubmissionHandle submit(SubmissionPlan plan)'22 print ' JobData get_job_data(SubmissionHandle handle)'23 print ''24 sys.exit(0)25pp = pprint.PrettyPrinter(indent = 2)26host = 'localhost'27port = 909028uri = ''29framed = False30http = False31argi = 132if sys.argv[argi] == '-h':33 parts = sys.argv[argi+1].split(':') 34 host = parts[0]35 port = int(parts[1])36 argi += 237if sys.argv[argi] == '-u':38 url = urlparse(sys.argv[argi+1])39 parts = url[1].split(':') 40 host = parts[0]41 if len(parts) > 1:42 port = int(parts[1])43 else:44 port = 8045 uri = url[2]46 http = True47 argi += 248if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':49 framed = True50 argi += 151cmd = sys.argv[argi]52args = sys.argv[argi+1:]53if http:54 transport = THttpClient.THttpClient(host, port, uri)55else:56 socket = TSocket.TSocket(host, port)57 if framed:58 transport = TTransport.TFramedTransport(socket)59 else:60 transport = TTransport.TBufferedTransport(socket)61protocol = TBinaryProtocol.TBinaryProtocol(transport)62client = JobSubmissionService.Client(protocol)63transport.open()64if cmd == 'submit':65 if len(args) != 1:66 print 'submit requires 1 args'67 sys.exit(1)68 pp.pprint(client.submit(eval(args[0]),))69elif cmd == 'get_job_data':70 if len(args) != 1:71 print 'get_job_data requires 1 args'72 sys.exit(1)73 pp.pprint(client.get_job_data(eval(args[0]),))...
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!!