Path 1: 109 calls (1.0)

EvaluationSection (107) Section (2)

StringIO (86) EncodedFile (11) TextIOWrapper (7) CaptureIO (5)

None (109)

1def format(
2        self,
3        layout: BaseLayout,
4        stream: TextIO = sys.stdout,
5        encoding: str | None = None,
6    ) -> None:
7        """Format and write the given layout into the stream object.
8
9        unicode policy: unicode strings may be found in the layout;
10        try to call 'stream.write' with it, but give it back encoded using
11        the given encoding if it fails
12        """
13        if not encoding:
14            encoding = getattr(stream, "encoding", "UTF-8")
15        self.encoding = encoding or "UTF-8"
16        self.out = stream
17        self.begin_format()
18        layout.accept(self)
19        self.end_format()