Skip to content

Commit

Permalink
merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
candleindark committed Nov 23, 2024
2 parents b52018f + ba1a8bd commit e8dafaa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
9 changes: 3 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "dandisets-linkml-status-tools"
dynamic = ["version"]
description = 'Tools for reporting the status of the translation of DANDI schemas from Pydantic definitions to LinkML definitions'
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.10"
license = "MIT" # todo: Is this the correct license?
keywords = []
authors = [
Expand All @@ -16,7 +16,6 @@ authors = [
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand Down Expand Up @@ -46,7 +45,7 @@ path = "src/dandisets_linkml_status_tools/__about__.py"
allow-direct-references = true

[tool.hatch.envs.default]
python = "3.9"
python = "3.10"

[tool.hatch.envs.test]
dependencies = [
Expand Down Expand Up @@ -94,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
10 changes: 5 additions & 5 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, Union
from typing import Any, NamedTuple

from dandi.dandiapi import RemoteDandiset
from dandischema.models import Dandiset, PublishedDandiset
Expand Down Expand Up @@ -46,7 +46,7 @@
isorted = partial(sorted, key=str.casefold)


def pydantic_validate(data: Union[dict[str, Any], str], model: type[BaseModel]) -> str:
def pydantic_validate(data: dict[str, Any] | str, model: type[BaseModel]) -> str:
"""
Validate the given data against a Pydantic model
Expand Down Expand Up @@ -78,9 +78,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 @@ -453,7 +453,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 e8dafaa

Please sign in to comment.