def format(self, value):
        """
        Formats a value.

        @type value
          `int`
        """
        sign = (
            "" if self.__sign is None
            else "-" if value < 0
            else "+" if self.__sign == "+"
            else " ")

        result = str(abs(value))
        # In Python 2, trim the L from long values.
        if len(result) > self.__size or value < 0 and self.__sign is None:
            # Doesn't fit.
            result =  "#" * self.__width

        elif self.__pad == " ":
            # Space padding precedes the sign.
            result = text.pad(
                sign + result,
                self.__size + len(sign), pad=self.__pad, left=True)
        else:
            # The sign must precede zero padding.
            result = sign + text.pad(
                result, self.__size, pad=self.__pad, left=True)

        return result
dataset/ETHPy150Open twosigma/ngrid/ngrid/formatters.py/IntFormatter.format/original