-
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.
- Loading branch information
1 parent
dcc9582
commit e97baac
Showing
10 changed files
with
98 additions
and
25 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
$PYTHON setup.py install |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"%PYTHON%" setup.py install | ||
if errorlevel 1 exit 1 |
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,10 +1,16 @@ | ||
import IPython | ||
from .yielder import Yielder as yielder | ||
from .core import job, stop | ||
from .yielder import Yielder as yielder_async | ||
from .core import job, stop, run | ||
from .loaders import register_hooks as _register_hooks | ||
from .loaders import IpythonWatcher | ||
from .loaders import load_ipython_extension | ||
|
||
_ip = IPython.get_ipython() | ||
_watcher = IpythonWatcher(_ip) | ||
_register_hooks(_watcher, _ip) | ||
yielder = yielder_async.igogo_await | ||
|
||
__igogo_inited = False | ||
|
||
if not __igogo_inited: | ||
__igogo_inited = True | ||
_ip = IPython.get_ipython() | ||
_watcher = IpythonWatcher(_ip) | ||
_register_hooks(_watcher, _ip) |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
import asyncio |
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
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
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,13 +1,18 @@ | ||
import IPython | ||
from IPython.core.magic import (Magics, magics_class, cell_magic) | ||
from .output import Output | ||
|
||
@magics_class | ||
class IgogoMagic(Magics): | ||
@cell_magic | ||
def igogo(self, line, cell): | ||
ip = IPython.get_ipython() | ||
prefix = "def __igogo_magic_wrapper():\n import igogo\n @igogo.job\n async def execute():\n" | ||
prefix = "def __igogo_magic_wrapper():\n" \ | ||
" import igogo\n" \ | ||
f" @igogo.job(**dict({line}))\n" \ | ||
" async def execute():\n" | ||
cell = prefix + '\n'.join([' ' + line for line in cell.split('\n')]) | ||
cell += " execute()\n__igogo_magic_wrapper()" | ||
ip.run_cell(cell) | ||
return None | ||
cell += "\n" \ | ||
" return execute()\n" \ | ||
"__igogo_magic_wrapper()" | ||
ip.ex(cell) |
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,8 +1,21 @@ | ||
from .core import get_context_or_fail | ||
from .exceptions import IgogoInvalidContext | ||
|
||
import greenback | ||
|
||
|
||
class Yielder: | ||
|
||
@classmethod | ||
def igogo_await(cls): | ||
if not greenback.has_portal(): | ||
raise IgogoInvalidContext() | ||
greenback.await_(cls()) | ||
|
||
def __await__(self): | ||
value = get_context_or_fail() | ||
try: | ||
value = get_context_or_fail() | ||
except IgogoInvalidContext: | ||
return | ||
yield | ||
value.out_stream.activate() |
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
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