Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 18, 2023
1 parent 76e03fc commit eeda483
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions tender/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def link(url, name):

def nested_dict_to_namespaces(dic):
"""Code for recursively converting dictionaries of dictionaries
into SimpleNamespaces instead.
into SimpleNamespaces instead.
"""

def recurse(dic):
Expand Down Expand Up @@ -90,7 +90,6 @@ def unique(sequence):
f"https://raw.githubusercontent.com/pycontribs/meta/master/{config_file}",
]
):

try:
if re.match(r"https?://", location):
stream = urllib.request.urlopen(location)
Expand All @@ -113,7 +112,6 @@ def unique(sequence):


class Tender:

# pylint: disable=too-many-instance-attributes

def __init__(self, cfg: Config):
Expand Down Expand Up @@ -199,8 +197,10 @@ def do_pulls(self):
)
pr_labels = [p.name for p in pull.get_labels()]
if len(self.required_labels.intersection(pr_labels)) == 0:
msg += "\n\tShould have at least one label out of {} but found: {}".format(
", ".join(self.required_labels), ", ".join(pr_labels)
msg += (
"\n\tShould have at least one label out of {} but found: {}".format(
", ".join(self.required_labels), ", ".join(pr_labels)
)
)
print(msg)
cnt += 1
Expand All @@ -209,7 +209,6 @@ def do_pulls(self):
pass

def do_labels(self):

_logger.info("Auditing repository labels")
_logger.debug(self.cfg.labels)
existing_labels = [x.name for x in self.repo.get_labels()]
Expand Down Expand Up @@ -265,17 +264,14 @@ def do_draft(self):
)

for pull in self.repo.get_pulls(state="closed"):

if pull.merged:

_logger.debug("Doing %s: %s", pull.number, pull.title)
# ignoring commits
labels = {x.name for x in pull.labels}
if not self.exclude_labels.isdisjoint(labels):
continue

if pull.merge_commit_sha in commits:

valid_labels = list(self.required_labels.intersection(labels))
if valid_labels:
section = self.label_section_map[valid_labels[0]]
Expand Down Expand Up @@ -419,5 +415,4 @@ def do_labels(ctx):


if __name__ == "__main__":

cli() # pylint: disable=no-value-for-parameter

0 comments on commit eeda483

Please sign in to comment.