Skip to content

Commit

Permalink
fix: mypy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tefra committed Mar 18, 2024
1 parent 6030317 commit 7490c77
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions xsdata/codegen/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys
from dataclasses import asdict, dataclass, field, fields, replace
from enum import IntEnum
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, TypeVar

from xsdata.codegen.exceptions import CodegenError
from xsdata.formats.converter import converter
Expand All @@ -28,12 +28,14 @@
Tag.MESSAGE,
)

T = TypeVar("T", bound="CodegenModel")


@dataclass
class CodegenModel:
"""Base codegen model."""

def clone(self, **kwargs: Any) -> "CodegenModel":
def clone(self: T, **kwargs: Any) -> T:
"""Return a deep cloned instance."""
clone = copy.deepcopy(self)
return replace(clone, **kwargs) if kwargs else clone
Expand Down

0 comments on commit 7490c77

Please sign in to comment.