Merge branch 'master' of github.com:lilydjwg/nvchecker into master
This commit is contained in:
commit
717c3e2367
|
@ -57,7 +57,7 @@ def add_common_arguments(parser: argparse.ArgumentParser) -> None:
|
|||
parser.add_argument('-c', '--file',
|
||||
metavar='FILE', type=str,
|
||||
default=default_config,
|
||||
help='software version configuration file [default: %s]' % default_config)
|
||||
help=f'software version configuration file [default: {default_config}]')
|
||||
|
||||
def process_common_arguments(args: argparse.Namespace) -> bool:
|
||||
'''return True if should stop'''
|
||||
|
@ -94,7 +94,7 @@ def process_common_arguments(args: argparse.Namespace) -> bool:
|
|||
|
||||
if args.version:
|
||||
progname = os.path.basename(sys.argv[0])
|
||||
print('%s v%s' % (progname, __version__))
|
||||
print(f'{progname} v{__version__}')
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ from typing import Optional
|
|||
|
||||
from . import __version__
|
||||
|
||||
DEFAULT_USER_AGENT = 'lilydjwg/nvchecker %s' % __version__
|
||||
DEFAULT_USER_AGENT = f'lilydjwg/nvchecker {__version__}'
|
||||
|
||||
tries = ContextVar('tries', default=1)
|
||||
proxy: ContextVar[Optional[str]] = ContextVar('proxy', default=None)
|
||||
|
|
|
@ -27,7 +27,7 @@ def _console_msg(event):
|
|||
msg = evt
|
||||
|
||||
if 'name' in event:
|
||||
msg = '%s: %s' % (event['name'], msg)
|
||||
msg = f"{event['name']}: {msg}"
|
||||
del event['name']
|
||||
|
||||
event['msg'] = msg
|
||||
|
|
|
@ -36,7 +36,7 @@ async def get_version(
|
|||
# Set private token if token exists.
|
||||
headers = {}
|
||||
if token:
|
||||
headers["Authorization"] = 'token %s' % token
|
||||
headers["Authorization"] = f'token {token}'
|
||||
|
||||
data = await cache.get_json(url, headers = headers)
|
||||
if use_max_tag:
|
||||
|
|
|
@ -46,7 +46,7 @@ async def get_latest_tag(key: Tuple[str, str, str]) -> str:
|
|||
repo, query, token = key
|
||||
owner, reponame = repo.split('/')
|
||||
headers = {
|
||||
'Authorization': 'bearer %s' % token,
|
||||
'Authorization': f'bearer {token}',
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
q = QUERY_LATEST_TAG.format(
|
||||
|
@ -109,7 +109,7 @@ async def get_version_real(
|
|||
'Accept': 'application/vnd.github.quicksilver-preview+json',
|
||||
}
|
||||
if token:
|
||||
headers['Authorization'] = 'token %s' % token
|
||||
headers['Authorization'] = f'token {token}'
|
||||
|
||||
data = await cache.get_json(url, headers = headers)
|
||||
|
||||
|
@ -140,9 +140,8 @@ def check_ratelimit(exc, name):
|
|||
n = int(res.headers.get('X-RateLimit-Remaining', -1))
|
||||
if n == 0:
|
||||
reset = int(res.headers.get('X-RateLimit-Reset'))
|
||||
logger.error('rate limited, resetting at %s. '
|
||||
'Or get an API token to increase the allowance if not yet'
|
||||
% time.ctime(reset),
|
||||
logger.error(f'rate limited, resetting at {time.ctime(reset)}. '
|
||||
'Or get an API token to increase the allowance if not yet',
|
||||
name = name,
|
||||
reset = reset)
|
||||
else:
|
||||
|
|
|
@ -9,10 +9,10 @@ import json
|
|||
import urllib.request
|
||||
|
||||
def main(user):
|
||||
url = 'https://aur.archlinux.org/rpc.php?type=msearch&arg=' + user
|
||||
url = f'https://aur.archlinux.org/rpc.php?type=msearch&arg={user}'
|
||||
res = urllib.request.urlopen(url)
|
||||
if res.status != 200:
|
||||
sys.exit('Error: %d %s' % (res.status, res.reason))
|
||||
sys.exit(f'Error: {res.status} {res.reason}')
|
||||
d = res.read().decode('utf-8')
|
||||
d = json.loads(d)
|
||||
print('\n'.join(sorted(pkg['Name'] for pkg in d['results'])))
|
||||
|
|
Loading…
Reference in New Issue