From 9ba63dc14a735b0b1d3d5276bedf474dcd448623 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 09 2018 11:37:58 +0000 Subject: Project wide flake8 fixes Signed-off-by: Pierre-Yves Chibon --- diff --git a/mdapi/__init__.py b/mdapi/__init__.py index ff40e6d..aad9b2e 100644 --- a/mdapi/__init__.py +++ b/mdapi/__init__.py @@ -83,6 +83,7 @@ def allows_jsonp(function): return wrapper + @asyncio.coroutine def _get_pkg(branch, name=None, action=None, srcname=None): ''' Return the pkg information for the given package in the specified @@ -134,7 +135,8 @@ def _get_pkg(branch, name=None, action=None, srcname=None): def _get_pretty(request): pretty = False - get_params = MultiDict(urllib.parse.parse_qsl(request.query_string.lower())) + get_params = MultiDict(urllib.parse.parse_qsl( + request.query_string.lower())) if get_params.get('pretty'): if str(get_params.get('pretty', None)) in ['1', 'true']: pretty = True @@ -174,7 +176,8 @@ def _expand_pkg_info(pkgs, branch, repotype=None): out[datatype] = data # New meta-data present for soft dependency management in RPM - for datatype in ['enhances', 'recommends', 'suggests', 'supplements']: + for datatype in [ + 'enhances', 'recommends', 'suggests', 'supplements']: data = yield from mdapilib.get_package_info( session, pkg.pkgKey, datatype.capitalize()) if data: @@ -214,8 +217,9 @@ def get_pkg(request): if pretty: args = dict(sort_keys=True, indent=4, separators=(',', ': ')) - output = web.Response(body=json.dumps(output, **args).encode('utf-8'), - content_type='application/json') + output = web.Response( + body=json.dumps(output, **args).encode('utf-8'), + content_type='application/json') return output @@ -233,8 +237,10 @@ def get_src_pkg(request): if pretty: args = dict(sort_keys=True, indent=4, separators=(',', ': ')) - return web.Response(body=json.dumps(output, **args).encode('utf-8'), - content_type='application/json') + return web.Response( + body=json.dumps(output, **args).encode('utf-8'), + content_type='application/json') + @asyncio.coroutine @allows_jsonp @@ -263,8 +269,9 @@ def get_pkg_files(request): if pretty: args = dict(sort_keys=True, indent=4, separators=(',', ': ')) - return web.Response(body=json.dumps(output, **args).encode('utf-8'), - content_type='application/json') + return web.Response( + body=json.dumps(output, **args).encode('utf-8'), + content_type='application/json') @asyncio.coroutine @@ -294,8 +301,9 @@ def get_pkg_changelog(request): if pretty: args = dict(sort_keys=True, indent=4, separators=(',', ': ')) - return web.Response(body=json.dumps(output, **args).encode('utf-8'), - content_type='application/json') + return web.Response( + body=json.dumps(output, **args).encode('utf-8'), + content_type='application/json') @asyncio.coroutine @@ -305,7 +313,8 @@ def list_branches(request): pretty = _get_pretty(request) output = sorted(list(set([ # Remove the front part `mdapi-` and the end part -.sqlite - filename.replace('mdapi-', '').rsplit('-', 2)[0].replace('-updates', '') + filename.replace('mdapi-', '').rsplit('-', 2)[0].replace( + '-updates', '') for filename in os.listdir(CONFIG['DB_FOLDER']) if filename.startswith('mdapi') and filename.endswith('.sqlite') ]))) diff --git a/mdapi/lib.py b/mdapi/lib.py index 9b547ee..2af05ab 100644 --- a/mdapi/lib.py +++ b/mdapi/lib.py @@ -113,7 +113,6 @@ def get_package_by_src(session, pkg_name): return simple_match # If there is not a direct match, look by the sourcerpm name - output = None cnt = 0 try: pkg = session.query( @@ -169,6 +168,7 @@ def get_package_by(session, tablename, key, cnt=None): return output + @asyncio.coroutine def get_package_info(session, pkgKey, tablename): ''' Return the information contained in the specified table for the @@ -196,6 +196,7 @@ def get_package_info(session, pkgKey, tablename): return output + @asyncio.coroutine def get_co_packages(session, srcpkg_name): ''' Return the name of all the packages coming from the same @@ -220,6 +221,7 @@ def get_co_packages(session, srcpkg_name): return output + @asyncio.coroutine def get_files(session, pkg_id): ''' Return the list of all the files in a package given its key. @@ -246,6 +248,7 @@ def get_files(session, pkg_id): return output + @asyncio.coroutine def get_changelog(session, pkg_id): ''' Return the list of all the changelog in a package given its key. diff --git a/mdapi/primary.py b/mdapi/primary.py index 778f9b5..ed27e47 100644 --- a/mdapi/primary.py +++ b/mdapi/primary.py @@ -113,7 +113,6 @@ class Conflicts(BASEDEP): __tablename__ = 'conflicts' - class Obsoletes(BASEDEP): ''' Maps the provides table in the primary.sqlite database from repodata to a python object.