Skip to content

Commit

Permalink
Merge pull request #28 from candleindark/update-code
Browse files Browse the repository at this point in the history
Update code to Python 3.10 syntax
  • Loading branch information
candleindark authored Nov 23, 2024
2 parents 8b383f1 + b55af63 commit ba1a8bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ line-length = 88
indent-width = 4
[tool.ruff.lint]
ignore = [
# Avoid use of `from __future__ import annotations`
# because it causes problem with Typer
"FA100"
# rules to ignore by ruff
]
[tool.ruff.lint.per-file-ignores]
"**/tests/**/*" = [
Expand Down
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 ba1a8bd

Please sign in to comment.