mirror of
https://github.com/lilydjwg/nvchecker
synced 2025-02-17 11:07:27 +00:00
[github] uniform indentation
This commit is contained in:
parent
89acf137a0
commit
3c97b5c693
@ -16,14 +16,14 @@ def get_version(name, conf, callback):
|
||||
use_max_tag = conf.getboolean('use_max_tag', False)
|
||||
ignored_tags = conf.get("ignored_tags", "").split()
|
||||
if use_latest_release:
|
||||
url = GITHUB_LATEST_RELEASE % repo
|
||||
url = GITHUB_LATEST_RELEASE % repo
|
||||
elif use_max_tag:
|
||||
url = GITHUB_MAX_TAG % repo
|
||||
url = GITHUB_MAX_TAG % repo
|
||||
else:
|
||||
url = GITHUB_URL % (repo, br)
|
||||
url = GITHUB_URL % (repo, br)
|
||||
headers = {'Accept': "application/vnd.github.quicksilver-preview+json"}
|
||||
if 'NVCHECKER_GITHUB_TOKEN' in os.environ:
|
||||
headers['Authorization'] = 'token %s' % os.environ['NVCHECKER_GITHUB_TOKEN']
|
||||
headers['Authorization'] = 'token %s' % os.environ['NVCHECKER_GITHUB_TOKEN']
|
||||
request = HTTPRequest(url, headers=headers, user_agent='lilydjwg/nvchecker')
|
||||
AsyncHTTPClient().fetch(request,
|
||||
callback=partial(_github_done, name, use_latest_release, use_max_tag, ignored_tags, callback))
|
||||
@ -31,13 +31,13 @@ def get_version(name, conf, callback):
|
||||
def _github_done(name, use_latest_release, use_max_tag, ignored_tags, callback, res):
|
||||
data = json.loads(res.body.decode('utf-8'))
|
||||
if use_latest_release:
|
||||
version = data['tag_name']
|
||||
version = data['tag_name']
|
||||
elif use_max_tag:
|
||||
data = [tag["name"] for tag in data if tag["name"] not in ignored_tags]
|
||||
data.sort(key=parse_version)
|
||||
version = data[-1]
|
||||
data = [tag["name"] for tag in data if tag["name"] not in ignored_tags]
|
||||
data.sort(key=parse_version)
|
||||
version = data[-1]
|
||||
else:
|
||||
# YYYYMMDD.HHMMSS
|
||||
version = data[0]['commit']['committer']['date'] \
|
||||
.replace('-', '').replace(':', '').replace('T', '.')
|
||||
# YYYYMMDD.HHMMSS
|
||||
version = data[0]['commit']['committer']['date'] \
|
||||
.replace('-', '').replace(':', '').replace('T', '.')
|
||||
callback(name, version)
|
||||
|
Loading…
Reference in New Issue
Block a user