Fix flake8 errors

This commit is contained in:
mprahl
2018-03-23 11:30:48 -04:00
parent 20d68628d2
commit 19db295795
8 changed files with 18 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
import os
import sys
from six.moves import input
import pdc_client
servername, token, variant_uid, new_tag = \
@@ -15,7 +16,7 @@ pdc = pdc_client.PDCClient(servername, token=token)
print("Querying for %r to see what tag it has today" % variant_uid)
obj = pdc['unreleasedvariants'][variant_uid]()
answer = raw_input("Change koji_tag for %r from %r to %r? [y/N]" % (
answer = input("Change koji_tag for %r from %r to %r? [y/N]" % (
variant_uid, obj['koji_tag'], new_tag))
if not answer.lower() in ('y', 'yes'):
print("Exiting, taking no action.")

View File

@@ -45,9 +45,9 @@ from flask import Flask, has_app_context, url_for
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.pool import StaticPool
from logging import getLogger
import gi # noqa
gi.require_version('Modulemd', '1.0') # noqa
from gi.repository import Modulemd # noqa
import gi # noqa
gi.require_version('Modulemd', '1.0') # noqa
from gi.repository import Modulemd # noqa
from module_build_service.logger import (
init_logging, ModuleBuildLogs, level_flags)

View File

@@ -73,7 +73,7 @@ class KojiContentGenerator(object):
:param output: list, decoded output (str) from the rpm subprocess
:param tags: list, str fields used for query output
:return: list, dicts describing each rpm package
""" # noqa
""" # noqa: E501
def field(tag):
"""

View File

@@ -302,9 +302,8 @@ class Config(object):
'distgits': {
'type': dict,
'default': {
'git://pkgs.fedoraproject.org':
('fedpkg clone --anonymous {}',
'fedpkg --release module sources'),
'git://pkgs.fedoraproject.org': ('fedpkg clone --anonymous {}',
'fedpkg --release module sources'),
},
'desc': 'Mapping between dist-git and command to '},
'mock_config': {
@@ -401,8 +400,8 @@ class Config(object):
'base_module_names': {
'type': set,
'default': set(['platform', 'bootstrap']),
'desc': "Set of module names which defines the product version "
"(by their stream) of modules depending on them."},
'desc': ("Set of module names which defines the product version "
"(by their stream) of modules depending on them.")},
'koji_cg_build_tag_template': {
'type': str,
'default': "{}-modular-updates-candidate",
@@ -586,7 +585,7 @@ class Config(object):
raise ValueError('Unsupported authentication method')
if s.lower() == 'kerberos':
try:
import ldap3 # noqa
import ldap3 # noqa
except ImportError:
raise ValueError("ldap3 is required for kerberos authz")
self._auth_method = s.lower()

View File

@@ -22,6 +22,7 @@
GLib Related helper functions
Originally written by Nils Philippsen in https://pagure.io/modulemd/pull-request/63
"""
from six import text_type
from gi.repository import GLib
@@ -52,7 +53,7 @@ def variant_list(l):
item = ''
if type(item) == str:
l_variant.append(variant_str(item))
elif type(item) == unicode:
elif type(item) == text_type:
l_variant.append(variant_str(item.encode('utf-8')))
elif type(item) == list:
l_variant.append(variant_list(item))
@@ -86,7 +87,7 @@ def dict_values(d):
v = ''
if type(v) == str:
d_variant[k] = variant_str(v)
elif type(v) == unicode:
elif type(v) == text_type:
d_variant[k] = variant_str(v.encode('utf-8'))
elif type(v) == list:
d_variant[k] = variant_list(v)

View File

@@ -397,7 +397,7 @@ class ModuleBuild(MBSBase):
def siblings(self):
query = self.query.filter_by(
name=self.name, stream=self.stream, version=self.version).options(
load_only('id')).filter(ModuleBuild.id != self.id)
load_only('id')).filter(ModuleBuild.id != self.id)
return [build.id for build in query.all()]
@classmethod

View File

@@ -491,7 +491,7 @@ def load_local_builds(local_build_nsvs, session=None):
# Sort with the biggest version first
try:
# py27
builds.sort(lambda a, b: -cmp(a[2], b[2]))
builds.sort(lambda a, b: -cmp(a[2], b[2])) # noqa: F821
except TypeError:
# py3
builds.sort(key=lambda a: a[2], reverse=True)

View File

@@ -1210,7 +1210,8 @@ class TestBuild:
module = db.session.query(models.ModuleBuild).get(module_build_id)
return module.batch == 2 or module.state >= models.BUILD_STATES['done']
with patch('module_build_service.utils.batches.at_concurrent_component_threshold') as mock_acct:
with patch('module_build_service.utils.batches.at_concurrent_component_threshold') as \
mock_acct:
# Once we get to batch 2, then simulate the concurrent threshold being met
def _at_concurrent_component_threshold(config, session):
return db.session.query(models.ModuleBuild).get(module_build_id).batch == 2