autopep8 run

This commit is contained in:
Evgenii Alekseev 2021-03-15 02:27:42 +03:00
parent d3e79120cb
commit 663e822a92
47 changed files with 71 additions and 68 deletions

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify
@ -73,9 +73,11 @@ def update(args: argparse.Namespace) -> None:
update packages callback
:param args: command line args
'''
app = Application.from_args(args)
# typing workaround
log_fn = lambda line: print(line) if args.dry_run else app.logger.info(line)
def log_fn(line: str) -> None:
return print(line) if args.dry_run else app.logger.info(line)
app = Application.from_args(args)
packages = app.get_updates(args.package, args.no_aur, args.no_manual, args.no_vcs, log_fn)
if args.dry_run:
return
@ -128,7 +130,8 @@ if __name__ == '__main__':
update_parser = subparsers.add_parser('update', description='run updates')
update_parser.add_argument('package', help='filter check by packages', nargs='*')
update_parser.add_argument('--dry-run', help='just perform check for updates, same as check command', action='store_true')
update_parser.add_argument(
'--dry-run', help='just perform check for updates, same as check command', action='store_true')
update_parser.add_argument('--no-aur', help='do not check for AUR updates', action='store_true')
update_parser.add_argument('--no-manual', help='do not include manual updates', action='store_true')
update_parser.add_argument('--no-vcs', help='do not check VCS packages', action='store_true')

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify
@ -182,4 +182,4 @@ class Application:
for num, level in enumerate(tree.levels()):
self.logger.info(f'processing level #{num} {[package.base for package in level]}')
packages = self.repository.process_build(level)
process_update(packages)
process_update(packages)

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify
@ -93,4 +93,4 @@ class Lock:
if self.path is None:
return
if os.path.exists(self.path):
os.remove(self.path)
os.remove(self.path)

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify
@ -49,4 +49,4 @@ class Pacman:
for database in self.handle.get_syncdbs():
result.update({package.name for package in database.pkgcache})
return list(result)
return list(result)

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify
@ -104,4 +104,4 @@ class SyncFailed(Exception):
'''
default constructor
'''
Exception.__init__(self, 'Sync failed')
Exception.__init__(self, 'Sync failed')

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify
@ -72,4 +72,4 @@ class Report:
generate report for the specified packages
:param packages: list of packages to generate report
'''
pass
pass

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify
@ -264,4 +264,4 @@ class Repository:
self.logger.exception(f'could not add package from {fn}', exc_info=True)
self._clear_manual()
return result
return result

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify
@ -103,4 +103,4 @@ class GPG:
'''
if SignSettings.SignRepository not in self.target:
return [path]
return self.process(path, self.default_key)
return self.process(path, self.default_key)

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify
@ -94,4 +94,4 @@ class WebClient(Client):
response = requests.post(self._url(base), json=payload)
response.raise_for_status()
except:
self.logger.exception(f'could not update {base}', exc_info=True)
self.logger.exception(f'could not update {base}', exc_info=True)

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify
@ -62,11 +62,11 @@ class Package:
:return: True in case if package base looks like VCS package and false otherwise
'''
return self.base.endswith('-bzr') \
or self.base.endswith('-csv')\
or self.base.endswith('-darcs')\
or self.base.endswith('-git')\
or self.base.endswith('-hg')\
or self.base.endswith('-svn')
or self.base.endswith('-csv')\
or self.base.endswith('-darcs')\
or self.base.endswith('-git')\
or self.base.endswith('-hg')\
or self.base.endswith('-svn')
@property
def web_url(self) -> str:
@ -113,7 +113,7 @@ class Package:
return cls(package.base, package.version, aur_url, {package.name: os.path.basename(path)})
@classmethod
def from_aur(cls: Type[Package], name: str, aur_url: str)-> Package:
def from_aur(cls: Type[Package], name: str, aur_url: str) -> Package:
'''
construct package properties from AUR page
:param name: package name (either base or normal name)

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify
@ -76,4 +76,4 @@ class RepositoryPaths:
os.makedirs(self.manual, mode=0o755, exist_ok=True)
os.makedirs(self.packages, mode=0o755, exist_ok=True)
os.makedirs(self.repository, mode=0o755, exist_ok=True)
os.makedirs(self.sources, mode=0o755, exist_ok=True)
os.makedirs(self.sources, mode=0o755, exist_ok=True)

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify
@ -45,4 +45,4 @@ class SignSettings(Enum):
return SignSettings.SignPackages
elif value.lower() in ('repository', 'sign-repository'):
return SignSettings.SignRepository
raise InvalidOption(value)
raise InvalidOption(value)

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify
@ -46,4 +46,4 @@ def setup_routes(application: Application) -> None:
application.router.add_post('/api/v1/packages', PackagesView)
application.router.add_delete('/api/v1/packages/{package}', PackageView)
application.router.add_post('/api/v1/packages/{package}', PackageView)
application.router.add_post('/api/v1/packages/{package}', PackageView)

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify
@ -62,4 +62,4 @@ class IndexView(BaseView):
'packages': packages,
'repository': self.service.repository.name,
'version': version.__version__,
}
}

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
#
# Copyright (c) 2021 Evgenii Alekseev.
#
# This file is part of ahriman
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify