Linted the python
This commit is contained in:
parent
8db9164e4c
commit
8c0aeff064
3 changed files with 9 additions and 6 deletions
|
@ -3,13 +3,16 @@ from glob import glob
|
||||||
from lxml import html
|
from lxml import html
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
|
|
||||||
ASSET_DIR = os.path.dirname(os.path.realpath(__file__))
|
ASSET_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||||
LOCAL_FILES = glob('assets/*.png') + glob('assets/*.gif')
|
LOCAL_FILES = glob('assets/*.png') + glob('assets/*.gif')
|
||||||
|
|
||||||
Emoticon = namedtuple('Emoticon', ['ident', 'url'])
|
Emoticon = namedtuple('Emoticon', ['ident', 'url'])
|
||||||
|
|
||||||
|
|
||||||
def get_filename(path):
|
def get_filename(path):
|
||||||
return path.replace('assets/', '')
|
return path.replace('assets/', '')
|
||||||
|
|
||||||
|
|
||||||
def get_icon_name(path):
|
def get_icon_name(path):
|
||||||
return get_filename(path).replace('.png', '').replace('.gif', '')
|
return get_filename(path).replace('.png', '').replace('.gif', '')
|
||||||
|
|
||||||
|
@ -20,7 +23,7 @@ emoticon_paths = html_tree.xpath("//div[@class='emoticon-block']/img/@src")
|
||||||
emoticon_names = html_tree.xpath("//div[@class='emoticon-block']/div/text()")
|
emoticon_names = html_tree.xpath("//div[@class='emoticon-block']/div/text()")
|
||||||
|
|
||||||
emoticons = []
|
emoticons = []
|
||||||
for i in range(len(emoticon_names)-1):
|
for i in range(len(emoticon_names) - 1):
|
||||||
emoticons.append(Emoticon(emoticon_names[i][1:-1], emoticon_paths[i]))
|
emoticons.append(Emoticon(emoticon_names[i][1:-1], emoticon_paths[i]))
|
||||||
|
|
||||||
print("Downloading offline emoticons...")
|
print("Downloading offline emoticons...")
|
||||||
|
@ -40,7 +43,7 @@ for emoticon in emoticons:
|
||||||
for block in response.iter_content(1024):
|
for block in response.iter_content(1024):
|
||||||
handle.write(block)
|
handle.write(block)
|
||||||
|
|
||||||
print ("{}/{} Files Downloaded\r".format(len(DOWNLOAD_FILES), len(emoticons)), end='' if len(DOWNLOAD_FILES) != len(emoticons) else '\n')
|
print("{}/{} Files Downloaded\r".format(len(DOWNLOAD_FILES), len(emoticons)), end='' if len(DOWNLOAD_FILES) != len(emoticons) else '\n')
|
||||||
|
|
||||||
for filename in LOCAL_FILES:
|
for filename in LOCAL_FILES:
|
||||||
emoticons.append(Emoticon(get_icon_name(filename), filename))
|
emoticons.append(Emoticon(get_icon_name(filename), filename))
|
||||||
|
@ -55,7 +58,7 @@ for emoticon in emoticons:
|
||||||
images.append({emoticon.ident: data})
|
images.append({emoticon.ident: data})
|
||||||
|
|
||||||
print("Exporting JSON...")
|
print("Exporting JSON...")
|
||||||
image_decoder = {"images":images}
|
image_decoder = {"images": images}
|
||||||
|
|
||||||
image_decoder_json = json.dumps(image_decoder, indent=2, sort_keys=True)
|
image_decoder_json = json.dumps(image_decoder, indent=2, sort_keys=True)
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ for key, value in switcher.items():
|
||||||
package[value] = project_package[key]
|
package[value] = project_package[key]
|
||||||
|
|
||||||
|
|
||||||
#Hard coded values
|
# Hard coded values
|
||||||
package['name'] = package['title'].replace(' ', '-').lower()
|
package['name'] = package['title'].replace(' ', '-').lower()
|
||||||
package['id'] = package['name'] + "@jetpack"
|
package['id'] = package['name'] + "@jetpack"
|
||||||
package['engines'] = {'fennec': "45.0", 'firefox': "45.0"}
|
package['engines'] = {'fennec': "45.0", 'firefox': "45.0"}
|
||||||
|
|
2
runtests
2
runtests
|
@ -4,6 +4,6 @@ set -e
|
||||||
|
|
||||||
export PATH=env/bin:${PATH}
|
export PATH=env/bin:${PATH}
|
||||||
|
|
||||||
flake8 . --ignore=E128,E501 --exclude="node_modules,env"
|
flake8 . --ignore=E501,E401 --exclude="node_modules,env"
|
||||||
|
|
||||||
npm test
|
npm test
|
||||||
|
|
Reference in a new issue