2020-06-21 16:09:54 -07:00
2020-06-21 16:09:54 -07:00
2020-06-21 16:09:36 -07:00
2020-06-20 19:03:55 -07:00
2020-06-21 16:09:21 -07:00
2020-06-21 16:09:21 -07:00
2020-06-21 16:09:21 -07:00

Bg

Implement a class to run a simple job "in the background", in parallel, and have the result waiting when the job is done.

Example:

from bg import Bg

## From a docker hub api bit of code.

def get_all(url):
    "Retrieve all paged results"
    rsp = urllib.request.urlopen(url)
    while 200 <= int(rsp.getcode()) < 300:
        data = json.loads(rsp.read())
        url = data.get("next")
        next = Bg(urllib.request.urlopen, url) if url else None
        for item in data['results']:
            yield item
        if next is None:
            break
        # If the result is not ready yet, wait for it.
        rsp = next.wait()
    print("Done")
Description
No description provided
Readme 25 KiB
Languages
Python 74.2%
Makefile 25.8%