Skip to content

Format

exprint.formatter.Format

Abstract class dealing with format classes.

Parameters:

Name Type Description Default

formatter

Formatter

Formatter class.

required
Source code in exprint/formatter.py
def __init__(self, formatter: Formatter):
    self.formatter = formatter

formatter instance-attribute

formatter: Formatter = formatter

Formatter class.

finish abstractmethod

finish(stream: TextIOBase)

Formats the content and outputs it into the specified text stream.

Parameters:

Name Type Description Default

stream

TextIOBase

Text stream in which the text content is written.

required
Source code in exprint/formatter.py
@abstractmethod
def finish(self, stream: io.TextIOBase):
    """
    Formats the content and outputs it into the specified text stream.

    Parameters
    ----------
    stream : io.TextIOBase
        Text stream in which the text content is written.
    """
    ...

width abstractmethod

width() -> int

Returns the width of formatted text.

Returns:

Type Description
int

Width of the formatted text.

Source code in exprint/formatter.py
@abstractmethod
def width(self) -> int:
    """
    Returns the width of formatted text.

    Returns
    -------
    int
        Width of the formatted text.
    """
    ...