Skip to content

Commit

Permalink
Fix warnings displayed in test runs
Browse files Browse the repository at this point in the history
  • Loading branch information
JBWilkie committed Aug 21, 2024
1 parent 5df19f2 commit 2ff3437
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion darwin/exporter/formats/nifti.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import nibabel as nib
from nibabel.orientations import io_orientation, ornt_transform
except ImportError:
import_fail_string = """
import_fail_string = r"""
You must install darwin-py with pip install darwin-py\[medical]
in order to export using nifti format
"""
Expand Down
4 changes: 2 additions & 2 deletions darwin/future/data_objects/dataset.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List, Optional

from pydantic import PositiveInt, validator
from pydantic import PositiveInt, field_validator

from darwin.future.data_objects.release import ReleaseList
from darwin.future.data_objects.validators import parse_name
Expand Down Expand Up @@ -30,7 +30,7 @@ class DatasetCore(DefaultDarwin):
releases: Optional[ReleaseList] = None

# Data Validation
_name_validator = validator("name", allow_reuse=True)(parse_name)
_name_validator = field_validator("name")(parse_name)


DatasetList = List[DatasetCore]
4 changes: 2 additions & 2 deletions darwin/future/data_objects/release.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List

from pydantic import validator
from pydantic import field_validator

from darwin.future.data_objects import validators as darwin_validators
from darwin.future.pydantic_base import DefaultDarwin
Expand All @@ -26,7 +26,7 @@ def __str__(self) -> str:
return self.name

# Data Validation
_name_validator = validator("name", allow_reuse=True)(darwin_validators.parse_name)
_name_validator = field_validator("name")(darwin_validators.parse_name)


ReleaseList = List[ReleaseCore]
4 changes: 2 additions & 2 deletions darwin/future/data_objects/sorting.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Literal, Optional

from pydantic import BaseModel, Field, root_validator
from pydantic import BaseModel, Field, model_validator


class SortingMethods(BaseModel):
Expand All @@ -12,7 +12,7 @@ class SortingMethods(BaseModel):
priority: Optional[Literal["asc", "desc"]] = Field(None)
updated_at: Optional[Literal["asc", "desc"]] = Field(None)

@root_validator(pre=True)
@model_validator(mode="before")
def check_at_least_one_field(cls, values):
assert any(value is not None for value in values.values())
return values
4 changes: 2 additions & 2 deletions darwin/future/data_objects/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import List, Optional

from pydantic import validator
from pydantic import field_validator

from darwin.future.core.client import ClientCore
from darwin.future.core.team.get_raw import get_team_raw
Expand Down Expand Up @@ -56,7 +56,7 @@ class TeamCore(DefaultDarwin):
default_role: TeamMemberRole = TeamMemberRole.USER

# Data Validation
_slug_validator = validator("slug", allow_reuse=True)(parse_name)
_slug_validator = field_validator("slug")(parse_name)

@staticmethod
def from_client(client: ClientCore, team_slug: Optional[str] = None) -> TeamCore:
Expand Down
2 changes: 1 addition & 1 deletion darwin/importer/formats/nifti.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import nibabel as nib
from scipy.ndimage import zoom
except ImportError:
import_fail_string = """
import_fail_string = r"""
You must install darwin-py with pip install darwin-py\[medical]
in order to import using nifti format
"""
Expand Down

0 comments on commit 2ff3437

Please sign in to comment.