From 12662c398f3ff5f8b13bc94994bb410e43fbc46d Mon Sep 17 00:00:00 2001 From: Muspi Merol Date: Sun, 26 Jan 2025 20:02:44 +0800 Subject: [PATCH] chore: simplify type hacking --- python/promplate/prompt/template.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/python/promplate/prompt/template.py b/python/promplate/prompt/template.py index 0651d56..3bd89c3 100644 --- a/python/promplate/prompt/template.py +++ b/python/promplate/prompt/template.py @@ -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 * @@ -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):