pyrser/type_system/to_fmt.py
def to_fmt(self):
    """
    Return an Fmt representation for pretty-printing
    """
    qual = "evalctx"
    lseval = []
    block = fmt.block(":\n", "", fmt.tab(lseval))
    txt = fmt.sep(" ", [qual, block])
    lseval.append(self._sig.to_fmt())
    if len(self.resolution) > 0:
        lsb = []
        for k in sorted(self.resolution.keys()):
            s = self.resolution[k]
            if s is not None:
                lsb.append(
                    fmt.end(
                        "\n",
                        ["'%s': %s (%s)" % (k, s, s().show_name())]
                    )
                )
            else:
                lsb.append(fmt.end("\n", ["'%s': Unresolved" % (k)]))
        if self._translate_to is not None:
            lsb.append("use translator:")
            lsb.append(self._translate_to.to_fmt())
        if self._variadic_types is not None:
            lsb.append("variadic types:\n")
            arity = self._sig.arity
            for t in self._variadic_types:
                lsb.append("[%d] : %s\n" % (arity, t))
                arity += 1
        lseval.append(fmt.block("\nresolution :\n", "", fmt.tab(lsb)))
    return txt
def to_fmt(self):
    """
    Return an Fmt representation for pretty-printing
    """
    qual = "evalctx"
    lseval = []
    block = fmt.block(":\n", "", fmt.tab(lseval))
    txt = fmt.sep(" ", [qual, block])
    lseval.append(self._sig.to_fmt())
    if len(self.resolution) > 0:
        lsb = []
        for k in sorted(self.resolution.keys()):
            s = self.resolution[k]
            if s is not None:
                lsb.append(
                    fmt.end(
                        "\n",
                        ["'%s': %s (%s)" % (k, s, s().show_name())]
                    )
                )
            else:
                lsb.append(fmt.end("\n", ["'%s': Unresolved" % (k)]))
        if self._translate_to is not None:
            lsb.append("use translator:")
            lsb.append(self._translate_to.to_fmt())
        if self._variadic_types is not None:
            lsb.append("variadic types:\n")
            arity = self._sig.arity
            for t in self._variadic_types:
                lsb.append("[%d] : %s\n" % (arity, t))
                arity += 1
        lseval.append(fmt.block("\nresolution :\n", "", fmt.tab(lsb)))
    return txt
def to_fmt ( self ) : qual = "evalctx" lseval = [ ] block = fmt . block ( ":\n" , "" , fmt . tab ( lseval ) ) txt = fmt . sep ( " " , [ qual , block ] ) lseval . append ( self . _sig . to_fmt ( ) ) if len ( self . resolution ) > 0 : lsb = [ ] for k in sorted ( self . resolution . keys ( ) ) : s = self . resolution [ k ] if s is not None : lsb . append ( fmt . end ( "\n" , [ "'%s': %s (%s)" % ( k , s , s ( ) . show_name ( ) ) ] ) ) else : lsb . append ( fmt . end ( "\n" , [ "'%s': Unresolved" % ( k ) ] ) ) if self . _translate_to is not None : lsb . append ( "use translator:" ) lsb . append ( self . _translate_to . to_fmt ( ) ) if self . _variadic_types is not None : lsb . append ( "variadic types:\n" ) arity = self . _sig . arity for t in self . _variadic_types : lsb . append ( "[%d] : %s\n" % ( arity , t ) ) arity += 1 lseval . append ( fmt . block ( "\nresolution :\n" , "" , fmt . tab ( lsb ) ) ) return txt
Return an Fmt representation for pretty-printing
Return an Fmt representation for pretty - printing