Skip to content

Commit

Permalink
Adds typing_extensions as explicit dependency (#124)
Browse files Browse the repository at this point in the history
* Adds typing_extensions as explicit dependency

* unrelated black format
  • Loading branch information
freider authored Jan 26, 2024
1 parent f8aa8c9 commit a8adf32
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ readme = "README.md"

dependencies = [
"sigtools==4.0.1",
"typing_extensions>=4.6",
]
requires-python = ">=3.8"

Expand Down
12 changes: 4 additions & 8 deletions synchronicity/combined_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,10 @@ def __get__(self, instance, owner=None):


class AsyncAndBlockingContextManager(typing_extensions.Protocol[CTX]):
def __enter__(self) -> CTX:
...
def __enter__(self) -> CTX: ...

async def __aenter__(self) -> CTX:
...
async def __aenter__(self) -> CTX: ...

def __exit__(self, typ, value, tb):
...
def __exit__(self, typ, value, tb): ...

async def __aexit__(self, typ, value, tb):
...
async def __aexit__(self, typ, value, tb): ...
1 change: 1 addition & 0 deletions synchronicity/overload_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def foo(a: typing.Union[bool, int]) -> typing.Union[bool, float]:
# in the order they are declared
foo_overloads = get_overloads(foo)
"""

import contextlib
import typing
from unittest import mock
Expand Down
1 change: 1 addition & 0 deletions synchronicity/type_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
implementation types directly (but translated to blocking).
* Let synchronicity emit actual function bodies, to avoid runtime wrapping altogether
"""

import collections
import collections.abc
import contextlib
Expand Down
3 changes: 1 addition & 2 deletions test/type_stub_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,7 @@ def foo() -> typing.Callable[..., typing.Any]:


def test_typing_literal():
def foo() -> typing.Literal["three", "str"]:
...
def foo() -> typing.Literal["three", "str"]: ...

src = _function_source(foo)
assert "-> typing.Literal['three', 'str']" in src # "str" should not be eval:ed in a Literal!
Expand Down

0 comments on commit a8adf32

Please sign in to comment.