flake8: follow E265 rule

This commit is contained in:
Yuming Zhu 2020-02-25 22:50:14 +08:00
parent 642508ccf6
commit 97cfaa4fcf
27 changed files with 794 additions and 793 deletions

View file

@ -3285,7 +3285,7 @@ class LiveCDTask(ImageTask):
## livemedia-creator # livemedia-creator
class LiveMediaTask(ImageTask): class LiveMediaTask(ImageTask):
Methods = ['createLiveMedia'] Methods = ['createLiveMedia']
@ -4770,7 +4770,7 @@ class BuildSRPMFromSCMTask(BaseBuildTask):
'repo_id': repo_id} 'repo_id': repo_id}
if self.options.scm_credentials_dir is not None and os.path.isdir(self.options.scm_credentials_dir): if self.options.scm_credentials_dir is not None and os.path.isdir(self.options.scm_credentials_dir):
rootopts['bind_opts'] = {'dirs' : {self.options.scm_credentials_dir : '/credentials',}} rootopts['bind_opts'] = {'dirs' : {self.options.scm_credentials_dir : '/credentials',}}
## Force internal_dev_setup back to true because bind_opts is used to turn it off # Force internal_dev_setup back to true because bind_opts is used to turn it off
rootopts['internal_dev_setup'] = True rootopts['internal_dev_setup'] = True
br_arch = self.find_arch('noarch', self.session.host.getHost(), self.session.getBuildConfig(build_tag['id'], event=event_id)) br_arch = self.find_arch('noarch', self.session.host.getHost(), self.session.getBuildConfig(build_tag['id'], event=event_id))
broot = BuildRoot(self.session, self.options, build_tag['id'], br_arch, self.id, **rootopts) broot = BuildRoot(self.session, self.options, build_tag['id'], br_arch, self.id, **rootopts)

View file

@ -128,7 +128,7 @@ for h in (
'RECOMMENDNAME', 'RECOMMENDVERSION', 'RECOMMENDFLAGS'): 'RECOMMENDNAME', 'RECOMMENDVERSION', 'RECOMMENDFLAGS'):
SUPPORTED_OPT_DEP_HDRS[h] = hasattr(rpm, 'RPMTAG_%s' % h) SUPPORTED_OPT_DEP_HDRS[h] = hasattr(rpm, 'RPMTAG_%s' % h)
## BEGIN kojikamid dup # BEGIN kojikamid dup #
class Enum(dict): class Enum(dict):
"""A simple class to track our enumerated constants """A simple class to track our enumerated constants
@ -176,7 +176,7 @@ class Enum(dict):
update = _notImplemented update = _notImplemented
setdefault = _notImplemented setdefault = _notImplemented
## END kojikamid dup # END kojikamid dup #
API_VERSION = 1 API_VERSION = 1
@ -266,7 +266,7 @@ TAG_UPDATE_TYPES = Enum((
'MANUAL', 'MANUAL',
)) ))
## BEGIN kojikamid dup # BEGIN kojikamid dup #
CHECKSUM_TYPES = Enum(( CHECKSUM_TYPES = Enum((
'md5', 'md5',
@ -274,7 +274,7 @@ CHECKSUM_TYPES = Enum((
'sha256', 'sha256',
)) ))
## END kojikamid dup # END kojikamid dup #
# PARAMETERS # PARAMETERS
BASEDIR = '/mnt/koji' BASEDIR = '/mnt/koji'
@ -285,7 +285,7 @@ PRIO_DEFAULT = 20
DEFAULT_REQUEST_TIMEOUT = 60 * 60 * 12 DEFAULT_REQUEST_TIMEOUT = 60 * 60 * 12
DEFAULT_AUTH_TIMEOUT = 60 DEFAULT_AUTH_TIMEOUT = 60
## BEGIN kojikamid dup # BEGIN kojikamid dup #
# Exceptions # Exceptions
PythonImportError = ImportError # will be masked by koji's one PythonImportError = ImportError # will be masked by koji's one
@ -302,7 +302,7 @@ class GenericError(Exception):
return str(self.args[0]) return str(self.args[0])
except: except:
return str(self.__dict__) return str(self.__dict__)
## END kojikamid dup # END kojikamid dup #
class LockError(GenericError): class LockError(GenericError):
"""Raised when there is a lock conflict""" """Raised when there is a lock conflict"""
@ -320,12 +320,12 @@ class ActionNotAllowed(GenericError):
"""Raised when the session does not have permission to take some action""" """Raised when the session does not have permission to take some action"""
faultCode = 1004 faultCode = 1004
## BEGIN kojikamid dup # BEGIN kojikamid dup #
class BuildError(GenericError): class BuildError(GenericError):
"""Raised when a build fails""" """Raised when a build fails"""
faultCode = 1005 faultCode = 1005
## END kojikamid dup # END kojikamid dup #
class AuthLockError(AuthError): class AuthLockError(AuthError):
"""Raised when a lock prevents authentication""" """Raised when a lock prevents authentication"""
@ -493,7 +493,7 @@ def safe_xmlrpc_loads(s):
except Fault as f: except Fault as f:
return f return f
## BEGIN kojikamid dup # BEGIN kojikamid dup #
def ensuredir(directory): def ensuredir(directory):
@ -528,7 +528,7 @@ def ensuredir(directory):
raise raise
return directory return directory
## END kojikamid dup # END kojikamid dup #
def daemonize(): def daemonize():
"""Detach and run in background""" """Detach and run in background"""
@ -643,6 +643,7 @@ class RawHeader(object):
ofs = 16 + i*16 + j*4 ofs = 16 + i*16 + j*4
data = [_ord(x) for x in self.header[ofs:ofs+4]] data = [_ord(x) for x in self.header[ofs:ofs+4]]
entry.append(multibyte(data)) entry.append(multibyte(data))
# print("Tag: %d, Type: %d, Offset: %x, Count: %d" % tuple(entry)) # print("Tag: %d, Type: %d, Offset: %x, Count: %d" % tuple(entry))
index[entry[0]] = entry index[entry[0]] = entry
self.datalen = dl self.datalen = dl

View file

@ -171,7 +171,7 @@ def log_output(session, path, args, outfile, uploadpath, cwd=None, logerror=0, a
return status[1] return status[1]
## BEGIN kojikamid dup # BEGIN kojikamid dup #
class SCM(object): class SCM(object):
"SCM abstraction class" "SCM abstraction class"
@ -546,7 +546,7 @@ class SCM(object):
# just use the same url # just use the same url
r['source'] = self.url r['source'] = self.url
return r return r
## END kojikamid dup # END kojikamid dup #
class TaskManager(object): class TaskManager(object):

View file

@ -118,6 +118,7 @@ class RunRootTask(koji.tasks.BaseTaskHandler):
if weight is not None: if weight is not None:
weight = max(weight, 0.5) weight = max(weight, 0.5)
self.session.host.setTaskWeight(self.id, weight) self.session.host.setTaskWeight(self.id, weight)
# noarch is funny # noarch is funny
if arch == "noarch": if arch == "noarch":
# we need a buildroot arch. Pick one that: # we need a buildroot arch. Pick one that:

View file

@ -15,7 +15,6 @@ import kojihub
from koji.context import context from koji.context import context
from koji.plugin import export from koji.plugin import export
__all__ = ('runroot',) __all__ = ('runroot',)

View file

@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
awk '/^## INSERT kojikamid dup/ {exit} {print $0}' kojikamid.py awk '/^# INSERT kojikamid dup #/ {exit} {print $0}' kojikamid.py
for fn in ../koji/__init__.py ../koji/daemon.py for fn in ../koji/__init__.py ../koji/daemon.py
do do
awk '/^## END kojikamid dup/ {p=0} p {print $0} /^## BEGIN kojikamid dup/ {p=1}' $fn awk '/^# END kojikamid dup #/ {p=0} p {print $0} /^# BEGIN kojikamid dup #/ {p=1}' $fn
done done
awk 'p {print $0} /^## INSERT kojikamid dup/ {p=1}' kojikamid.py awk 'p {print $0} /^# INSERT kojikamid dup #/ {p=1}' kojikamid.py

View file

@ -54,7 +54,7 @@ MANAGER_PORT = 7000
KOJIKAMID = True KOJIKAMID = True
## INSERT kojikamid dup # INSERT kojikamid dup #
class fakemodule(object): class fakemodule(object):
pass pass