From 1ca2b6cfe43516be2fe6e36602125a5e52a37f34 Mon Sep 17 00:00:00 2001 From: Karim shoair Date: Thu, 31 Oct 2024 01:31:10 +0300 Subject: [PATCH] Combing type definitions in one file --- scrapling/_types.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 scrapling/_types.py diff --git a/scrapling/_types.py b/scrapling/_types.py new file mode 100644 index 0000000..ca6769c --- /dev/null +++ b/scrapling/_types.py @@ -0,0 +1,25 @@ +""" +Type definitions for type checking purposes. +""" + +from typing import ( + Dict, Optional, Union, Callable, Any, List, Tuple, Pattern, Generator, Iterable, Type, TYPE_CHECKING +) + +try: + from scrapling._types import Protocol +except ImportError: + # Added in Python 3.8 + Protocol = object + +try: + from scrapling._types import SupportsIndex +except ImportError: + # 'SupportsIndex' got added in Python 3.8 + SupportsIndex = None + +if TYPE_CHECKING: + # typing.Self requires Python 3.11 + from typing_extensions import Self +else: + Self = object