Best Python code snippet using autotest_python
test-1.py
Source: test-1.py
...76 # otr_filter_func = None77 source.make_fingerprints(with_filter=src_filter_func)78 other.make_fingerprints(with_filter=otr_filter_func)79 # def tr_hostname(val):80 # return normalize_hostname(val).replace('/', '-')81 source.make_keys("hostname", with_translate=normalize_hostname)82 other.make_keys("hostname", with_translate=normalize_hostname)83 source.make_keys("sn")84 other.make_keys("sn")85 def sn_cmp(val):86 return val if not val.endswith("_1") else val.partition("_1")[0]87 comparitors = {88 "sn": sn_cmp,89 # "model": str.upper,90 # "os_name": lambda f: f.replace("-", ""),91 }92 missing, changes = diff.diff(source, other, fields_cmp=comparitors)93 missing_sn = [94 (fp, change) for fp, change in changes if "sn" in change and fp["sn"] == ""...
domain-limit-list.py
Source: domain-limit-list.py
1# -*- coding: utf-8 -*-2import datetime3import time4from datetime import timezone5import pytz6import whois7import yaml8from jinja2 import Environment, FileSystemLoader9from publicsuffix import PublicSuffixList10# whoisåç
§11def get_whois(host):12 time.sleep(2)13 return whois.whois(host)14# YamlãOpen15f = open("./chk_hosts.yml",encoding='utf-8')16chk_hosts = yaml.load(f)17chk_hosts = chk_hosts['chk_host_list']18#print (chk_hosts)19domain_list = []20# ãµããã¡ã¤ã³ãæ¥æ¬èªãã¡ã¤ã³ãæ£è¦åãã21for chk in chk_hosts:22 hostname = chk['uri']23 if hostname is None:24 next25 normalize_hostname = hostname.encode('idna').decode('utf-8')26 psl = PublicSuffixList()27 domain_list.append(psl.get_public_suffix(normalize_hostname))28#print (domain_list)29uniq_domain_list = list(set(domain_list))30list = []31# éè¤ãé¤å»ããWhoisãå¼ã32for domain in uniq_domain_list:33 registrar = "ã"34 update_date = "ã"35 expires_date = "ã"36 limit_day = "ã"37 try:38 whois_ans = get_whois(domain)39 registrar = whois_ans.registrar40 # print(domain)41 # print(whois_ans)42 # print(type(whois_ans.updated_date))43 if isinstance(whois_ans.updated_date, type(list)):44 whois_update_date = whois_ans.updated_date[0]45 else:46 whois_update_date = whois_ans.updated_date47 if isinstance(whois_ans.expiration_date, type(list)):48 whois_expiration_date = whois_ans.expiration_date[0]49 else:50 whois_expiration_date = whois_ans.expiration_date51 except whois.parser.PywhoisError as e:52 print("Whoisã«è¦ã¤ãããªã")53 continue54 print(domain)55 # print(whois_ans)56 if whois_update_date is None:57 print("Whoisæ
å ±åå¾ã«å¤±æ")58 continue59 # ãã®ã¾ã¾å¦çããã¨JSTã¨èªèããã¦æå»ããããã®ã§ãä¸ç´°å·¥ã ãã©æéãããã60 update_date = whois_update_date - datetime.timedelta(hours=9)61 expires_date = whois_expiration_date - datetime.timedelta(hours=9)62 jp = pytz.timezone('Asia/Tokyo')63 # print(update_date.astimezone(jp))64 diff = (expires_date.astimezone(jp) - datetime.datetime.now(jp)65 ) // datetime.timedelta(days=1)66 # print(update_date)67 # print(expires_date)68 # print(diff)69 whois_propaty = {"domain": domain, "registrar": registrar,70 "update_date": update_date, "expires_date": expires_date, "limit_day": diff}71 list.append(whois_propaty)72# æ®ãæ¥æ°ã¨ãã¹ãåã§ã½ã¼ã73list = sorted(list, key=lambda x: (x["limit_day"], x["domain"]))74# HTMLä½æ75env = Environment(loader=FileSystemLoader('./', encoding='utf8'))76templete = env.get_template('./domain_limit.html.j2')77data = {"list": list}78output = templete.render(data)79# Windowsç°å¢ã ã¨ã¨ã³ã³ã¼ãæå®ããªãã¨åºåãSJISã«ãªãã80with open('domain_limit.html', 'w', encoding='utf-8') as f:81 f.write(output)...
normalize_hostname.py
Source: normalize_hostname.py
...37 any_domain = "|".join(38 map(re.escape, map(partial(concat, "."), cfg_obj.domain_names))39 )40 return partial(re.compile(any_domain).sub, repl="")41def normalize_hostname(hostname):...
Check out the latest blogs from LambdaTest on this topic:
Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools
As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????
The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.
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!!