diff --git a/jaraco/develop/add-github-secret.py b/jaraco/develop/add-github-secret.py index 32acfcf..5ca90a7 100644 --- a/jaraco/develop/add-github-secret.py +++ b/jaraco/develop/add-github-secret.py @@ -1,8 +1,10 @@ +from __future__ import annotations + import autocommand from . import github @autocommand.autocommand(__name__) -def run(name, value, project: github.Repo = github.Repo.detect()): - project.add_secret(name, value) +def run(name, value, project: github.Repo | None = None): + (project or github.Repo.detect()).add_secret(name, value) diff --git a/jaraco/develop/add-github-secrets.py b/jaraco/develop/add-github-secrets.py index c25914d..0c031d8 100644 --- a/jaraco/develop/add-github-secrets.py +++ b/jaraco/develop/add-github-secrets.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import autocommand import keyring import getpass @@ -32,8 +34,8 @@ def _safe_getuser(): @autocommand.autocommand(__name__) -def run(project: github.Repo = github.Repo.detect()): - for name in project.find_needed_secrets(): +def run(project: github.Repo | None = None): + for name in (project or github.Repo.detect()).find_needed_secrets(): source = secret_sources[name] value = keyring.get_password(**source) project.add_secret(name, value) diff --git a/jaraco/develop/create-github-release.py b/jaraco/develop/create-github-release.py index a4722c7..fd4d544 100644 --- a/jaraco/develop/create-github-release.py +++ b/jaraco/develop/create-github-release.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import autocommand from . import github @@ -5,6 +7,6 @@ @autocommand.autocommand(__name__) -def run(project: github.Repo = github.Repo.detect()): +def run(project: github.Repo | None = None): md = repo.get_project_metadata() - project.create_release(tag=f'v{md.version}') + (project or github.Repo.detect()).create_release(tag=f'v{md.version}')