forked from darrenburns/rich-pixels
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Optimising the asynchronous version of Pixels - Couple of fixes
- Loading branch information
1 parent
2223d62
commit 7494afd
Showing
6 changed files
with
40 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ __pycache__/ | |
*.py[cod] | ||
*$py.class | ||
|
||
# My Ignored Type | ||
*__hidden* | ||
|
||
# C extensions | ||
*.so | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "ripix" | ||
version = "2.2.2" | ||
version = "2.2.3" | ||
description = "A Rich-compatible library for writing pixel images and ASCII art to the terminal." | ||
authors = ["Darren Burns <[email protected]>", "Romanin <[email protected]>"] | ||
repository = "https://github.com/romanin-rf/ripix" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .pixel import Pixels, AsyncPixels | ||
|
||
__all__ = [ "Pixels" ] | ||
__all__ = [ "Pixels", "AsyncPixels" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,7 @@ | ||
import asyncio | ||
|
||
async def aiter(it): | ||
for item in it: | ||
yield item | ||
await asyncio.sleep(0) | ||
for _ in it: await asyncio.sleep(0) ; yield _ | ||
|
||
async def arange(*args, **kwargs) -> int: | ||
for i in range(*args, **kwargs): | ||
yield i | ||
await asyncio.sleep(0) | ||
|
||
async def run_in_executor(loop, executor, func, *args, **kwargs): | ||
if loop is None: loop = asyncio.get_running_loop() | ||
return await loop.run_in_executor(executor, lambda: func(*args, **kwargs)) | ||
|
||
def wrapper_run_in_executor(loop, executor, func): | ||
async def wrapped_func(*args, **kwargs): | ||
return await run_in_executor(loop, executor, func, *args, **kwargs) | ||
return wrapped_func | ||
for _ in range(*args, **kwargs): await asyncio.sleep(0) ; yield _ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
from asyncio import AbstractEventLoop | ||
from typing import TypeVar, Iterable, AsyncGenerator, overload, SupportsIndex, Callable, Optional, Any, Coroutine | ||
from typing import TypeVar, Iterable, AsyncGenerator, overload, SupportsIndex | ||
|
||
# ! Types | ||
T = TypeVar("T") | ||
|
||
|
||
# ! Functions | ||
async def aiter(it: Iterable[T]) -> AsyncGenerator[T]: ... | ||
|
||
@overload | ||
async def arange(__stop: SupportsIndex) -> AsyncGenerator[int]: ... | ||
@overload | ||
async def arange(__start: SupportsIndex, __stop: SupportsIndex, __step: SupportsIndex=...) -> AsyncGenerator[int]: ... | ||
|
||
async def run_in_executor(loop: Optional[AbstractEventLoop], executor: Optional[Any], func: Callable[..., T], *args, **kwargs) -> T: ... | ||
|
||
def wrapper_run_in_executor(loop: Optional[AbstractEventLoop], executor, func: Callable[..., T]) -> Callable[..., Coroutine[Any, Any, T]]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters