mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-13 12:19:51 +08:00
Fix flake8 errors
This commit is contained in:
@@ -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.")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
"""
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user