Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
alice: please: contribute: recommended community standards: Format wi…
Browse files Browse the repository at this point in the history
…th black

Signed-off-by: John Andersen <[email protected]>
  • Loading branch information
pdxjohnny committed Jul 28, 2022
1 parent 4ee87b4 commit db80600
Showing 1 changed file with 9 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ async def create_branch_if_none_exists(
if list(filter(bool, branches)):
return
await dffml.run_command(
["git", "branch", "-M", name],
cwd=repo.directory,
logger=self.logger,
["git", "branch", "-M", name], cwd=repo.directory, logger=self.logger,
)
await dffml.run_command(
["git", "commit", "-m", "Created branch", "--allow-empty"],
Expand Down Expand Up @@ -145,9 +143,7 @@ async def github_owns_remote(
events=[dffml.Subprocess.STDOUT_READLINE],
):
if event is dffml.Subprocess.STDOUT_READLINE:
remote, url_and_usages = (
result.decode().strip().split("\t", maxsplit=2)
)
remote, url_and_usages = result.decode().strip().split("\t", maxsplit=2)
if remote != check_remote:
continue
url = url_and_usages.split()[0]
Expand Down Expand Up @@ -284,9 +280,7 @@ async def alice_contribute_readme(self, repo: AliceGitRepo) -> ReadmeGitRepo:
def create_readme_file_if_not_exists(
self,
repo: ReadmeGitRepo,
readme_contents: Optional[
"ReadmeContents"
] = "# My Awesome Project's README",
readme_contents: Optional["ReadmeContents"] = "# My Awesome Project's README",
) -> "ReadmePath":
# Do not create readme if it already exists
path = pathlib.Path(repo.directory, "README.md")
Expand Down Expand Up @@ -320,13 +314,9 @@ async def contribute_readme_md(
)
elif event is dffml.Subprocess.COMPLETED:
if result != 0:
raise RuntimeError(
"Failed to create branch for contribution"
)
raise RuntimeError("Failed to create branch for contribution")
await dffml.run_command(
["git", "add", "README.md"],
cwd=repo.directory,
logger=self.logger,
["git", "add", "README.md"], cwd=repo.directory, logger=self.logger,
)
await dffml.run_command(
["git", "commit", "-sm", commit_message],
Expand Down Expand Up @@ -385,9 +375,7 @@ async def readme_pr(
async def readme_issue(
self,
repo: ReadmeGitRepo,
title: Optional[
"ReadmeIssueTitle"
] = "Recommended Community Standard: README",
title: Optional["ReadmeIssueTitle"] = "Recommended Community Standard: README",
body: Optional[
"ReadmeIssueBody"
] = "References:\n- https://docs.github.com/articles/about-readmes/",
Expand All @@ -412,9 +400,7 @@ async def readme_issue(
return result.strip().decode()

@staticmethod
def readme_commit_message(
issue_url: "ReadmeIssue",
) -> "ReadmeCommitMessage":
def readme_commit_message(issue_url: "ReadmeIssue",) -> "ReadmeCommitMessage":
return textwrap.dedent(
f"""
Recommended Community Standard: README
Expand All @@ -427,23 +413,12 @@ def readme_commit_message(
async def readme_pr_body(readme_issue: "ReadmeIssue",) -> "ReadmePRBody":
return f"Closes: {readme_issue}"

async def readme_pr_title(
self, readme_issue: "ReadmeIssue",
) -> "ReadmePRTitle":
async def readme_pr_title(self, readme_issue: "ReadmeIssue",) -> "ReadmePRTitle":
"""
Use the issue title as the pull request title
"""
async for event, result in dffml.run_command_events(
[
"gh",
"issue",
"view",
"--json",
"title",
"-q",
".title",
readme_issue,
],
["gh", "issue", "view", "--json", "title", "-q", ".title", readme_issue,],
logger=self.logger,
events=[dffml.Subprocess.STDOUT],
):
Expand Down

0 comments on commit db80600

Please sign in to comment.