Skip to content

Commit

Permalink
refactor: python 3.10 style for files I am touching
Browse files Browse the repository at this point in the history
  • Loading branch information
joanise committed Feb 2, 2024
1 parent 8ec6b4f commit 801f7cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions everyvoice/cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import json
from enum import Enum
from pathlib import Path
from typing import Dict

import typer
from pydantic import BaseModel
Expand Down Expand Up @@ -238,7 +237,7 @@ def test(suite: TestSuites = typer.Argument(TestSuites.dev)):


# Deferred full initialization to optimize the CLI, but still exposed for unit testing.
SCHEMAS_TO_OUTPUT: Dict[str, type[BaseModel]] = {}
SCHEMAS_TO_OUTPUT: dict[str, type[BaseModel]] = {}


@app.command(hidden=True)
Expand Down
6 changes: 3 additions & 3 deletions everyvoice/tests/test_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from enum import Enum
from pathlib import Path
from types import MethodType
from typing import Callable, Iterable, NamedTuple, Optional, Sequence, Union
from typing import Callable, Iterable, NamedTuple, Optional, Sequence
from unittest import TestCase, main

import yaml
Expand All @@ -31,7 +31,7 @@ class RecursiveAnswers(NamedTuple):
"""Recursive answer for StepAndAnswer.children_answers, see StepAndAnswer
documentation for a description of the fields here."""

answer_or_monkey: Union[Say, Callable]
answer_or_monkey: Say | Callable
children_answers: Optional[list["RecursiveAnswers"]] = None


Expand All @@ -49,7 +49,7 @@ class StepAndAnswer(NamedTuple):
"""

step: Step
answer_or_monkey: Union[Say, Callable]
answer_or_monkey: Say | Callable
children_answers: Optional[list[RecursiveAnswers]] = None

@property
Expand Down
6 changes: 3 additions & 3 deletions everyvoice/wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from enum import Enum
from typing import List, Optional, Union
from typing import Optional

from anytree import NodeMixin, RenderTree

Expand Down Expand Up @@ -54,7 +54,7 @@ class Step(_Step, NodeMixin):

def __init__(
self,
name: Union[None, Enum, str] = None,
name: None | Enum | str = None,
default=None,
prompt_method=None,
validate_method=None,
Expand Down Expand Up @@ -109,7 +109,7 @@ def run(self):


class Tour:
def __init__(self, name: str, steps: List[Step], state: Optional[dict] = None):
def __init__(self, name: str, steps: list[Step], state: Optional[dict] = None):
"""Create the tour by setting each Step as the child of the previous Step."""
self.name = name
self.state: dict = state if state is not None else {}
Expand Down

0 comments on commit 801f7cc

Please sign in to comment.