Skip to content

Commit 57a4394

Browse files
authored
Update depth_limit.py
1 parent ea4e6d6 commit 57a4394

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

graphene/validation/depth_limit.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@
2525
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2626
# SOFTWARE.
2727

28-
import re
28+
try:
29+
from re import Pattern
30+
except ImportError:
31+
# backwards compatibility for v3.6
32+
from typing import Pattern
33+
2934
from typing import Callable, Dict, List, Optional, Union
3035

3136
from graphql import GraphQLError
@@ -43,7 +48,7 @@
4348
from ..utils.is_introspection_key import is_introspection_key
4449

4550

46-
IgnoreType = Union[Callable[[str], bool], re.Pattern, str]
51+
IgnoreType = Union[Callable[[str], bool], Pattern, str]
4752

4853

4954
def depth_limit_validator(

0 commit comments

Comments
 (0)