Skip to content

Commit

Permalink
Apply black 2025 formatting (#1390)
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt authored Jan 29, 2025
1 parent 57ab5ad commit b5b8274
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/bioregistry/gh/github_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,4 @@ def _git(*args: str) -> Optional[str]:
logger.warning(f"error in _git:\n{e}")
return None
else:
return ret.strip().decode("utf-8")
return ret.strip().decode("utf-8")
13 changes: 11 additions & 2 deletions src/bioregistry/gh/new_prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def get_new_prefix_issues(token: Optional[str] = None) -> Dict[int, Resource]:
rv[issue_id] = resource
return rv


def process_specific_issue(issue: int) -> Dict[int, Resource]:
"""Process a specific issue and return a dictionary mapping the issue number to the resource."""
click.echo(f"Processing specific issue {issue}")
Expand All @@ -181,6 +182,7 @@ def process_specific_issue(issue: int) -> Dict[int, Resource]:
sys.exit(1)
return {issue: resource}


def process_all_relevant_issues() -> Dict[int, Resource]:
"""Process all relevant issues and return a dictionary mapping issue numbers to resources."""
click.echo("No specific issue provided. Searching for all relevant issues")
Expand Down Expand Up @@ -221,6 +223,7 @@ def process_all_relevant_issues() -> Dict[int, Resource]:

return issue_to_resource


def _yield_publications(data) -> Iterable[Publication]:
for curie in data.pop("publications", "").split("|"):
curie = curie.strip().lower()
Expand Down Expand Up @@ -266,12 +269,18 @@ def make_title(prefixes: Sequence[str]) -> str:
@click.command()
@click.option("--dry", is_flag=True, help="Dry run - do not create any PRs")
@click.option("--github", is_flag=True, help="Use this flag in a GHA setting to set run variables")
@click.option("--issue", type=int, help="Specific issue to process rather than finding all relevant ones")
@click.option(
"--issue", type=int, help="Specific issue to process rather than finding all relevant ones"
)
@force_option
@verbose_option
def main(dry: bool, github: bool, force: bool, issue: Optional[int] = None):
"""Run the automatic curator."""
click.echo(f"Running workflow with issue: {issue}" if issue else "Running workflow for all relevant issues")
click.echo(
f"Running workflow with issue: {issue}"
if issue
else "Running workflow for all relevant issues"
)

status_porcelain_result = github_client.status_porcelain()
if status_porcelain_result and not force and not dry:
Expand Down
8 changes: 5 additions & 3 deletions tests/test_new_prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import copy
import json
import unittest
from unittest.mock import patch
from pathlib import Path
from unittest.mock import patch

from click.testing import CliRunner

Expand Down Expand Up @@ -158,7 +158,7 @@ def test_all_relevant_issues(self, mock_add_resource, mock_github_client):
"""Test the workflow in a dry run for a all relevant issues."""
mock_github_client.get_bioregistry_form_data.return_value = {
1181: copy.deepcopy(NCBIORTHOLOG_TEST),
1278: copy.deepcopy(VIBSO_TEST)
1278: copy.deepcopy(VIBSO_TEST),
}

runner = CliRunner()
Expand All @@ -167,7 +167,9 @@ def test_all_relevant_issues(self, mock_add_resource, mock_github_client):
self.assertEqual(result.exit_code, 0)
self.assertIn("Running workflow for all relevant issues", result.output)

self.assertIn("No specific issue provided. Searching for all relevant issues", result.output)
self.assertIn(
"No specific issue provided. Searching for all relevant issues", result.output
)
self.assertIn("Adding 2 issues after filter", result.output)

self.assertIn("🚀 Adding resource ncbiortholog.test (#1181)", result.output)
Expand Down

0 comments on commit b5b8274

Please sign in to comment.