Skip to content

Commit

Permalink
Use typing.Optional for Typer annotations
Browse files Browse the repository at this point in the history
Typer does not support newer union syntax
fastapi/typer#522
  • Loading branch information
JimMadge committed Jul 25, 2023
1 parent f6ff62e commit 40ae88b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions data_safe_haven/commands/typer_deploy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Command-line application for deploying a Data Safe Haven component, delegating the details to a subcommand"""
from typing import Annotated
from typing import Annotated, Optional

import typer

Expand All @@ -21,7 +21,7 @@
@deploy_command_group.command()
def shm(
aad_tenant_id: Annotated[
str | None,
Optional[str], # noqa: UP007
typer.Option(
"--aad-tenant-id",
"-a",
Expand All @@ -33,7 +33,7 @@ def shm(
),
] = None,
admin_email_address: Annotated[
str | None,
Optional[str], # noqa: UP007
typer.Option(
"--email",
"-e",
Expand All @@ -42,7 +42,7 @@ def shm(
),
] = None,
admin_ip_addresses: Annotated[
list[str] | None,
Optional[list[str]], # noqa: UP007
typer.Option(
"--ip-address",
"-i",
Expand All @@ -54,15 +54,15 @@ def shm(
),
] = None,
fqdn: Annotated[
str | None,
Optional[str], # noqa: UP007
typer.Option(
"--fqdn",
"-f",
help="The domain that SHM users will belong to.",
),
] = None,
timezone: Annotated[
str | None,
Optional[str], # noqa: UP007
typer.Option(
"--timezone",
"-t",
Expand All @@ -85,23 +85,23 @@ def shm(
def sre(
name: Annotated[str, typer.Argument(help="Name of SRE to deploy")],
allow_copy: Annotated[
bool | None,
Optional[bool], # noqa: UP007
typer.Option(
"--allow-copy",
"-c",
help="Whether to allow text to be copied out of the SRE.",
),
] = None,
allow_paste: Annotated[
bool | None,
Optional[bool], # noqa: UP007
typer.Option(
"--allow-paste",
"-p",
help="Whether to allow text to be pasted into the SRE.",
),
] = None,
data_provider_ip_addresses: Annotated[
list[str] | None,
Optional[list[str]], # noqa: UP007
typer.Option(
"--data-provider-ip-address",
"-d",
Expand All @@ -110,7 +110,7 @@ def sre(
),
] = None,
research_desktops: Annotated[
list[str] | None,
Optional[list[str]], # noqa: UP007
typer.Option(
"--research-desktop",
"-r",
Expand All @@ -122,15 +122,15 @@ def sre(
),
] = None,
software_packages: Annotated[
SoftwarePackageCategory | None,
Optional[SoftwarePackageCategory], # noqa: UP007
typer.Option(
"--software-packages",
"-s",
help="The category of package to allow users to install from enabled software repositories.",
),
] = None,
user_ip_addresses: Annotated[
list[str] | None,
Optional[list[str]], # noqa: UP007
typer.Option(
"--user-ip-address",
"-u",
Expand Down

0 comments on commit 40ae88b

Please sign in to comment.