Writer which outputs the python repr for each item.
975677
def internal_writer(self, outputs, stdout):
        
        for output in outputs:
            print("\t".join(map(self.internal_serialize, output)), file=stdout)
49650
def _write_items(self, row_lookup, col_lookup, item):
        
        self.qc.write_items(row_lookup, col_lookup, item)
319334
def _repr_attributes(self):
        """"""
        if self._repr_attributes_override is None:
            # Default to init arguments
            attrs = getfullargspec(self.__init__).args[1:]
            mapping = self._repr_attributes_mapping
            if mapping:
                attrs = [mapping[a] if a in mapping else a for a in attrs]
            return attrs

        return self._repr_attributes_override
290595
def format(self, object, context, maxlevels, level):
        
        return _safe_repr(object, context, maxlevels, level)
800977
def write(models, out=None, base=None, logger=logging):
    '''
    
    '''
    assert out is not None #Output stream required
    if not isinstance(models, list): models = [models]
    for m in models:
        for link in m.match():
            s, p, o = link[:3]
            #Skip docheader statements
            if s == (base or '') + '@docheader': continue
            if p in RESOURCE_MAPPING: p = RESOURCE_MAPPING[p]
            if o in RESOURCE_MAPPING: o = RESOURCE_MAPPING[o]
            
            if p == VERSA_TYPE_REL: p = RDF_TYPE_REL
            print(strconv(s), strconv(p), strconv(o), '.', file=out)
    return
1355653
def structure_repr(self):
        
        ret = '{%s}' % ', '.join([str(x) for x in self.elements])
        return self._wrap_packed(ret)
1118215
def output_files(self):
        
        for item in self.source_files:
            yield os.path.join(self.address.repo, self.address.path, item)
583596
def Serialize(self, writer):
        
        writer.WriteVarBytes(self.Script)
        writer.WriteVarBytes(self.ParameterList)
        writer.WriteByte(self.ReturnType)
1136449
def do_repl(self):
        """"""
        from prompt_toolkit import prompt
        from prompt_toolkit.history import FileHistory
        from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
        from prompt_toolkit.contrib.completers import WordCompleter

        self.options.quiet = False
        proxy = self.open()
        ps1 = proxy.session.name() + u'> '
        words = ['help', 'stats', 'exit']
        words += [x + '=' for x in proxy.system.listMethods()]
        history_file = os.path.join(config.config_dir, '.rtxmlrpc_history')

        while True:
            try:
                try:
                    cmd = prompt(ps1, completer=WordCompleter(words),
                                 auto_suggest=AutoSuggestFromHistory(),
                                 history=FileHistory(history_file))
                except KeyboardInterrupt:
                    cmd = ''
                if not cmd:
                    print("Enter '?' or 'help' for usage information, 'Ctrl-D' to exit.")

                if cmd in {'?', 'help'}:
                    self.repl_usage()
                    continue
                elif cmd in {'', 'stats'}:
                    print(repr(proxy).split(None, 1)[1])
                    continue
                elif cmd in {'exit'}:
                    raise EOFError()

                try:
                    method, raw_args = cmd.split('=', 1)
                except ValueError:
                    print("ERROR: '=' not found")
                    continue

                raw_args = raw_args.split(',')
                args = self.cooked(raw_args)
                self.execute(proxy, method, args)
            except EOFError:
                print('Bye from {!r}'.format(proxy))
                break
435551
def Serialize(self, writer):
        
        super(UnspentCoinState, self).Serialize(writer)

        writer.WriteVarInt(len(self.Items))

        for item in self.Items:
            byt = item.to_bytes(1, 'little')
            writer.WriteByte(byt)
128549
def Serialize(self, writer):
        
        super(StorageItem, self).Serialize(writer)
        writer.WriteVarBytes(self.Value)
1244698
def write_output(self):
        """"""
        for data in self.output_data.values():
            self.create_output(data.get('key'), data.get('value'), data.get('type'))
1038346
def map_input_output(item, api):
    
    if isinstance(item, list):
        return [map_input_output(it, api) for it in item]

    elif isinstance(item, dict) and 'class' in item:
        if item['class'].lower() == 'file':
            return File(id=item['path'], api=api)

    else:
        return item
212120
def generate_output(self, writer=None):
        '''
        
        '''
        logger.info(
            'Generating permalink files in %r', self.permalink_output_path)

        clean_output_dir(self.permalink_output_path, [])
        mkdir_p(self.permalink_output_path)
        for content in itertools.chain(
                self.context['articles'], self.context['pages']):

            for permalink_id in content.get_permalink_ids_iter():
                permalink_path = os.path.join(
                    self.permalink_output_path, permalink_id) + '.html'

                redirect_string = REDIRECT_STRING.format(
                    url=article_url(content),
                    title=content.title)
                open(permalink_path, 'w').write(redirect_string)
878151
def make_repr(inst, attrs):
    # type: (object, Sequence[str]) -> str
    
    arg_str = ", ".join(
        "%s=%r" % (a, getattr(inst, a)) for a in attrs if hasattr(inst, a))
    repr_str = "%s(%s)" % (inst.__class__.__name__, arg_str)
    return repr_str
148608
def _pprint(params):
    """"""
    params_list = list()
    line_sep = ','
    for i, (k, v) in enumerate(sorted(params.iteritems())):
        if type(v) is float:
            # use str for representing floating point numbers
            # this way we get consistent representation across
            # architectures and versions.
            this_repr = '%s=%.10f' % (k, v)
        else:
            # use repr of the rest
            this_repr = '%s=%r' % (k, v)
        params_list.append(this_repr)

    lines = ','.join(params_list)
    return lines
1330881
def handle_items(repo, **kwargs):
    """"""
    log.info('items: %s %s' %(repo, kwargs))
    if not hasattr(repo, 'items'):
        return []
    return [i.serialize() for i in repo.items(**kwargs)]