Example #1
0
 def dump(self, nodes, obj):
     """Convert an array of items to a multiline pretty-printed
     string. The tag is produced from the type name of obj and its
     line number. See util::DumpTagged for a description of the
     nodes argument.
     """
     return dump_tagged(nodes, short_type(obj) + ':' + str(obj.line))
Example #2
0
File: strconv.py Project: rra/mypy
    def dump(self, nodes: Sequence[object], obj: 'mypy.nodes.Context') -> str:
        """Convert a list of items to a multiline pretty-printed string.

        The tag is produced from the type name of obj and its line
        number. See mypy.util.dump_tagged for a description of the nodes
        argument.
        """
        return dump_tagged(nodes, short_type(obj) + ':' + str(obj.get_line()))
Example #3
0
    def dump(self, nodes, obj):
        """Convert a list of items to a multiline pretty-printed string.

        The tag is produced from the type name of obj and its line
        number. See mypy.util.dump_tagged for a description of the nodes
        argument.
        """
        return dump_tagged(nodes, short_type(obj) + ':' + str(obj.line))
Example #4
0
    def dump(self, nodes: Sequence[object], obj: 'mypy.nodes.Context') -> str:
        """Convert a list of items to a multiline pretty-printed string.

        The tag is produced from the type name of obj and its line
        number. See mypy.util.dump_tagged for a description of the nodes
        argument.
        """
        return dump_tagged(nodes, short_type(obj) + ':' + str(obj.get_line()))
Example #5
0
    def __str__(self) -> str:
        """Return a string representation of the type.

        This includes the most important information about the type.
        """
        base = None  # type: str
        if self.bases:
            base = "Bases({})".format(", ".join(str(base) for base in self.bases))
        return dump_tagged(["Name({})".format(self.fullname()), base, ("Names", sorted(self.names.keys()))], "TypeInfo")
Example #6
0
    def __str__(self) -> str:
        """Return a string representation of the type.

        This includes the most important information about the type.
        """
        base = None  # type: str
        if self.bases:
            base = 'Bases({})'.format(', '.join(str(base)
                                                for base in self.bases))
        return dump_tagged(['Name({})'.format(self.fullname()),
                            base,
                            ('Names', sorted(self.names.keys()))],
                           'TypeInfo')
Example #7
0
    def __str__(self):
        """Return a string representation of the type.

        This includes the most important information about the type.
        """
        interfaces = []
        for i in self.interfaces:
            interfaces.append(i.full_name())
        base = None
        if self.base is not None:
            base = 'Base({})'.format(self.base.full_name())
        iface = None
        if self.is_interface:
            iface = 'Interface'
        return dump_tagged(['Name({})'.format(self.full_name()),
                            iface,
                            base,
                            ('Interfaces', interfaces),
                            ('Vars', sorted(self.vars.keys())),
                            ('Methods', sorted(self.methods.keys()))],
                           'TypeInfo')
Example #8
0
        """Return a string representation of the type.

        This includes the most important information about the type.
        """
        str[] interfaces = []
        for i in self.interfaces:
            interfaces.append(i.fullname())
        str base = None
        if self.base is not None:
            base = 'Base({})'.format(self.base.fullname())
        str iface = None
        if self.is_interface:
            iface = 'Interface'
        return dump_tagged(['Name({})'.format(self.fullname()),
                            iface,
                            base,
                            ('Interfaces', interfaces),
                            ('Names', sorted(self.names.keys()))],
                           'TypeInfo')


class SymbolTable(dict<str, SymbolTableNode>):
    str __str__(self):
        str[] a = []
        for key, value in self.items():
            # Filter out the implicit import of builtins.
            if isinstance(value, SymbolTableNode):
                if (value.fullname() != 'builtins' and
                        value.fullname().split('.')[-1] not in
                            implicit_module_attrs):
                    a.append('  ' + str(key) + ' : ' + str(value))
            else:
Example #9
0
        This includes the most important information about the type.
        """
        str[] interfaces = []
        for i in self.interfaces:
            interfaces.append(i.full_name())
        str base = None
        if self.base is not None:
            base = 'Base({})'.format(self.base.full_name())
        str iface = None
        if self.is_interface:
            iface = 'Interface'
        return dump_tagged(['Name({})'.format(self.full_name()),
                            iface,
                            base,
                            ('Interfaces', interfaces),
                            ('Vars', sorted(self.vars.keys())),
                            ('Methods', sorted(self.methods.keys()))],
                           'TypeInfo')


class SymbolTable(dict<str, SymbolTableNode>):
    str __str__(self):
        str[] a = []
        for key, value in self.items():
            # Filter out the implicit import of builtins.
            if isinstance(value, SymbolTableNode):
                if (value.full_name() != 'builtins' and
                        not value.full_name().endswith('.__name__')):
                    a.append('  ' + str(key) + ' : ' + str(value))
            else: