Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: python-trio/unasync
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7e303b53ac2919dc08b058a0e9b876d8e1a6b571
Choose a base ref
..
head repository: python-trio/unasync
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 36991657efb04aa6c39dbaa89f1d87330c3f24b4
Choose a head ref
Showing with 32 additions and 33 deletions.
  1. +3 −0 .coveragerc
  2. +2 −2 src/unasync/__init__.py
  3. +0 −15 tests/data/async/typing.py
  4. +13 −0 tests/data/async/typing_py3.py
  5. +0 −15 tests/data/sync/typing.py
  6. +13 −0 tests/data/sync/typing_py3.py
  7. +1 −1 tests/test_unasync.py
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -2,6 +2,9 @@
branch=True
source=unasync

[paths]
source = src/unasync

[report]
precision = 1
exclude_lines =
4 changes: 2 additions & 2 deletions src/unasync/__init__.py
Original file line number Diff line number Diff line change
@@ -182,9 +182,9 @@ def _unasync_tokens(self, tokens):
quote = "'''" # Broken syntax highlighters wokraround: '''
elif tokval.startswith('"') and tokval.endswith('"'):
quote = '"'
elif tokval.startswith("'") and tokval.endswith(
elif tokval.startswith( # pragma: no branch
"'"
): # pragma: no branch
) and tokval.endswith("'"):
quote = "'"
assert (
len(quote) > 0
15 changes: 0 additions & 15 deletions tests/data/async/typing.py
Original file line number Diff line number Diff line change
@@ -18,21 +18,6 @@ async def func2(a): # type: (typing.AsyncIterable[int]) -> str
return str(b)


# fmt: off
# A forward-reference typed function that returns an iterator for an (a)sync iterable
async def aiter1(a: "typing.AsyncIterable[int]") -> 'typing.AsyncIterable[int]':
return a.__aiter__()

# Same as the above but using tripple-quoted strings
async def aiter2(a: """typing.AsyncIterable[int]""") -> r'''typing.AsyncIterable[int]''':
return a.__aiter__()

# Same as the above but without forward-references
async def aiter3(a: typing.AsyncIterable[int]) -> typing.AsyncIterable[int]:
return a.__aiter__()
# fmt: on


# And some funky edge cases to at least cover the relevant at all in this test
a: int = 5
b: str = a # type: ignore # This is the actual comment and the type declaration silences the warning that would otherwise happen
13 changes: 13 additions & 0 deletions tests/data/async/typing_py3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# fmt: off
# A forward-reference typed function that returns an iterator for an (a)sync iterable
async def aiter1(a: "typing.AsyncIterable[int]") -> 'typing.AsyncIterable[int]':
return a.__aiter__()

# Same as the above but using tripple-quoted strings
async def aiter2(a: """typing.AsyncIterable[int]""") -> r'''typing.AsyncIterable[int]''':
return a.__aiter__()

# Same as the above but without forward-references
async def aiter3(a: typing.AsyncIterable[int]) -> typing.AsyncIterable[int]:
return a.__aiter__()
# fmt: on
15 changes: 0 additions & 15 deletions tests/data/sync/typing.py
Original file line number Diff line number Diff line change
@@ -18,21 +18,6 @@ def func2(a): # type: (typing.Iterable[int]) -> str
return str(b)


# fmt: off
# A forward-reference typed function that returns an iterator for an (a)sync iterable
def aiter1(a: "typing.Iterable[int]") -> 'typing.Iterable[int]':
return a.__iter__()

# Same as the above but using tripple-quoted strings
def aiter2(a: """typing.Iterable[int]""") -> r'''typing.Iterable[int]''':
return a.__iter__()

# Same as the above but without forward-references
def aiter3(a: typing.Iterable[int]) -> typing.Iterable[int]:
return a.__iter__()
# fmt: on


# And some funky edge cases to at least cover the relevant at all in this test
a: int = 5
b: str = a # type: ignore # This is the actual comment and the type declaration silences the warning that would otherwise happen
13 changes: 13 additions & 0 deletions tests/data/sync/typing_py3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# fmt: off
# A forward-reference typed function that returns an iterator for an (a)sync iterable
def aiter1(a: "typing.Iterable[int]") -> 'typing.Iterable[int]':
return a.__iter__()

# Same as the above but using tripple-quoted strings
def aiter2(a: """typing.Iterable[int]""") -> r'''typing.Iterable[int]''':
return a.__iter__()

# Same as the above but without forward-references
def aiter3(a: typing.Iterable[int]) -> typing.Iterable[int]:
return a.__iter__()
# fmt: on
2 changes: 1 addition & 1 deletion tests/test_unasync.py
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
TEST_FILES = sorted([f for f in os.listdir(ASYNC_DIR) if f.endswith(".py")])

if sys.version_info[0] == 2:
TEST_FILES.remove("typing.py")
TEST_FILES.remove("typing_py3.py")


def list_files(startpath):