How to use the birdseye.bird.eye function in birdseye

To help you get started, we’ve selected a few birdseye examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alexmojaki / executing / tests / samples / import_hook.py View on Github external
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,
        )
github alexmojaki / birdseye / tests / __init__.py View on Github external
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
github alexmojaki / birdseye / birdseye / ipython.py View on Github external
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
github alexmojaki / birdseye / birdseye / ipython.py View on Github external
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,
            ))
github alexmojaki / birdseye / birdseye / import_hook.py View on Github external
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,
        )