Skip to content

Commit 60f016e

Browse files
committed
Conditional typeguard import based on versions
1 parent ed7ccd3 commit 60f016e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: cwl_utils/inputs_schema_gen.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@
1111
from copy import deepcopy
1212
from pathlib import Path
1313
from typing import Any, List, Union, Dict, Optional
14-
from typing_extensions import TypeGuard # Not in 3.8 typing module
1514
from urllib.parse import urlparse
16-
1715
import requests
1816

17+
# Get typeguard from extensions if we're running in python3.8
18+
if python_version := sys.version_info[:2] < (3, 9):
19+
from typing_extensions import TypeGuard # Not in 3.8 typing module
20+
else:
21+
from typing import TypeGuard
22+
1923
from cwl_utils.loghandler import _logger as _cwlutilslogger
2024
from cwl_utils.parser import (
2125
load_document_by_uri,

0 commit comments

Comments
 (0)