Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def exec_module(self, module):
from birdseye.bird import eye
eye.exec_string(
source=self.source,
filename=self._spec.origin,
globs=module.__dict__,
locs=module.__dict__,
deep=self.deep,
)
from cheap_repr import repr_str, cheap_repr
from birdseye.bird import eye
path = os.path.join(os.path.expanduser('~'), '.birdseye_test.db')
if not os.environ.get('BIRDSEYE_SERVER_RUNNING'):
# Remove the database to start from scratch
if os.path.exists(path):
os.remove(path)
os.environ.setdefault('BIRDSEYE_DB', 'sqlite:///' + path)
repr_str.maxparts = 30
cheap_repr.raise_exceptions = True
eye.num_samples['big']['list'] = 10
in the user code.
"""
if call_id is None: # probably means a bug
return
html = HTML(templates_env.get_template('ipython_iframe.html').render(
call_id=call_id,
url=self.server_url.rstrip('/'),
port=self.port,
container_id=uuid4().hex,
))
# noinspection PyTypeChecker
display(html)
value = eye.exec_ipython_cell(cell, callback)
# Display the value as would happen if the %eye magic wasn't there
return value
def eye(self, _line, cell):
if not self.server_url:
server.db = Database(self.db_url)
server.Function = server.db.Function
server.Call = server.db.Call
server.Session = server.db.Session
Thread(
target=run_server,
args=(
self.port,
self.bind_host,
self.show_server_output,
),
).start()
eye.db = Database(self.db_url)
def callback(call_id):
"""
Always executes after the cell, whether or not an exception is raised
in the user code.
"""
if call_id is None: # probably means a bug
return
html = HTML(templates_env.get_template('ipython_iframe.html').render(
call_id=call_id,
url=self.server_url.rstrip('/'),
port=self.port,
container_id=uuid4().hex,
))
def exec_module(self, module):
from birdseye.bird import eye
eye.exec_string(
source=self.source,
filename=self._spec.origin,
globs=module.__dict__,
locs=module.__dict__,
deep=self.deep,
)