Coder Social home page Coder Social logo

a_sync's People

Contributors

toejough avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

a_sync's Issues

make the async_functions first-class

make the async_foo functions just foo - as this is an async library, the async versions should come first.

make the current foo functions sync_foo.

add run-until-timeout functions

sometimes all you want to do is run a function and timeout.

allow the user to provide an error-return to be returned. if none provided, raise the standard exceptions.

Event loops started clashing (recently)

Not exactly sure why, but event loops started clashing resulting in asyncio to freak out. This is a workaround for that:

index b255b40..a45f001 100644
--- a/test_automation/interactors/alexa/__init__.py
+++ b/test_automation/interactors/alexa/__init__.py
@@ -10,6 +10,8 @@ import time
 import pathlib
 import logging
 import traceback
+import asyncio
+from threading import Thread
 # [ -Third Party ]
 import a_sync
 import blessed
@@ -148,7 +150,14 @@ async def _auth_user_to_avs(*, username, password) -> dict:
 
     # run and block till complete
     logger.info("Running auth server/client...")
-    server_and_client.block()
+
+    def thread_target():
+        return asyncio.new_event_loop().run_until_complete(server_and_client.run())
+
+    thread_1 = Thread(target=thread_target)
+    thread_1.start()
+
+    thread_1.join()
 
     # return the retrieved tokens.
     return auth_server.TOKENS

And here is more info: https://stackoverflow.com/questions/42546099/python-asyncio-migrate-from-3-4-to-3-5

Re-write parallel/serial functions

The current syntax is really verbose, but not really clear. That needs to be fixed. There's also a lot of unnecessary duplication between the async/sync versions of things.

Also, the code currently sometimes starts awaitables before the user calls the actual parallel/serial partial to do the full execution - stop doing that.

add CI checking

  • static checks
  • unit tests
  • coverage?

via travis or circle CI.

support concurrent.futures

asyncio and the await syntax in general deals with asyncio futures. This library so far deals with those, with async functions, and with normal functions. Integrate concurrent.futures as a handled object type.

defensive coding

open specific defensive coding issues for functions lacking good defensive code.

update background functions

update/replace/re-write the background functions and waiting functions to do the right thing for:

  • functions
  • async functions
  • awaitables
  • async futures
  • concurrent.futures

... in both async and sync contexts.

Document impetus

Document what this library is for in terms of why it was written.

update to real python project

This started as a throw-away experimentation file, turned into a gist, expanded into a local private repo, split into several files, and now has been published as a public repo. It's time to update it to a real python project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.