From 84b0ea6121f8be6a595ced6d5afbac7c261430aa Mon Sep 17 00:00:00 2001 From: Karim shoair Date: Mon, 14 Oct 2024 00:04:36 +0300 Subject: [PATCH] Handle importing `SupportsIndex` in Python 3.6 and 3.7 --- scrapling/parser.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scrapling/parser.py b/scrapling/parser.py index c0cc7be..375d384 100644 --- a/scrapling/parser.py +++ b/scrapling/parser.py @@ -1,6 +1,11 @@ import os from difflib import SequenceMatcher -from typing import Any, Dict, List, Tuple, Optional, Pattern, SupportsIndex, Union, Callable, Generator +from typing import Any, Dict, List, Tuple, Optional, Pattern, Union, Callable, Generator +try: + from typing import SupportsIndex +except ImportError: + # 'SupportsIndex' got added in Python 3.8 + SupportsIndex = None from scrapling.translator import HTMLTranslator from scrapling.mixins import SelectorsGeneration