Skip to content

Commit

Permalink
_type_as_str
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaAmega committed Aug 8, 2024
1 parent 3ec352b commit bb07ee9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/evidently/pydantic_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def __get_classpath__(cls):

def __init_subclass__(cls):
super().__init_subclass__()
if cls == PolymorphicModel:
if cls == PolymorphicModel or vars(cls).get("_type_as_str"):
return
typename = cls.__get_type__()
type_field = cls.__fields__["type"]
Expand Down
3 changes: 3 additions & 0 deletions src/evidently/ui/dashboards/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from functools import wraps
from typing import TYPE_CHECKING
from typing import Any
from typing import ClassVar
from typing import Dict
from typing import List
from typing import Optional
Expand Down Expand Up @@ -130,6 +131,8 @@ def inner(self: "DashboardPanel", *args, **kwargs) -> BaseWidgetInfo:


class DashboardPanel(EnumValueMixin, PolymorphicModel):
_type_as_str: ClassVar[bool] = True

id: PanelID = Field(default_factory=uuid.uuid4)
title: str
filter: ReportFilter
Expand Down

0 comments on commit bb07ee9

Please sign in to comment.