Skip to content

Commit

Permalink
Fix Typer annotations
Browse files Browse the repository at this point in the history
Typer does not support newer union syntax
fastapi/typer#522

Co-authored-by: James Robinson <[email protected]>
  • Loading branch information
JimMadge and jemrobinson committed Jul 26, 2023
1 parent 62a5d61 commit 18c7732
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions data_safe_haven/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Command line entrypoint for Data Safe Haven application"""
import pathlib
from typing import Annotated
from typing import Annotated, Optional

import typer

Expand All @@ -17,11 +17,11 @@

def callback(
output: Annotated[
pathlib.Path | None,
Optional[pathlib.Path], # noqa: UP007
typer.Option("--output", "-o", resolve_path=True, help="Path to an output log file"),
] = None,
verbosity: Annotated[
int | None,
Optional[int], # noqa: UP007
typer.Option(
"--verbosity",
"-v",
Expand All @@ -31,7 +31,7 @@ def callback(
),
] = None,
version: Annotated[
bool | None,
Optional[bool], # noqa: UP007
typer.Option("--version", "-V", help="Display the version of this application."),
] = None,
) -> None:
Expand Down
10 changes: 5 additions & 5 deletions data_safe_haven/commands/typer_init.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Command-line application for initialising a Data Safe Haven deployment"""
from typing import Annotated
from typing import Annotated, Optional

import typer

Expand All @@ -10,7 +10,7 @@

def initialise_command(
admin_group: Annotated[
str | None,
Optional[str], # noqa: UP007
typer.Option(
"--admin-group",
"-a",
Expand All @@ -19,23 +19,23 @@ def initialise_command(
),
] = None,
location: Annotated[
str | None,
Optional[str], # noqa: UP007
typer.Option(
"--location",
"-l",
help="The Azure location to deploy resources into.",
),
] = None,
name: Annotated[
str | None,
Optional[str], # noqa: UP007
typer.Option(
"--name",
"-n",
help="The name to give this Data Safe Haven deployment.",
),
] = None,
subscription: Annotated[
str | None,
Optional[str], # noqa: UP007
typer.Option(
"--subscription",
"-s",
Expand Down

0 comments on commit 18c7732

Please sign in to comment.