From a85d3006c11aee4bd4a7dfdab7a6b6299530ef54 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Wed, 2 Sep 2020 09:31:23 +0200 Subject: [PATCH] Adjust the toddler sources for the new version of black >= 20.8b0 Signed-off-by: Pierre-Yves Chibon --- tests/plugins/test_pdc_import_compose.py | 6 ++++-- tests/test_runner.py | 3 ++- toddlers/playtime.py | 6 ++++-- toddlers/plugins/check_email_overrides.py | 9 ++++++--- toddlers/plugins/clean_retired_packages.py | 5 ++--- toddlers/plugins/debug.py | 2 +- toddlers/plugins/flag_ci_pr.py | 2 +- toddlers/plugins/flag_commit_build.py | 2 +- toddlers/plugins/packager_bugzilla_sync.py | 5 +++-- toddlers/plugins/pdc_import_compose.py | 4 ++-- toddlers/plugins/pdc_retired_packages.py | 12 ++++++------ toddlers/utils/bugzilla_system.py | 5 ++--- toddlers/utils/fedora_account.py | 18 ++++++------------ toddlers/utils/notify.py | 2 +- 14 files changed, 41 insertions(+), 40 deletions(-) diff --git a/tests/plugins/test_pdc_import_compose.py b/tests/plugins/test_pdc_import_compose.py index cc9865e..41d0ba8 100644 --- a/tests/plugins/test_pdc_import_compose.py +++ b/tests/plugins/test_pdc_import_compose.py @@ -629,7 +629,8 @@ class TestPDCImportComposeToddler: output = list( toddlers.plugins.pdc_import_compose._scrape_links( - session=session, url="https://kojipkgs.fedoraproject.org/..", + session=session, + url="https://kojipkgs.fedoraproject.org/..", ) ) assert ( @@ -919,7 +920,8 @@ class TestPDCImportComposeToddler: ) with pytest.raises( - beanbag.bbexcept.BeanBagException, match=r"Failed to create the release .*", + beanbag.bbexcept.BeanBagException, + match=r"Failed to create the release .*", ): toddlers.plugins.pdc_import_compose.ensure_release_exists( pdc, "release-id", {"foo": "bar"} diff --git a/tests/test_runner.py b/tests/test_runner.py index a9c3a53..2586434 100644 --- a/tests/test_runner.py +++ b/tests/test_runner.py @@ -56,7 +56,8 @@ class TestRunningToddler: toddler_list.append(tod) base_tod.__subclasses__.return_value = toddler_list with pytest.raises( - ValueError, match=r"Toddler named flag_ci_pr already exists.", + ValueError, + match=r"Toddler named flag_ci_pr already exists.", ): toddlers.runner.RunningToddler() diff --git a/toddlers/playtime.py b/toddlers/playtime.py index ce1a81c..1b71f20 100644 --- a/toddlers/playtime.py +++ b/toddlers/playtime.py @@ -47,10 +47,12 @@ def get_arguments(args): "(if that toddlers supports being triggered this way)." ) parser.add_argument( - "name", help="Name of the toddler to trigger", + "name", + help="Name of the toddler to trigger", ) parser.add_argument( - "--conf", help="Fedora-messaging configuration file to use", + "--conf", + help="Fedora-messaging configuration file to use", ) log_level_group = parser.add_mutually_exclusive_group() diff --git a/toddlers/plugins/check_email_overrides.py b/toddlers/plugins/check_email_overrides.py index f1bcaf6..ca99900 100644 --- a/toddlers/plugins/check_email_overrides.py +++ b/toddlers/plugins/check_email_overrides.py @@ -26,7 +26,7 @@ _log = logging.getLogger(__name__) class CheckEmailOverrides(ToddlerBase): - """ Listens to messages sent by playtime (which lives in toddlers) and check + """Listens to messages sent by playtime (which lives in toddlers) and check if the `email_overrides.toml` file stored in ansible is up to date. """ @@ -129,7 +129,8 @@ def get_arguments(args): description="Check the state of the email_overrides file" ) parser.add_argument( - "conf", help="Configuration file", + "conf", + help="Configuration file", ) parser.add_argument( "--dry-run", @@ -190,7 +191,9 @@ def main(args): config = merge_dicts(default_config, private_config) CheckEmailOverrides().process( - config=config, message={}, dry_run=args.dry_run, + config=config, + message={}, + dry_run=args.dry_run, ) diff --git a/toddlers/plugins/clean_retired_packages.py b/toddlers/plugins/clean_retired_packages.py index b3de6b6..80aa1a9 100644 --- a/toddlers/plugins/clean_retired_packages.py +++ b/toddlers/plugins/clean_retired_packages.py @@ -29,7 +29,7 @@ pdc_namespace_to_dist_git = { class CleanRetiredPackages(ToddlerBase): - """ Listens to messages sent by playtime (which lives in toddlers) and check + """Listens to messages sent by playtime (which lives in toddlers) and check if the `email_overrides.toml` file stored in ansible is up to date. """ @@ -162,8 +162,7 @@ Have a wonderful day and see you (maybe?) at the next run! ) def orphan_package(self, namespace, name, current_poc): - """ Give the specified project on dist_git to the ``orphan`` user. - """ + """Give the specified project on dist_git to the ``orphan`` user.""" # Orphan the package url = f"{self.dist_git_url}/_dg/orphan/{namespace}/{name}" diff --git a/toddlers/plugins/debug.py b/toddlers/plugins/debug.py index fdf3956..841c35f 100644 --- a/toddlers/plugins/debug.py +++ b/toddlers/plugins/debug.py @@ -16,7 +16,7 @@ _log = logging.getLogger(__name__) class DebugToddler(ToddlerBase): - """ Listens to messages sent by fedora CI and flags pull-requests on + """Listens to messages sent by fedora CI and flags pull-requests on src.fedoraproject.org accordingly. """ diff --git a/toddlers/plugins/flag_ci_pr.py b/toddlers/plugins/flag_ci_pr.py index 6b57d29..e2f37d5 100644 --- a/toddlers/plugins/flag_ci_pr.py +++ b/toddlers/plugins/flag_ci_pr.py @@ -25,7 +25,7 @@ done_states = { class FlagCIPR(ToddlerBase): - """ Listens to messages sent by fedora CI and flags pull-requests on + """Listens to messages sent by fedora CI and flags pull-requests on src.fedoraproject.org accordingly. """ diff --git a/toddlers/plugins/flag_commit_build.py b/toddlers/plugins/flag_commit_build.py index 81e6b2e..4301171 100644 --- a/toddlers/plugins/flag_commit_build.py +++ b/toddlers/plugins/flag_commit_build.py @@ -35,7 +35,7 @@ def _koji_link(config, msg): class FlagCommitBuild(ToddlerBase): - """ Listens to messages sent by fedora CI and flags pull-requests on + """Listens to messages sent by fedora CI and flags pull-requests on src.fedoraproject.org accordingly. """ diff --git a/toddlers/plugins/packager_bugzilla_sync.py b/toddlers/plugins/packager_bugzilla_sync.py index cc4ecd0..f89560d 100644 --- a/toddlers/plugins/packager_bugzilla_sync.py +++ b/toddlers/plugins/packager_bugzilla_sync.py @@ -28,7 +28,7 @@ _log = logging.getLogger(__name__) class PackagerBugzillaSync(ToddlerBase): - """ Listens to messages sent by playtime (which lives in toddlers) to sync + """Listens to messages sent by playtime (which lives in toddlers) to sync all the packagers found in FAS to bugzilla. """ @@ -134,7 +134,8 @@ def get_arguments(args): description="Sync packagers access from FAS to bugzilla" ) parser.add_argument( - "conf", help="Configuration file", + "conf", + help="Configuration file", ) parser.add_argument( "--dry-run", diff --git a/toddlers/plugins/pdc_import_compose.py b/toddlers/plugins/pdc_import_compose.py index 1b8ba02..809237c 100644 --- a/toddlers/plugins/pdc_import_compose.py +++ b/toddlers/plugins/pdc_import_compose.py @@ -29,7 +29,7 @@ _FINAL = [ class PDCImportCompose(ToddlerBase): - """ Listens to messages sent by playtime (which lives in toddlers) or pungi + """Listens to messages sent by playtime (which lives in toddlers) or pungi and import compose(s) into PDC. """ @@ -61,7 +61,7 @@ class PDCImportCompose(ToddlerBase): self._process_all_composes(config, pdc) def _process_all_composes(self, config, pdc): - """ Updates PDC composes from the data gathered in koji. + """Updates PDC composes from the data gathered in koji. This steps over all the composes found in koji and insert them into PDC. """ diff --git a/toddlers/plugins/pdc_retired_packages.py b/toddlers/plugins/pdc_retired_packages.py index 35c349a..8a79d8c 100644 --- a/toddlers/plugins/pdc_retired_packages.py +++ b/toddlers/plugins/pdc_retired_packages.py @@ -19,7 +19,7 @@ _log = logging.getLogger(__name__) class PDCRetiredPackages(ToddlerBase): - """ Listens to messages sent by playtime (which lives in toddlers) to sync + """Listens to messages sent by playtime (which lives in toddlers) to sync all the packagers found in FAS to bugzilla. """ @@ -51,7 +51,7 @@ class PDCRetiredPackages(ToddlerBase): self._process_dist_git(config, pdc) def _process_dist_git(self, config, pdc): - """ Updates PDC retirement status from analyzing dist-git. + """Updates PDC retirement status from analyzing dist-git. This steps over all the branches in dist-git and retires any branches in PDC that have a dead.package file in dist-git. @@ -149,8 +149,8 @@ class PDCRetiredPackages(ToddlerBase): self._retire_branch(pdc, branch) def _namespace_to_pdc(self, namespace): - """ Internal method to translate a dist-git namespace to a PDC - component type. """ + """Internal method to translate a dist-git namespace to a PDC + component type.""" namespace_to_pdc = { "rpms": "rpm", "modules": "module", @@ -162,8 +162,8 @@ class PDCRetiredPackages(ToddlerBase): return namespace_to_pdc[namespace] def _pdc_to_namespace(self, pdc_type): - """ Internal method to translate a PDC component type to a dist-git - namespace. """ + """Internal method to translate a PDC component type to a dist-git + namespace.""" pdc_to_namespace = { "rpm": "rpms", "module": "modules", diff --git a/toddlers/utils/bugzilla_system.py b/toddlers/utils/bugzilla_system.py index 04a8c28..759f31a 100644 --- a/toddlers/utils/bugzilla_system.py +++ b/toddlers/utils/bugzilla_system.py @@ -11,8 +11,7 @@ _BUGZILLA = None def set_bz(conf: Mapping[str, str]) -> Bugzilla: - """ Set the connection bugzilla. - """ + """Set the connection bugzilla.""" global _BUGZILLA # Get a connection to bugzilla @@ -48,7 +47,7 @@ def get_bz() -> Bugzilla: def get_group_member(group_name: str) -> list: - """ Return a list containing the name the members of the given group. + """Return a list containing the name the members of the given group. :arg group_name: The group name used in bugzilla. :raises XMLRPC Fault: Code 51 if the name does not exist diff --git a/toddlers/utils/fedora_account.py b/toddlers/utils/fedora_account.py index c422e0e..7105838 100644 --- a/toddlers/utils/fedora_account.py +++ b/toddlers/utils/fedora_account.py @@ -9,8 +9,7 @@ _FAS = None def set_fas(conf: Mapping[str, str]) -> AccountSystem: - """ Set the connection to the Fedora Account System. - """ + """Set the connection to the Fedora Account System.""" global _FAS # Get a connection to FAS @@ -34,8 +33,7 @@ def set_fas(conf: Mapping[str, str]) -> AccountSystem: def get_fas() -> AccountSystem: - """ Retrieve a connection to the Fedora Account System. - """ + """Retrieve a connection to the Fedora Account System.""" global _FAS if _FAS is None: raise ValueError("No FAS connection set, call set_fas first") @@ -44,8 +42,7 @@ def get_fas() -> AccountSystem: def __get_fas_grp_member(group: str = "packager") -> Mapping[str, Mapping[str, Any]]: - """ Retrieve from FAS the list of users in the packager group. - """ + """Retrieve from FAS the list of users in the packager group.""" fas = get_fas() return fas.group_members(group) @@ -61,8 +58,7 @@ def get_group_member(group_name: str) -> set: def get_bz_email_user(username, email_overrides): - """ Retrieve the bugzilla email associated to the provided username. - """ + """Retrieve the bugzilla email associated to the provided username.""" fas = get_fas() user_info = fas.person_by_username(username) @@ -76,8 +72,7 @@ def get_bz_email_user(username, email_overrides): def get_bz_email_group(groupname, email_overrides): - """ Retrieve the bugzilla email associated to the provided group name. - """ + """Retrieve the bugzilla email associated to the provided group name.""" fas = get_fas() group = fas.group_by_name(groupname) @@ -91,8 +86,7 @@ def get_bz_email_group(groupname, email_overrides): def get_user_by_email(email: str) -> dict: - """ Returns the user found in FAS for that email address. - """ + """Returns the user found in FAS for that email address.""" fas = get_fas() user = fas.people_query(constraints={"email": email}) diff --git a/toddlers/utils/notify.py b/toddlers/utils/notify.py index ecda399..57961b7 100644 --- a/toddlers/utils/notify.py +++ b/toddlers/utils/notify.py @@ -86,7 +86,7 @@ that are valid in bugzilla: def send_email(to_addresses, from_address, subject, content, mail_server): - """ Actually sends the email to the list of addresses specified from the + """Actually sends the email to the list of addresses specified from the address given with the subject and content and via the given email server. """