Skip to content

Commit

Permalink
Further type hinting.
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Dec 13, 2023
1 parent da09a77 commit 48a6262
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions repo_helper_bot/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
# OR OTHER DEALINGS IN THE SOFTWARE.
#

# stdlib
from typing import Tuple

# 3rd party
from github3_utils.apps import iter_installed_repos

Expand All @@ -38,16 +41,16 @@


@app.route('/')
def home():
def home() -> str:
"""
Route for the homepage.
"""

return "This is repo-helper-bot, running on Heroku.\n"
return "This is repo-helper-bot, running on dokku.\n"


@app.route("/request/<username>/<repository>/")
def request_run(username: str, repository: str):
def request_run(username: str, repository: str) -> Tuple[str, int]:
"""
Route for the homepage.
"""
Expand All @@ -66,4 +69,4 @@ def request_run(username: str, repository: str):
if result:
return f"An error occurred when running for {full_name}.\n", 500
else:
return f"Run successful for {full_name}.\n"
return f"Run successful for {full_name}.\n", 200
4 changes: 2 additions & 2 deletions repo_helper_bot/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from typing import Dict, Iterator, Optional, Tuple, Union

# 3rd party
import click # type: ignore[import]
import click # type: ignore[import-untyped]
import dulwich.porcelain
import dulwich.repo
import sqlalchemy.exc
Expand Down Expand Up @@ -202,7 +202,7 @@ def run_update() -> Iterator[Tuple[str, int]]:
def close_pr(
owner: str,
repository: str,
message="Looks like everything is already up to date.",
message: str = "Looks like everything is already up to date.",
) -> None:
"""
Close the bot's current pull requests, and delete the branch.
Expand Down
2 changes: 1 addition & 1 deletion repo_helper_bot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
)


def log(message: str, type: str = "INFO"): # noqa: A002 # pylint: disable=redefined-builtin
def log(message: str, type: str = "INFO") -> None: # noqa: A002 # pylint: disable=redefined-builtin
"""
Log a message to the terminal.
Expand Down

0 comments on commit 48a6262

Please sign in to comment.