示例#1
0
    def show_response(cls, response, callback=None):

        if callable(callback):
            response = callback(response)

        if response is not None:
            LOG.echo(response)
示例#2
0
    def echo_outputs(self, cell):

        LOG.echo('-' * self.LINE_WIDTH)

        if not hasattr(cell, 'outputs') or len(cell.outputs) == 0:
            return

        [self._print_cell_output(out) for out in cell.outputs]
        LOG.echo('-' * self.LINE_WIDTH)
示例#3
0
    def _print_cell_output(self, out):

        dyct = out.dict()

        if dyct.get('output_type') == 'error':
            ename, evalue = dyct.get('ename', ''), dyct.get('evalue', '')
            LOG.error('{}: {}'.format(ename, evalue))
        else:
            text = dyct.get('text', '')
            LOG.echo(text.strip())
示例#4
0
def version():
    """Framework's version"""

    LOG.echo("Noronha Dataops v%s" % FrameworkConst.FW_VERSION)
    pkg = pkg_resources.require(FrameworkConst.FW_NAME)[0]

    try:
        meta = pkg.get_metadata_lines('METADATA')
    except FileNotFoundError:
        meta = pkg.get_metadata_lines('PKG-INFO')

    for line in meta:
        if not line.startswith('Requires'):
            LOG.info(line)
示例#5
0
    def __call__(self, objs: List[SmartBaseDoc]):

        if len(objs) == 0:
            LOG.echo("No {}(s) found".format(self.obj_title))
        else:
            LOG.echo("Listing {}(s):".format(self.obj_title))

            for obj in objs:
                if self.expand:
                    LOG.echo(obj.pretty())
                else:
                    LOG.echo(obj.show())
示例#6
0
    def cell_start(self, cell, *args, **kwargs):

        self.index += 1
        LOG.echo(self.format_source(cell))
        super().cell_start(cell, *args, **kwargs)