Fix lint.
This commit is contained in:
parent
3ec38539c5
commit
89e3c2a703
@ -86,7 +86,6 @@ class AsciiDoc:
|
|||||||
for src, dst in files:
|
for src, dst in files:
|
||||||
self.call(src, dst)
|
self.call(src, dst)
|
||||||
|
|
||||||
|
|
||||||
def _build_website_file(self, root, filename):
|
def _build_website_file(self, root, filename):
|
||||||
"""Build a single website file."""
|
"""Build a single website file."""
|
||||||
# pylint: disable=too-many-locals
|
# pylint: disable=too-many-locals
|
||||||
@ -162,7 +161,7 @@ class AsciiDoc:
|
|||||||
|
|
||||||
for root, _dirs, files in os.walk(os.getcwd()):
|
for root, _dirs, files in os.walk(os.getcwd()):
|
||||||
for filename in files:
|
for filename in files:
|
||||||
basename, ext = os.path.splitext(filename)
|
basename, ext = os.path.splitext(filename)
|
||||||
if (ext != '.asciidoc' or
|
if (ext != '.asciidoc' or
|
||||||
basename in ('header', 'OpenSans-License')):
|
basename in ('header', 'OpenSans-License')):
|
||||||
continue
|
continue
|
||||||
|
@ -31,7 +31,11 @@ from lxml import html # pylint: disable=import-error
|
|||||||
|
|
||||||
|
|
||||||
def fetch():
|
def fetch():
|
||||||
"""Fetch list of popular user-agents and return list of relevant strings"""
|
"""Fetch list of popular user-agents.
|
||||||
|
|
||||||
|
Return:
|
||||||
|
List of relevant strings.
|
||||||
|
"""
|
||||||
url = 'https://techblog.willshouse.com/2012/01/03/most-common-user-agents/'
|
url = 'https://techblog.willshouse.com/2012/01/03/most-common-user-agents/'
|
||||||
page = requests.get(url)
|
page = requests.get(url)
|
||||||
page = html.fromstring(page.text)
|
page = html.fromstring(page.text)
|
||||||
@ -40,7 +44,7 @@ def fetch():
|
|||||||
|
|
||||||
|
|
||||||
def filter_list(complete_list, browsers):
|
def filter_list(complete_list, browsers):
|
||||||
"""Filter the received list based on a look up table
|
"""Filter the received list based on a look up table.
|
||||||
|
|
||||||
The LUT should be a dictionary of the format {browser: versions}, where
|
The LUT should be a dictionary of the format {browser: versions}, where
|
||||||
'browser' is the name of the browser (eg. "Firefox") as string and
|
'browser' is the name of the browser (eg. "Firefox") as string and
|
||||||
@ -98,13 +102,14 @@ def main():
|
|||||||
filtered = add_diversity(filtered)
|
filtered = add_diversity(filtered)
|
||||||
|
|
||||||
tab = " "
|
tab = " "
|
||||||
print("%sdef complete(self):" % tab)
|
print(tab + "def complete(self):")
|
||||||
print("%s\"\"\"Complete a list of common user agents.\"\"\"" % (2 * tab))
|
print((2 * tab) + "\"\"\"Complete a list of common user agents.\"\"\"")
|
||||||
print("%sout = [" %(2 * tab))
|
print((2 * tab) + "%sout = [")
|
||||||
|
|
||||||
for browser in ["Firefox", "Safari", "Chrome", "Obscure"]:
|
for browser in ["Firefox", "Safari", "Chrome", "Obscure"]:
|
||||||
for it in filtered[browser]:
|
for it in filtered[browser]:
|
||||||
print("%s(\'%s\',\n%s \"%s\")," % (3 * tab, it[0], 3 * tab, it[1]))
|
print("{}(\'{}\',\n{} \"{}\"),".format(3 * tab, it[0],
|
||||||
|
3 * tab, it[1]))
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
print("""\
|
print("""\
|
||||||
@ -112,7 +117,7 @@ def main():
|
|||||||
'Gecko',
|
'Gecko',
|
||||||
"IE 11.0 for Desktop Win7 64-bit")""")
|
"IE 11.0 for Desktop Win7 64-bit")""")
|
||||||
|
|
||||||
print("%s]\n%sreturn out\n" % (2 * tab, 2 * tab))
|
print("{}]\n{}return out\n".format(2 * tab, 2 * tab))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user