Skip to content

Commit

Permalink
chore: update code to Python 3.10 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
candleindark committed Nov 23, 2024
1 parent a66c078 commit b55af63
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/dandisets_linkml_status_tools/cli/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections.abc import Sequence
from datetime import datetime
from typing import Annotated, Any, NamedTuple, Union
from typing import Annotated, Any, NamedTuple

from dandi.dandiapi import VersionStatus
from jsonschema.exceptions import ValidationError
Expand All @@ -17,8 +17,8 @@ class JsonValidationErrorView(BaseModel):
"""

message: str
absolute_path: Sequence[Union[str, int]]
absolute_schema_path: Sequence[Union[str, int]]
absolute_path: Sequence[str | int]
absolute_schema_path: Sequence[str | int]
validator: str
validator_value: Any

Expand Down
8 changes: 4 additions & 4 deletions src/dandisets_linkml_status_tools/cli/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from itertools import chain
from pathlib import Path
from shutil import rmtree
from typing import Any, NamedTuple, Optional
from typing import Any, NamedTuple

from dandi.dandiapi import RemoteDandiset
from dandischema.models import Dandiset, PublishedDandiset
Expand Down Expand Up @@ -73,9 +73,9 @@ class DandiModelLinkmlValidator:
"""

# The LinkML schema produced by the pydantic2linkml translator for DANDI models
_dandi_linkml_schema: Optional[SchemaDefinition] = None
_dandi_linkml_schema: SchemaDefinition | None = None

def __init__(self, validation_plugins: Optional[list[ValidationPlugin]] = None):
def __init__(self, validation_plugins: list[ValidationPlugin] | None = None):
"""
Initialize a `DandiModelLinkmlValidator` instance that wraps a LinkML validator
instance set up with schema produced by the pydantic2linkml translator,
Expand Down Expand Up @@ -448,7 +448,7 @@ def sorting_key(
return c[0].validator, -c[1]

return sorted(
chain.from_iterable(zip(t, c) for t, c in counter.values()), key=sorting_key
chain.from_iterable(zip(t, c, strict=False) for t, c in counter.values()), key=sorting_key
)

# A dictionary that keeps the counts of individual types of JSON schema validation
Expand Down

0 comments on commit b55af63

Please sign in to comment.