Provide common replacement utils / functions many projects will need
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
Línea de trabajo
Empieza revisando la utility API propuesta en este issue y el papel de unasync como herramienta de compilación. El issue no especifica archivos ni pruebas; para trabajar en ello primero habría que acordar si estas utilidades pertenecen a unasync o a un proyecto separado y, después, definir las funciones compatibles, las versiones de Python y el comportamiento de las sugerencias de tipos.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Some utility functions I was thinking about:
def azip(*iterables): # Convert any iterables and async iterables into a zipped async iterable
iterators = [aiter(x) for x in iterables]
async def generator():
while True:
try:
yield tuple([await x.__anext__() for x in iterators])
except StopAsyncIteration:
break
return generator().__aiter__()
def aiter(x): # Convert any iterable or async iterable into an async iterator
if hasattr(x, "__aiter__"):
return x.__aiter__()
elif hasattr(x, "__anext__"):
return x
async def aiter_wrapper():
for item in x:
yield item
return aiter_wrapper().__aiter__()
async def anext(i): # Advance an async iterator, good for mapping to `next()`
return await i.__anext__()
async def await_or_return(x): # Maps to 'return_()'?
if iscoroutine(x):
return await x
return x
# All of the sync variations of the above functions
next = next
iter = iter
zip = zip
def return_(x):
return x
Could also have azip_longest -> zip_longest, etc.
All of the async functions could be available only on Python 3.6+ so this could be used on projects that support 3.5 or less.
Could also provide type hints that are effected by unasync properly as well.
AsyncOrSyncIterable[X] = Union[AsyncIterable[X], Iterable[X]]
SyncIterable[X] = Iterable[X]
This should probably be a separate project to unasync as unasync is primarily a build tool, raising it here because it'd make sense for the tool to live under python-trio, maybe unasync-utils?
- Lenguaje dominante
- Python
- Estrellas
- 108
- Forks
- 16
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de python-trio/unasync
-
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
python-trio/unasync#79 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 32/100
python-trio/unasync#78 · 1 comentario · 1 reacción ·
-
Multitoken substitutionAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
python-trio/unasync#74 · 4 comentarios · 1 reacción ·
-
JITAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
python-trio/unasync#72 · 3 comentarios ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
python-trio/unasync#69 · 1 comentario · 1 reacción ·
Todos los issues de python-trio/unasync
Issues similares
-
feature:LinkChecker
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
digitalfabrik/integreat-cms#4594 ·
Los mantenedores suelen responder en 5 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
EleutherAI/lm-evaluation-harness#4319 ·
Los mantenedores suelen responder en 1 día
-
needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
json_params_matcher fails on falsy top-level JSON primitives (0, False, "")Posiblemente ocupada @mayureshsonawane17 la tomó hoy. AbiertoWaiting for: Product Owner
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 5 días