Merge pull request #1747 from jberry-suse/ci-flake8-3.6-tweaks

CI: ignore W504 and resolve other new flake8 detected issues
This commit is contained in:
Jimmy Berry 2018-10-25 13:20:00 -05:00 committed by GitHub
commit 3ad87ff320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 25 additions and 26 deletions

View File

@ -1,4 +1,4 @@
[flake8]
exclude = .open-build-service/, abichecker, openqa, openqa-maintenance.py
max-line-length = 100
ignore = E501,F401,E302,E228,E128,E251,E201,E202,E203,E305,F841,E265,E261,E266,E712,E401,E126,E502,E222,E241,E711,E226,E125,E123,W293,W391,E731,E101,E227,E713,E225,E124,E221,E127,E701,E714,W503,E129,E303,E741,E722
ignore = E501,F401,E302,E228,E128,E251,E201,E202,E203,E305,F841,E265,E261,E266,E712,E401,E126,E502,E222,E241,E711,E226,E125,E123,W293,W391,E731,E101,E227,E713,E225,E124,E221,E127,E701,E714,W503,W504,E129,E303,E741,E722

View File

@ -99,7 +99,7 @@ if not options.version:
if loc is None:
raise Exception("empty location!")
m = re.search('(?:Snapshot|Build)([\d.]+)-Media', loc)
m = re.search(r'(?:Snapshot|Build)([\d.]+)-Media', loc)
if m is None:
raise Exception("failed to parse %s"%loc)

View File

@ -164,7 +164,7 @@ class Leaper(ReviewBot.ReviewBot):
if review_result == None:
other_projects_to_check = []
m = re.match('SUSE:SLE-(\d+)(?:-SP(\d+)):', target_project)
m = re.match(r'SUSE:SLE-(\d+)(?:-SP(\d+)):', target_project)
if m:
sle_version = int(m.group(1))
sp_version = int(m.group(2))

View File

@ -268,7 +268,6 @@ class Manager42(object):
return srcmd5, historyrevs[srcmd5]
return None, None
# check if we can find the srcmd5 in any of our underlay
# projects
def check_one_package(self, package):

View File

@ -331,7 +331,7 @@ def ingest_release_schedule(project):
# Extract Factory "release schedule" from Tumbleweed snapshot list.
command = 'rsync rsync.opensuse.org::opensuse-full/opensuse/tumbleweed/iso/Changes.* | ' \
'grep -oP "Changes\.\K\d{5,}"'
'grep -oP "' + r'Changes\.\K\d{5,}' + '"'
snapshots = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).communicate()[0]
for date in snapshots.split():
release_schedule[datetime.strptime(date, '%Y%m%d')] = 'Snapshot {}'.format(date)
@ -547,9 +547,9 @@ def main(args):
if args.wipe_cache:
Cache.delete_all()
if args.heavy_cache:
Cache.PATTERNS['/search/request'] = sys.maxint
Cache.PATTERNS['/source/[^/]+/{}/_history'.format(package)] = sys.maxint
Cache.PATTERNS['/source/[^/]+/{}/[^/]+\?rev=.*'.format(package)] = sys.maxint
Cache.PATTERNS[r'/search/request'] = sys.maxint
Cache.PATTERNS[r'/source/[^/]+/{}/_history'.format(package)] = sys.maxint
Cache.PATTERNS[r'/source/[^/]+/{}/[^/]+\?rev=.*'.format(package)] = sys.maxint
Cache.init('metrics')
Config(apiurl, args.project)

View File

@ -71,32 +71,32 @@ class Cache(object):
TTL_SHORT = 5 * 60
TTL_DUPLICATE = 3
PATTERNS = {
'/build/[^/]+/_result': TTL_DUPLICATE,
r'/build/[^/]+/_result': TTL_DUPLICATE,
# For cycles when run via repo-checker cache non-stagings.
'/build/(?:[^/](?!:Staging:))+/[^/]+/[^/]+/_builddepinfo$': TTL_MEDIUM,
r'/build/(?:[^/](?!:Staging:))+/[^/]+/[^/]+/_builddepinfo$': TTL_MEDIUM,
# Group members cannot be guaranteed, but change rarely.
'/group/[^/?]+$': TTL_SHORT,
r'/group/[^/?]+$': TTL_SHORT,
# Clear target project cache upon request acceptance.
'/request/(\d+)\?.*newstate=accepted': TTL_DUPLICATE,
"/search/package\?match=\[@project='([^']+)'\]$": TTL_LONG,
r'/request/(\d+)\?.*newstate=accepted': TTL_DUPLICATE,
r"/search/package\?match=\[@project='([^']+)'\]$": TTL_LONG,
# Potentially expire the latest_updated since it will be the only way to
# tell after an adi staging is removed. For now just cache the calls
# that occur in rapid succession.
"/search/project/id\?match=starts-with\(@name,'([^']+)\:'\)$": TTL_DUPLICATE,
r"/search/project/id\?match=starts-with\(@name,'([^']+)\:'\)$": TTL_DUPLICATE,
# List of all projects may change, but relevant ones rarely.
'/source$': TTL_LONG,
r'/source$': TTL_LONG,
# Sources will be expired with project, could be done on package level.
'/source/([^/?]+)(?:\?.*)?$': TTL_LONG,
r'/source/([^/?]+)(?:\?.*)?$': TTL_LONG,
# Project will be marked changed when packages are added/removed.
'/source/([^/]+)/_meta$': TTL_LONG,
'/source/([^/]+)/(?:[^/]+)/(?:_meta|_link)$': TTL_LONG,
'/source/([^/]+)/dashboard/[^/]+': TTL_LONG,
'/source/([^/]+)/_attribute/[^/]+': TTL_MEDIUM,
r'/source/([^/]+)/_meta$': TTL_LONG,
r'/source/([^/]+)/(?:[^/]+)/(?:_meta|_link)$': TTL_LONG,
r'/source/([^/]+)/dashboard/[^/]+': TTL_LONG,
r'/source/([^/]+)/_attribute/[^/]+': TTL_MEDIUM,
# Handles clearing local cache on package deletes. Lots of queries like
# updating project info, comment, and package additions.
'/source/([^/]+)/(?:[^/?]+)(?:\?[^/]+)?$': TTL_LONG,
r'/source/([^/]+)/(?:[^/?]+)(?:\?[^/]+)?$': TTL_LONG,
# Presumably users are not interweaving in short windows.
'/statistics/latest_updated': TTL_SHORT,
r'/statistics/latest_updated': TTL_SHORT,
}
last_updated = {}

View File

@ -28,7 +28,7 @@ from osclib.conf import Config
from osclib.memoize import memoize
BINARY_REGEX = r'(?:.*::)?(?P<filename>(?P<name>.*)-(?P<version>[^-]+)-(?P<release>[^-]+)\.(?P<arch>[^-\.]+))'
RPM_REGEX = BINARY_REGEX + '\.rpm'
RPM_REGEX = BINARY_REGEX + r'\.rpm'
BinaryParsed = namedtuple('BinaryParsed', ('package', 'filename', 'name', 'arch'))
@memoize(session=True)

View File

@ -265,7 +265,7 @@ class StagingAPI(object):
return package_info
def extract_specfile_short(self, filelist):
packages = [spec[:-5] for spec in filelist if re.search('\.spec$', spec)]
packages = [spec[:-5] for spec in filelist if re.search(r'\.spec$', spec)]
return packages

View File

@ -487,7 +487,7 @@ class PkgListGen(ToolBase.ToolBase):
# only comment first time
comment = None
x = ET.tostring(x, pretty_print=True)
x = re.sub('\s*<!-- reason:', ' <!-- reason:', x)
x = re.sub(r'\s*<!-- reason:', ' <!-- reason:', x)
# fh.write(ET.tostring(x, pretty_print = True, doctype = '<?xml version="1.0" encoding="UTF-8"?>'))
fh.write(x)
return summary

View File

@ -689,7 +689,7 @@ class OBS(object):
return response
@DELETE(re.compile('/source/openSUSE:Factory:Staging:[B|C]/\w+'))
@DELETE(re.compile(r'/source/openSUSE:Factory:Staging:[B|C]/\w+'))
def delete_package(self, request, uri, headers):
"""Delete a source package from a Staging project."""
package = re.search(r'/source/([\w:]+/\w+)', uri).group(1)