def __init__(self, context, pipeline): super(MultiObjectsDisplay, self).__init__() self.__context = context self.__pipeline = pipeline self.__cancelled = False self.__default_odisp = None self.__queues = {} self.__ocount = 0 self.__do_autoswitch = True self.__suppress_noyield = not not list(pipeline.get_status_commands()) self.set_show_tabs(False) self.__inputqueue = None intype = self.__pipeline.get_input_type() _logger.debug("input type %s opt: %s", intype, self.__pipeline.get_input_optional()) # FIXME assume for the moment we can only input strings; also explicitly avoid allowing input for 'any' # Long term we might consider only allowing input for SysBuiltin. if intype not in (None, 'any') and Pipeline.streamtype_is_assignable( intype, str, False) and self.__pipeline.get_input_optional(): self.__inputqueue = CommandQueue() self.__pipeline.set_input_queue(self.__inputqueue) self.append_ostream(pipeline.get_output_type(), None, pipeline.get_output(), False) for aux in pipeline.get_auxstreams(): self.append_ostream(aux.schema.otype, aux.name, aux.queue, aux.schema.merge_default)
def apply(context, *args): _("""Like Unix xargs - take input and convert to arguments.""") newargs = list(args) for argument in context.input: if not isinstance(argument, str): argument = str(argument) newargs.append(argument) new_context = HotwireContext(initcwd=context.cwd) # TODO - pull in resolver from shell.py? Should this function expand # aliases? pipeline = Pipeline.create(new_context, None, *newargs) pipeline.execute_sync(assert_all_threaded=True) for result in pipeline.get_output(): yield result
def __init__(self, context, pipeline): super(MultiObjectsDisplay, self).__init__() self.__context = context self.__pipeline = pipeline self.__cancelled = False self.__default_odisp = None self.__queues = {} self.__ocount = 0 self.__do_autoswitch = True self.__suppress_noyield = not not list(pipeline.get_status_commands()) self.set_show_tabs(False) self.__inputqueue = None intype = self.__pipeline.get_input_type() _logger.debug("input type %s opt: %s", intype, self.__pipeline.get_input_optional()) # FIXME assume for the moment we can only input strings; also explicitly avoid allowing input for 'any' # Long term we might consider only allowing input for SysBuiltin. if intype not in (None, 'any') and Pipeline.streamtype_is_assignable(intype, str, False) and self.__pipeline.get_input_optional(): self.__inputqueue = CommandQueue() self.__pipeline.set_input_queue(self.__inputqueue) self.append_ostream(pipeline.get_output_type(), None, pipeline.get_output(), False) for aux in pipeline.get_auxstreams(): self.append_ostream(aux.schema.otype, aux.name, aux.queue, aux.schema.merge_default)
def __on_definedin_clicked(self, *args): from hotwire.command import Pipeline pl = Pipeline.create(None, None, 'edit', self.__definedin.get_text()) pl.execute_sync()
def script(*args, **kwargs): from hotwire.command import Pipeline, HotwireContext if not 'context' in kwargs: kwargs['context'] = HotwireContext(initcwd=(kwargs.get('cwd', None))) return Pipeline.create(kwargs['context'], kwargs.get('resolver', None), *args)
def script(*args, **kwargs): from hotwire.command import Pipeline,HotwireContext if not 'context' in kwargs: kwargs['context'] = HotwireContext(initcwd=(kwargs.get('cwd', None))) return Pipeline.create(kwargs['context'], kwargs.get('resolver', None), *args)