From 3b8912c645ff2edd5dcf830e0575388bc1831bd0 Mon Sep 17 00:00:00 2001 From: Kwpolska Date: Sat, 23 Mar 2013 20:49:14 +0100 Subject: [PATCH] flake8 fixes Signed-off-by: Kwpolska --- pkgbuilder/build.py | 7 ++++--- pkgbuilder/exceptions.py | 6 ++++++ pkgbuilder/main.py | 5 +++-- pkgbuilder/upgrade.py | 8 ++++---- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/pkgbuilder/build.py b/pkgbuilder/build.py index 2701fe3..9406425 100644 --- a/pkgbuilder/build.py +++ b/pkgbuilder/build.py @@ -187,8 +187,9 @@ def rsync(pkg, quiet=False): '--include=/{}/{}'.format(pkg['Category'], pkg['Name']), '--exclude=/{}/*'.format(pkg['Category']), - '--exclude=/*', 'rsync.archlinux.org::abs/{}/'.format( - pkg['Arch']), '.')) + '--exclude=/*', + 'rsync.archlinux.org::abs/{}/'.format(pkg['Arch']), + '.')) def extract(filename): @@ -262,7 +263,7 @@ def fetch_runner(pkgnames): abspkgs = [] aurpkgs = [] try: - print( ':: ' + _('Fetching package information...')) + print(':: ' + _('Fetching package information...')) for pkgname in pkgnames: pkg = None try: diff --git a/pkgbuilder/exceptions.py b/pkgbuilder/exceptions.py index 8065a3c..46e0446 100644 --- a/pkgbuilder/exceptions.py +++ b/pkgbuilder/exceptions.py @@ -42,10 +42,12 @@ def __init__(self, msg, *args, **kwargs): self.msg = msg self.args = args self.kwargs = kwargs + def __str__(self): """Just so the user knows that it’s an AUR error.""" return '[AUR] ' + self.msg + class MakepkgError(PBException): """makepkg errors (return codes)""" def __init__(self, retcode, *args, **kwargs): @@ -59,6 +61,7 @@ def __str__(self): """“1” isn’t too helpful for the human.""" return _('makepkg returned {0}.').format(self.retcode) + class NetworkError(PBException): """Network-related errors.""" def __init__(self, msg, source, *args, **kwargs): @@ -74,6 +77,7 @@ def __str__(self): """The msg, wherever it may come from, isn’t helpful either.""" return _('Network error: {0} (via {1})').format(self.msg, self.source) + class PackageError(PBException): """Package-related errors.""" def __init__(self, msg, source, *args, **kwargs): @@ -89,6 +93,7 @@ def __str__(self): """Would be helpful, but not enough.""" return _('{0} (Package: {1})').format(self.msg, self.source) + class PackageNotFoundError(PackageError): def __init__(self, name, *args, **kwargs): """Throw an error to the log and take the arguments.""" @@ -101,6 +106,7 @@ def __str__(self): """This would be far, FAR away from being informative.""" return _('Package {0} not found.').format(self.name) + class SanityError(PBException): """Sometimes PKGBUILDer or one of its friends can go insane.""" def __init__(self, msg, *args, **kwargs): diff --git a/pkgbuilder/main.py b/pkgbuilder/main.py index da58021..c1583be 100644 --- a/pkgbuilder/main.py +++ b/pkgbuilder/main.py @@ -47,8 +47,9 @@ def main(source='AUTO', quit=True): nargs='*', help=_('AUR/ABS packages to build')) argopr = parser.add_argument_group(_('operations')) - argopr.add_argument('-F', '--fetch', action='store_true', default=False, - dest='fetch', help=_('fetch package files')) + argopr.add_argument('-F', '--fetch', action='store_true', + default=False, dest='fetch', + help=_('fetch package files')) argopr.add_argument('-i', '--info', action='store_true', default=False, dest='info', help=_('view package information')) argopr.add_argument('-s', '--search', action='store_true', diff --git a/pkgbuilder/upgrade.py b/pkgbuilder/upgrade.py index 4981090..97c6133 100644 --- a/pkgbuilder/upgrade.py +++ b/pkgbuilder/upgrade.py @@ -173,10 +173,10 @@ def auto_upgrade(downgrade=False, vcsup=False): 'first:')) DS.fancy_msg2(pkgbname) query = (DS.colors['green'] + '==>' + DS.colors['all_off'] + - DS.colors['bold'] + ' ' + - _('Do you want to cancel the current operation and ' - 'upgrade these packages now? [Y/n] ') + - DS.colors['all_off']) + DS.colors['bold'] + ' ' + + _('Do you want to cancel the current operation and ' + 'upgrade these packages now? [Y/n] ') + + DS.colors['all_off']) yesno = input(query)