diff --git a/scripts/gen_ed25519_key.py b/scripts/gen_ed25519_key.py index 7bb9181a..2b9ef757 100755 --- a/scripts/gen_ed25519_key.py +++ b/scripts/gen_ed25519_key.py @@ -5,6 +5,7 @@ easier standalone use. It could easily be a `console_script` though. """ + from __future__ import print_function import base64 diff --git a/src/scriptworker/client.py b/src/scriptworker/client.py index 59f3573d..42aa2966 100644 --- a/src/scriptworker/client.py +++ b/src/scriptworker/client.py @@ -9,6 +9,7 @@ log (logging.Logger): the log object for the module """ + import asyncio import logging import os diff --git a/src/scriptworker/config.py b/src/scriptworker/config.py index 68f1708c..244417d7 100644 --- a/src/scriptworker/config.py +++ b/src/scriptworker/config.py @@ -7,6 +7,7 @@ credentials, if they aren't in the config file or environment. """ + import argparse import logging import os diff --git a/src/scriptworker/context.py b/src/scriptworker/context.py index 92238058..dbaebffc 100644 --- a/src/scriptworker/context.py +++ b/src/scriptworker/context.py @@ -10,6 +10,7 @@ DEFAULT_MAX_CONCURRENT_DOWNLOADS (int): default max concurrent downloads """ + import asyncio import json import logging diff --git a/src/scriptworker/cot/generate.py b/src/scriptworker/cot/generate.py index 6d29d814..457b78da 100644 --- a/src/scriptworker/cot/generate.py +++ b/src/scriptworker/cot/generate.py @@ -5,6 +5,7 @@ log (logging.Logger): the log object for this module. """ + import logging import os diff --git a/src/scriptworker/cot/verify.py b/src/scriptworker/cot/verify.py index bf701e51..fff8e772 100644 --- a/src/scriptworker/cot/verify.py +++ b/src/scriptworker/cot/verify.py @@ -719,12 +719,8 @@ async def download_cot_artifact(chain, task_id, path): link = chain.get_link(task_id) log.debug("Verifying {} is in {} cot artifacts...".format(path, task_id)) if not link.cot: - log.warning( - 'Chain of Trust for "{}" in {} does not exist. See above log for more details. \ -Skipping download of this artifact'.format( - path, task_id - ) - ) + log.warning('Chain of Trust for "{}" in {} does not exist. See above log for more details. \ +Skipping download of this artifact'.format(path, task_id)) return if path not in link.cot["artifacts"]: @@ -2105,8 +2101,7 @@ def verify_cot_cmdln(args=None, event_loop=None): """ args = args or sys.argv[1:] - parser = argparse.ArgumentParser( - description="""Verify a given task's chain of trust. + parser = argparse.ArgumentParser(description="""Verify a given task's chain of trust. Given a task's `task_id`, get its task definition, then trace its chain of trust back to the tree. This doesn't verify chain of trust artifact signatures, @@ -2118,8 +2113,7 @@ def verify_cot_cmdln(args=None, event_loop=None): or in the CREDS_FILES http://bit.ly/2fVMu0A If you are verifying against a private github repo, please also set in environment -SCRIPTWORKER_GITHUB_OAUTH_TOKEN to an OAUTH token with read permissions to the repo""" - ) +SCRIPTWORKER_GITHUB_OAUTH_TOKEN to an OAUTH token with read permissions to the repo""") parser.add_argument("task_id", help="the task id to test") parser.add_argument("--task-type", help="the task type to test", choices=sorted(get_valid_task_types().keys()), required=True) parser.add_argument("--cleanup", help="clean up the temp dir afterwards", dest="cleanup", action="store_true", default=False) @@ -2186,15 +2180,13 @@ def create_test_workdir(args=None, event_loop=None): """ args = args or sys.argv[1:] - parser = argparse.ArgumentParser( - description="""Populate a test `work_dir`. + parser = argparse.ArgumentParser(description="""Populate a test `work_dir`. Given a scriptworker task's `task_id`, get its task definition, write it to `./work/task.json`, then download its `upstreamArtifacts` and put them in `./work/cot/TASK_ID/PATH`. -This is helpful in manually testing a *script run.""" - ) +This is helpful in manually testing a *script run.""") parser.add_argument("--path", help="relative path to the work_dir", default="work") parser.add_argument("--overwrite", help="overwrite an existing work_dir", action="store_true") parser.add_argument("task_id", help="the task id to test") diff --git a/src/scriptworker/ed25519.py b/src/scriptworker/ed25519.py index c7020452..caf67672 100644 --- a/src/scriptworker/ed25519.py +++ b/src/scriptworker/ed25519.py @@ -5,6 +5,7 @@ log (logging.Logger): the log object for the module """ + import argparse import base64 import functools @@ -140,13 +141,11 @@ def verify_ed25519_signature_cmdln(args=None, exception=SystemExit): """ args = args or sys.argv[1:] - parser = argparse.ArgumentParser( - description="""Verify an ed25519 signature from the command line. + parser = argparse.ArgumentParser(description="""Verify an ed25519 signature from the command line. Given a file and its detached signature, verify that it has been signed with a valid key. This key can be specified on the command line; otherwise we'll -default to ``config['ed25519_public_keys']``.""" - ) +default to ``config['ed25519_public_keys']``.""") parser.add_argument("--pubkey", help="path to a base64-encoded ed25519 pubkey, optional") parser.add_argument("file_path") parser.add_argument("sig_path") diff --git a/src/scriptworker/log.py b/src/scriptworker/log.py index b3a90916..443ad9e3 100644 --- a/src/scriptworker/log.py +++ b/src/scriptworker/log.py @@ -5,6 +5,7 @@ log (logging.Logger): the log object for this module. """ + import asyncio import logging import logging.handlers diff --git a/src/scriptworker/utils.py b/src/scriptworker/utils.py index c62be003..9e16166b 100644 --- a/src/scriptworker/utils.py +++ b/src/scriptworker/utils.py @@ -5,6 +5,7 @@ log (logging.Logger): the log object for the module """ + import asyncio import functools import hashlib diff --git a/src/scriptworker/worker.py b/src/scriptworker/worker.py index 7d656632..3c04cd83 100644 --- a/src/scriptworker/worker.py +++ b/src/scriptworker/worker.py @@ -5,6 +5,7 @@ log (logging.Logger): the log object for the module. """ + import asyncio import logging import signal diff --git a/tests/__init__.py b/tests/__init__.py index 77794451..c6153728 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # coding=utf-8 """Test base files""" + import asyncio import json import os diff --git a/tests/test_config.py b/tests/test_config.py index aa908423..693397c3 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # coding=utf-8 """Test scriptworker.config""" + import json import os from copy import deepcopy diff --git a/tests/test_context.py b/tests/test_context.py index 1538634c..ff534cf8 100644 --- a/tests/test_context.py +++ b/tests/test_context.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # coding=utf-8 """Test scriptworker.context""" + import asyncio import json import os diff --git a/tests/test_cot_generate.py b/tests/test_cot_generate.py index d3283e1f..bca3a8be 100644 --- a/tests/test_cot_generate.py +++ b/tests/test_cot_generate.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # coding=utf-8 """Test scriptworker.cot.generate""" + import logging import os diff --git a/tests/test_cot_verify.py b/tests/test_cot_verify.py index 810a4513..4b014423 100644 --- a/tests/test_cot_verify.py +++ b/tests/test_cot_verify.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # coding=utf-8 """Test scriptworker.cot.verify""" + import json import logging import os @@ -2179,7 +2180,7 @@ async def test_trace_back_to_tree_diff_repo(chain, decision_link, build_link, do async def test_trace_back_to_tree_mobile_staging_repos_dont_access_restricted_scopes( mobile_chain, mobile_github_release_link, mobile_build_link, source_url, raises, mocker ): - (source_url, raises) = ("https://github.com/mozilla-mobile/reference-browser", False) + source_url, raises = ("https://github.com/mozilla-mobile/reference-browser", False) mobile_github_release_link.task["metadata"]["source"] = source_url mobile_chain.links = [mobile_github_release_link, mobile_build_link] mocker.patch.object(mobile_chain, "is_try_or_pull_request", new=create_async(result=False)) diff --git a/tests/test_integration.py b/tests/test_integration.py index 73139655..a263abca 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # coding=utf-8 """Scriptworker integration tests.""" + import asyncio import json import logging @@ -36,8 +37,7 @@ def read_integration_creds(): creds = read_worker_creds(key="integration_credentials") if creds: return creds - raise Exception( - """To run integration tests, put your worker-test clientId creds, in json format, + raise Exception("""To run integration tests, put your worker-test clientId creds, in json format, in one of these files: {files} @@ -54,10 +54,7 @@ def read_integration_creds(): This clientId will need the scope assume:project:taskcluster:worker-test-scopes -To skip integration tests, set the environment variable NO_CREDENTIALS_TESTS""".format( - files=CREDS_FILES - ) - ) +To skip integration tests, set the environment variable NO_CREDENTIALS_TESTS""".format(files=CREDS_FILES)) def build_config(override, basedir): diff --git a/tests/test_log.py b/tests/test_log.py index d85138fd..eada47d6 100644 --- a/tests/test_log.py +++ b/tests/test_log.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # coding=utf-8 """Test scriptworker.log""" + import asyncio import logging import os diff --git a/tests/test_production.py b/tests/test_production.py index a32cc8bc..495aae97 100644 --- a/tests/test_production.py +++ b/tests/test_production.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # coding=utf-8 """Scriptworker production CoT verification tests.""" + import json import logging import os diff --git a/tests/test_task.py b/tests/test_task.py index 40f5514f..1b38e324 100644 --- a/tests/test_task.py +++ b/tests/test_task.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # coding=utf-8 """Test scriptworker.task""" + import asyncio import glob import json diff --git a/tests/test_utils.py b/tests/test_utils.py index 952e39c5..0fe45dd0 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # coding=utf-8 """Test scriptworker.utils""" + import asyncio import os import re diff --git a/tests/test_worker.py b/tests/test_worker.py index ba4b5b0e..cbcc6c69 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # coding=utf-8 """Test scriptworker.worker""" + import asyncio import json import os