Skip to content

Commit

Permalink
chore(xtest): Prefer 3.10+ type annotations
Browse files Browse the repository at this point in the history
- Prefer `|` to Union, and `| None` to Optional
- Prefer `list` to `List`
  • Loading branch information
dmihalcik-virtru committed Dec 20, 2024
1 parent f6ecd3d commit eb13ca1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions xtest/assertions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pydantic import BaseModel
from typing import Literal, Union, Dict
from typing import Literal


Type = Literal["handling", "other"]
Expand All @@ -11,7 +11,7 @@
class Statement(BaseModel):
format: str
schema: str
value: Union[str, dict]
value: dict | str


class Binding(BaseModel):
Expand All @@ -35,4 +35,4 @@ class Assertion(BaseModel):


class AssertionVerificationKeys(BaseModel):
keys: Dict[str, AssertionKey]
keys: dict[str, AssertionKey]
6 changes: 3 additions & 3 deletions xtest/tdfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import jsonschema

from pydantic import BaseModel
from typing import Literal, Optional, List, Union
from typing import Literal

logger = logging.getLogger("xtest")
logging.basicConfig()
Expand Down Expand Up @@ -56,7 +56,7 @@ class KeyAccessObject(BaseModel):
url: str
protocol: str
wrappedKey: str
policyBinding: Union[str, PolicyBinding]
policyBinding: PolicyBinding | str
encryptedMetadata: str | None = None
kid: str | None = None
sid: str | None = None
Expand Down Expand Up @@ -118,7 +118,7 @@ def policy_object(self, value: Policy):
class Manifest(BaseModel):
encryptionInformation: EncryptionInformation
payload: PayloadReference
assertions: Optional[List[tdfassertions.Assertion]] = []
assertions: list[tdfassertions.Assertion] | None = None


def manifest(tdf_file: str) -> Manifest:
Expand Down

0 comments on commit eb13ca1

Please sign in to comment.