Skip to content

Commit

Permalink
chore: simplify type hacking
Browse files Browse the repository at this point in the history
  • Loading branch information
CNSeniorious000 committed Jan 26, 2025
1 parent b381247 commit 12662c3
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions python/promplate/prompt/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sys import path as sys_path
from sys import version_info
from textwrap import dedent
from typing import TYPE_CHECKING, Any, Literal, Protocol
from typing import Any, Literal, Protocol

from .builder import *
from .utils import *
Expand Down Expand Up @@ -209,16 +209,8 @@ async def afetch(cls, url: str, **kwargs):
return obj


class SafeChainMapContext(ChainMap, dict):
if TYPE_CHECKING: # fix type from `collections.ChainMap`
from sys import version_info

if version_info >= (3, 11):
from typing_extensions import Self
else:
from typing import Self

copy: Callable[[Self], Self]
class SafeChainMapContext(ChainMap, dict): # type: ignore
pass


class Template(TemplateCore, Loader):
Expand Down

0 comments on commit 12662c3

Please sign in to comment.