diff --git a/python/mozrelease/mozrelease/chunking.py b/python/mozrelease/mozrelease/chunking.py index 2fe947a7fa0d..7f3ee3f1c17b 100644 --- a/python/mozrelease/mozrelease/chunking.py +++ b/python/mozrelease/mozrelease/chunking.py @@ -10,7 +10,7 @@ class ChunkingError(Exception): def getChunk(things, chunks, thisChunk): if thisChunk > chunks: raise ChunkingError("thisChunk (%d) is greater than total chunks (%d)" % - (thisChunk, chunks)) + (thisChunk, chunks)) possibleThings = copy(things) nThings = len(possibleThings) for c in range(1, chunks + 1): diff --git a/python/mozrelease/mozrelease/paths.py b/python/mozrelease/mozrelease/paths.py index 0611ba1bb3ad..6d6c02f4f68d 100644 --- a/python/mozrelease/mozrelease/paths.py +++ b/python/mozrelease/mozrelease/paths.py @@ -6,6 +6,7 @@ product_ftp_map = { "fennec": "mobile", } + def product2ftp(product): return product_ftp_map.get(product, product) @@ -16,7 +17,7 @@ def getCandidatesDir(product, version, buildNumber, protocol=None, server=None): product = product2ftp(product) directory = "/{}/candidates/{}-candidates/build{}".format( - product, str(version), str(buildNumber) + product, str(version), str(buildNumber), ) if protocol: diff --git a/python/mozrelease/mozrelease/platforms.py b/python/mozrelease/mozrelease/platforms.py index eda38d45e18b..0e3199d2a0c7 100644 --- a/python/mozrelease/mozrelease/platforms.py +++ b/python/mozrelease/mozrelease/platforms.py @@ -39,12 +39,15 @@ info_file_platform_map = { "win64": "win64", } + def ftp2updatePlatforms(platform): return update_platform_map.get(platform, platform) + def ftp2shippedLocales(platform): return sl_platform_map.get(platform, platform) + def shippedLocales2ftp(platform): matches = [] try: @@ -54,5 +57,6 @@ def shippedLocales2ftp(platform): except IndexError: return [platform] + def ftp2infoFile(platform): return info_file_platform_map.get(platform, platform) diff --git a/python/mozrelease/mozrelease/update_verify.py b/python/mozrelease/mozrelease/update_verify.py index a5a787f54a80..cdb00144fd10 100644 --- a/python/mozrelease/mozrelease/update_verify.py +++ b/python/mozrelease/mozrelease/update_verify.py @@ -1,4 +1,9 @@ -from __future__ import absolute_import +# -*- coding: utf-8 -*- +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from __future__ import absolute_import, print_function import os import re @@ -50,15 +55,16 @@ class UpdateVerifyConfig(object): def _parseLine(self, line): entry = {} - items = re.findall("\w+=[\"'][^\"']*[\"']", line) + items = re.findall(r"\w+=[\"'][^\"']*[\"']", line) for i in items: m = re.search( - "(?P\w+)=[\"'](?P.+)[\"']", i).groupdict() + r"(?P\w+)=[\"'](?P.+)[\"']", i).groupdict() if m["key"] not in self.global_keys and m["key"] not in self.release_keys: raise UpdateVerifyError( "Unknown key '%s' found on line:\n%s" % (m["key"], line)) if m["key"] in entry: - raise UpdateVerifyError("Multiple values found for key '%s' on line:\n%s" % (m["key"], line)) + raise UpdateVerifyError( + "Multiple values found for key '%s' on line:\n%s" % (m["key"], line)) entry[m["key"]] = m["value"] if not entry: raise UpdateVerifyError("No parseable data in line '%s'" % line) @@ -119,7 +125,9 @@ class UpdateVerifyConfig(object): If a string is passed, they will be converted to a list for internal storage""" if self.getRelease(build_id, from_path): - raise UpdateVerifyError("Couldn't add release identified by build_id '%s' and from_path '%s': already exists in config" % (build_id, from_path)) + raise UpdateVerifyError( + "Couldn't add release identified by build_id '%s' and from_path '%s': " + "already exists in config" % (build_id, from_path)) if isinstance(locales, basestring): locales = sorted(list(locales.split())) if isinstance(patch_types, basestring): @@ -140,7 +148,9 @@ class UpdateVerifyConfig(object): def addLocaleToRelease(self, build_id, locale, from_path=None): r = self.getRelease(build_id, from_path) if not r: - raise UpdateVerifyError("Couldn't add '%s' to release identified by build_id '%s' and from_path '%s': '%s' doesn't exist in this config." % (locale, build_id, from_path, build_id)) + raise UpdateVerifyError( + "Couldn't add '%s' to release identified by build_id '%s' and from_path '%s': " + "'%s' doesn't exist in this config." % (locale, build_id, from_path, build_id)) r["locales"].append(locale) r["locales"] = sorted(r["locales"]) diff --git a/python/mozrelease/test/test_buglist_creator.py b/python/mozrelease/test/test_buglist_creator.py index a31fc815971b..272ccb9b1968 100644 --- a/python/mozrelease/test/test_buglist_creator.py +++ b/python/mozrelease/test/test_buglist_creator.py @@ -3,6 +3,11 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. +# -*- coding: utf-8 -*- +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + from __future__ import absolute_import, print_function import json @@ -110,7 +115,7 @@ def test_get_previous_tag_version(version, tag, previous_tag): mock_hg_json = { 'tags': [ - {'tag': tag} for tag in ff_48_tags + {'tag': ff_48_tag} for ff_48_tag in ff_48_tags ], } diff --git a/python/mozrelease/test/test_update_verify.py b/python/mozrelease/test/test_update_verify.py index 46de2675a978..87e5ec088850 100644 --- a/python/mozrelease/test/test_update_verify.py +++ b/python/mozrelease/test/test_update_verify.py @@ -3,6 +3,8 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. +from __future__ import absolute_import, print_function + from md5 import md5 import os from tempfile import mkstemp diff --git a/tools/lint/flake8.yml b/tools/lint/flake8.yml index 3c3016a21ceb..8adc160e06a0 100644 --- a/tools/lint/flake8.yml +++ b/tools/lint/flake8.yml @@ -22,6 +22,7 @@ flake8: - python/mozboot - python/mozbuild/mozpack/path.py - python/mozlint + - python/mozrelease - python/mozterm - python/mozversioncontrol - python/safety