Skip to content

Commit

Permalink
Add python 3.10 definition of Self
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Jul 18, 2023
1 parent 37afb3f commit 2e129be
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion python/lsst/daf/butler/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,21 @@

__all__ = ["PYDANTIC_V2", "_BaseModelCompat"]

import sys
from collections.abc import Callable, Mapping
from typing import Any, Self
from typing import Any

from pydantic import BaseModel
from pydantic.version import VERSION as PYDANTIC_VERSION

if sys.version_info >= (3, 11, 0):
from typing import Self
else:
from typing import TypeVar

Self = TypeVar("Self", bound="_BaseModelCompat")


PYDANTIC_V2 = PYDANTIC_VERSION.startswith("2.")


Expand Down

0 comments on commit 2e129be

Please sign in to comment.