Skip to content

Commit

Permalink
Merge master with conflict manually resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
candleindark committed Dec 9, 2023
2 parents e095ed7 + 3675319 commit 50ee928
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
8 changes: 1 addition & 7 deletions dandischema/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from enum import Enum
import os
import re
import sys
from typing import Any, Dict, List, Optional, Sequence, Type, TypeVar, Union
from typing import Any, Dict, List, Literal, Optional, Sequence, Type, TypeVar, Union
from warnings import warn

from pydantic import (
Expand Down Expand Up @@ -47,11 +46,6 @@ def __get_pydantic_json_schema__(
return handler(core_schema.int_schema())


if sys.version_info < (3, 8):
from typing_extensions import Literal
else:
from typing import Literal

# Use DJANGO_DANDI_WEB_APP_URL to point to a specific deployment.
DANDI_INSTANCE_URL: Optional[str]
try:
Expand Down
8 changes: 1 addition & 7 deletions dandischema/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import enum
from enum import Enum
from inspect import isclass
import sys
from typing import Any, Dict, List, Optional, Type, Union
from typing import Any, Dict, List, Literal, Optional, Type, Union

import pydantic
from pydantic import Field, ValidationError
Expand Down Expand Up @@ -34,11 +33,6 @@
RoleType,
)

if sys.version_info < (3, 8):
from typing_extensions import Literal
else:
from typing import Literal


def test_dandiset() -> None:
assert Dandiset.model_construct()
Expand Down
11 changes: 6 additions & 5 deletions dandischema/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import re
from typing import Iterator, List

Expand Down Expand Up @@ -43,13 +45,12 @@ def split_camel_case(s: str) -> Iterator[str]:
yield s[last_start:]


def version2tuple(ver: str) -> tuple:
def version2tuple(ver: str) -> tuple[int, int, int]:
"""Convert version to numeric tuple"""
import re

if re.match(r"\d+\.\d+\.\d+$", ver) is None:
if m := re.fullmatch(r"(\d+)\.(\d+)\.(\d+)", ver, flags=re.ASCII):
return (int(m[1]), int(m[2]), int(m[3]))
else:
raise ValueError(r"Version must be well formed: \d+\.\d+\.\d+")
return tuple([int(val) for val in ver.split(".")])


def _ensure_newline(obj: str) -> str:
Expand Down

0 comments on commit 50ee928

Please sign in to comment.