Adjust the toddler sources for the new version of black >= 20.8b0

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2020-09-02 09:31:23 +02:00
parent 40aef23237
commit a85d3006c1
14 changed files with 41 additions and 40 deletions

View file

@ -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"}

View file

@ -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()

View file

@ -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()

View file

@ -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,
)

View file

@ -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}"

View file

@ -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.
"""

View file

@ -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.
"""

View file

@ -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.
"""

View file

@ -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",

View file

@ -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.
"""

View file

@ -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",

View file

@ -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

View file

@ -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})

View file

@ -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.
"""