Skip to content

Commit 4d2e614

Browse files
authored
Merge pull request #757 from thaiphv/master
Conditionally import `ParamSpec` from `typing_extensions`
2 parents c669742 + bf63dc0 commit 4d2e614

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

office365/runtime/client_object.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
from __future__ import annotations
22

33
import datetime
4+
import sys
45
from typing import (
56
TYPE_CHECKING,
67
Any,
78
Callable,
89
Generic,
910
List,
1011
Optional,
11-
ParamSpec,
1212
TypeVar,
1313
)
14+
if sys.version_info < (3, 10):
15+
from typing_extensions import ParamSpec
16+
else:
17+
from typing import ParamSpec
1418

1519
from typing_extensions import Self
1620

office365/runtime/types/event_handler.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import types
22
from typing import Callable, Iterator, TypeVar
3+
import sys
4+
from typing_extensions import Self
5+
if sys.version_info < (3, 10):
6+
from typing_extensions import ParamSpec
7+
else:
8+
from typing import ParamSpec
39

4-
from typing_extensions import ParamSpec, Self
510

611
P = ParamSpec("P")
712
F = TypeVar("F", bound=Callable[..., None])

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
long_description=long_description,
2020
long_description_content_type="text/markdown",
2121
url="https://github.com/vgrem/Office365-REST-Python-Client",
22-
install_requires=["requests", "msal", "pytz"],
22+
install_requires=["requests", "msal", "pytz", "typing_extensions;python_version<'3.11'"],
2323
extras_require={"NtlmProvider": ["requests_ntlm"]},
2424
tests_require=["pytest", "adal"],
2525
test_suite="tests",

0 commit comments

Comments
 (0)