Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pydantic_xml/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pydantic as pd
import pydantic_core as pdc
from pydantic import BaseModel, RootModel
from pydantic._internal._model_construction import ModelMetaclass # noqa

from . import config, errors, utils
from .element import SearchMode
Expand Down Expand Up @@ -199,7 +200,7 @@ def wrapped(
return XmlEntityInfo(EntityLocation.WRAPPED, path=path, ns=ns, nsmap=nsmap, wrapped=entity, **kwargs)


class XmlModelMeta(type(BaseModel)): # type: ignore[misc]
class XmlModelMeta(ModelMetaclass):
"""
Xml model metaclass.
"""
Expand All @@ -213,7 +214,7 @@ def __new__(
) -> Type['BaseXmlModel']:
is_abstract: bool = kwargs.pop('__xml_abstract__', False)

cls = super().__new__(mcls, name, bases, namespace, **kwargs)
cls = typing.cast(Type['BaseXmlModel'], super().__new__(mcls, name, bases, namespace, **kwargs))
if not is_abstract:
cls.__build_serializer__()

Expand Down Expand Up @@ -364,7 +365,7 @@ def to_xml(self, *, skip_empty: bool = False, **kwargs: Any) -> Union[str, bytes
RootModelRootType = TypeVar('RootModelRootType')


class RootXmlModel( # type: ignore[misc]
class RootXmlModel(
RootModel[RootModelRootType],
BaseXmlModel,
Generic[RootModelRootType],
Expand Down