Best Python code snippet using avocado_python
tmps.py
Source:tmps.py
...10 redis_key = 'tmps:start_urls'11 def parse(self, response):12 start_url = 'http://www.chinahr.com/beijing/jobs/'13 yield scrapy.Request(url=start_url,callback=self.parse_mi)14 def parse_mi(self, response):15 a = response.xpath('//div[@class="ul-con"]/a/text()|//ul[@class="item-hot"]//a/text()').extract()16 with open('url.html','r') as f:17 html = f.read()18 url_id = re.compile(r'\d{3,4}')19 id = url_id.findall(html)20 for i in id :21 start_url = 'http://www.chinahr.com/sou/?city=' + i22 for s in a :23 fulurl = start_url +'&keyword=' + s24 yield scrapy.Request(url=fulurl,callback=self.parse_list)25 def parse_list(self,response):26 shu = response.xpath('//div[@class="quickPage"]/span/text()').extract()27 if shu:28 shu = shu[0]...
radon.py
Source:radon.py
...25 str(path)26 ]27 output_cc = run_in_subprocess(command_cc)28 output_mi = run_in_subprocess(command_mi)29 return cls.parse_cc(output_cc) + cls.parse_mi(output_mi)30 @classmethod31 def parse_cc(cls, output: str) -> List[Issue]:32 result = json.loads(output)33 issues = []34 for file in result:35 errors = result[file]36 for error in errors:37 issues.append(Issue(38 category=IssueType.CYCLOMATIC_COMPLEXITY,39 text=f'{error["type"]} {error["name"]} '40 f'has high cyclomatic complexity={error["complexity"]} ({error["rank"]}/A)',41 file=file,42 line_number=int(error["lineno"]),43 column_number=int(error["col_offset"])44 ))45 return issues46 @classmethod47 def parse_mi(cls, output: str) -> List[Issue]:48 result = json.loads(output)49 issues = []50 for file in result:51 error = result[file]52 issues.append(Issue(53 category=IssueType.MAINTAINABILITY_INDEX,54 text=f'file has low maintainability index={int(error["mi"])} ({error["rank"]}/A)',55 file=file,56 line_number=0,57 column_number=058 ))...
mathml.py
Source:mathml.py
...16 return getattr(sys.modules[__name__], parse_method)(element)17 for child in element:18 result = result + parse_element(child)19 return result20def parse_mi(mi):21 return '(' + mi.text + ')'22def parse_mo(mo):23 return mo.text24def parse_mn(mn):25 return '(' + mn.text + ')'26def parse_mfrac(mfrac):27 children = list(mfrac)28 if len(children) != 2:29 raise "<mfrac> element must contain two children"30 result = '(' + parse_element(children[0]) + ')/('31 result = result + parse_element(children[1]) + ')'32 return result33def parse_msup(msup):34 children = list(msup)...
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!!