A quick preview of docpie. Print all the parsed object
970271
def preview(self, stream=sys.stdout):
        """"""

        write = stream.write

        write(('[Quick preview of Docpie %s]' % self._version).center(80, '='))
        write('\n')

        write(' sections '.center(80, '-'))

        write('\n')
        write(self.usage_text)
        write('\n')
        option_sections = self.option_sections
        if option_sections:
            write('\n')
            write('\n'.join(option_sections.values()))
        write('\n')

        write(' str '.center(80, '-'))
        write('\n[%s]\n' % self.usage_name)
        for each in self.usages:
            write('    %s\n' % each)
        write('\n[Options:]\n\n')
        for title, sections in self.options.items():
            if title:
                full_title = '%s %s' % (title, self.option_name)
            else:
                full_title = self.option_name

            write(full_title)
            write('\n')

            for each in sections:
                write('    %s\n' % each)

            write('\n')

        write(' repr '.center(80, '-'))
        write('\n[%s]\n' % self.usage_name)
        for each in self.usages:
            write('    %r\n' % each)
        write('\n[Options:]\n\n')
        for title, sections in self.options.items():
            if title:
                full_title = '%s %s' % (title, self.option_name)
            else:
                full_title = self.option_name

            write(full_title)
            write('\n')

            for each in sections:
                write('    %r\n' % each)

            write('\n')

        write(' auto handlers '.center(80, '-'))
        write('\n')
        for key, value in self.extra.items():
            write('%s %s\n' % (key, value))
1158890
def inspect(object):
    
    for k in dir(object):
        try:
            details = getattr(object, k)
        except Exception as e:
            details = e

        try:
            details = str(details)
        except Exception as e:
            details = e

        print("{}: {}".format(k, details), file=sys.stderr)
53384
def pretty_print(pp)
      return super if custom_inspect_method_defined?
      pp.object_address_group(self) do
        if defined?(@attributes) && @attributes
          attr_names = self.class.attribute_names.select { |name| has_attribute?(name) }
          pp.seplist(attr_names, proc { pp.text "," }) do |attr_name|
            pp.breakable " "
            pp.group(1) do
              pp.text attr_name
              pp.text ":"
              pp.breakable
              value = _read_attribute(attr_name)
              value = inspection_filter.filter_param(attr_name, value) unless value.nil?
              pp.pp value
            end
          end
        else
          pp.breakable " "
          pp.text "not initialized"
        end
      end
    end
1080239
def get_doc(self, objtxt):
        """"""
        try:
            import matplotlib
            matplotlib.rcParams['docstring.hardcopy'] = True
        except:
            pass
        from spyder_kernels.utils.dochelpers import getdoc

        obj, valid = self._eval(objtxt)
        if valid:
            return getdoc(obj)
1105846
public static String printCollectionAware(final Object object, final boolean printBody) {

        if (!printBody) {
            return PRINT_HIDDEN;
        }

        if (object == null) {
            return String.valueOf(object);
        }

        Class<?> clazz = object.getClass();
        if (!Collection.class.isAssignableFrom(clazz)) {
            return String.valueOf(object);
        }

        return new StringBuilder().append("[<")
                                  .append(clazz.getSimpleName())
                                  .append("> size = ")
                                  .append(Collection.class.cast(object).size()).append("]")
                                  .toString();
    }
1274743
def process(self, object, h, n=0, nl=False):
        
        if object is None:
            return 'None'
        if isinstance(object, Object):
            if len(object) == 0:
                return '<empty>'
            else:
                return self.print_object(object, h, n+2, nl)
        if isinstance(object, dict):
            if len(object) == 0:
                return '<empty>'
            else:
                return self.print_dictionary(object, h, n+2, nl)
        if isinstance(object, (list, tuple)):
            if len(object) == 0:
                return '<empty>'
            else:
                return self.print_collection(object, h, n+2)
        if isinstance(object, basestring):
            return '"%s"' % tostr(object)
        return '%s' % tostr(object)
562425
def show_description(self):
        

        def printit(c, v):
            underline = "-" * len(dr.get_name(c))
            resp = self.responses[v["type"]]
            name = "%s[%s] %s%s" % (resp.color, resp.label, dr.get_name(c), Style.RESET_ALL)
            print(name, file=self.stream)
            print(underline, file=self.stream)
            print(render(c, v), file=self.stream)
            print(file=self.stream)

        for c in sorted(self.broker.get_by_type(rule), key=dr.get_name):
            v = self.broker[c]
            _type = v.get('type')
            if _type in self.responses:
                self.counts[_type] += 1
            if (_type and ((self.fail_only and _type == 'rule') or
                           ((self.missing and _type == 'skip') or
                            (not self.fail_only and _type != 'skip')))):
                printit(c, v)
        print(file=self.stream)

        self.print_header("Rule Execution Summary", Fore.CYAN)
        for c in self.counts:
            print(self.responses[c].color + self.responses[c].title + str(self.counts[c]) + Style.RESET_ALL, file=self.stream)
917472
def output(s):
    
    p = Parser()
    t = ExpressionsTransformer()

    ast = p.parse(s)
    logging.debug(ast.pretty())
    print(ast.pretty())
    d = t.transform(ast)
    print(json.dumps(d, indent=4))
    return d
63260
def render_docstring(self):
        """"""
        default = (' = ' + str(self.default)) if self.default else ''
        opt = 'optional' if self.is_optional else ''
        can_be = ' '.join(self.possible_values) if self.possible_values else ''
        can_be = 'one of [{}]'.format(can_be) if can_be else ''
        type_ = 'of type "' + str(self.type) + '"'
        res = ' '.join([opt, '"' + self.field + '"', default, type_, can_be, '\n'])
        return res.replace('  ', ' ').lstrip()
1098596
def print_docs(self):
        '''
        
        '''
        arg = self.opts.get('fun', None)
        docs = super(Runner, self).get_docs(arg)
        for fun in sorted(docs):
            display_output('{0}:'.format(fun), 'text', self.opts)
            print(docs[fun])
771908
def print_desc(desc, verbose=False):
    '''
    
    '''
    if desc['class'] in ['project', 'workspace', 'container']:
        print_project_desc(desc, verbose=verbose)
    elif desc['class'] == 'app':
        print_app_desc(desc, verbose=verbose)
    elif desc['class'] == 'globalworkflow':
        print_globalworkflow_desc(desc, verbose=verbose)
    elif desc['class'] in ['job', 'analysis']:
        print_execution_desc(desc)
    elif desc['class'] == 'user':
        print_user_desc(desc)
    elif desc['class'] in ['org', 'team']:
        print_generic_desc(desc)
    else:
        print_data_obj_desc(desc, verbose=verbose)
1137677
def _print_rst(self, what):
        

        print
        print "Command - %s::" % what

        exec ("h = self.do_%s.__doc__" % what)
        # noinspection PyUnboundLocalVariable
        h = textwrap.dedent(h).replace("::\n\n", "")
        h = textwrap.dedent(h).replace("\n", "\n    ")
        print h
288100
def printChildren(obj, indent=""):
    
    children=obj.children()
    if children==None:
        return
    for child in children:
        try:
            childName = child.objectName()
        except AttributeError:
            childName = "<no-name>"

        #print ("{}{:10s}: {}".format(indent, childName, child.__class__))
        print ("{}{!r}: {}".format(indent, childName, child.__class__))
        printChildren(child, indent + "    ")
570859
def see_doc(obj_with_doc):
    """"""
    def decorator(fn):
        fn.__doc__ = obj_with_doc.__doc__
        return fn
    return decorator
566942
def format_object_attrs(obj):
    
    attrs = []
    if hasattr(obj, 'dtype'):
        attrs.append(('dtype', "'{}'".format(obj.dtype)))
    if getattr(obj, 'name', None) is not None:
        attrs.append(('name', default_pprint(obj.name)))
    max_seq_items = get_option('display.max_seq_items') or len(obj)
    if len(obj) > max_seq_items:
        attrs.append(('length', len(obj)))
    return attrs
20753
def pretty_print(q)
      q.instance_exec(self) do |obj|
        object_group_text = obj.respond_to?(:object_group_text) ? ' ' + obj.object_group_text : ''
        text "\#{<#{obj.class}#{object_group_text}>"
        group_sub {
          nest(2) {
            breakable(obj.any? { true } ? ' ' : '')
            seplist(obj, nil, :each_pair) { |k, v|
              group {
                pp k
                text ' => '
                pp v
              }
            }
          }
        }
        breakable ''
        text '}'
      end
    end
1310827
def print(self, *objects, **kwargs):
		""""""
		file = kwargs.get("file")

		if file is not None and file is not sys.stdout:
			PRINT(*objects, **kwargs)

		else:
			sep = STR(kwargs.get("sep", " "))
			end = STR(kwargs.get("end", "\n"))

			text = sep.join(STR(o) for o in objects)

			self.imp_print(text, end)

		for callback in self.listeners:
			callback(text)