From 629b0aef8c3ff3441ad1e0ff0fa34cc2aac9f896 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sun, 11 Aug 2024 17:35:04 +0100 Subject: [PATCH] Remove ``sphinx.util.Tee`` (#12763) --- CHANGES.rst | 3 +++ sphinx/util/__init__.py | 22 +--------------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index bf85a55d2ea..596259e74db 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,9 @@ Dependencies Incompatible changes -------------------- +* #12763: Remove unused internal class ``sphinx.util.Tee``. + Patch by Adam Turner. + Deprecated ---------- diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index 999c5ce4c11..ca0ac3139ed 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -7,7 +7,7 @@ import posixpath import re from os import path -from typing import IO, Any +from typing import Any from urllib.parse import parse_qsl, quote_plus, urlencode, urlsplit, urlunsplit from sphinx.errors import FiletypeNotFoundError @@ -164,26 +164,6 @@ def __call__(self, error: UnicodeDecodeError) -> tuple[str, int]: # Low-level utility functions and classes. -class Tee: - """ - File-like object writing to two streams. - """ - - def __init__(self, stream1: IO, stream2: IO) -> None: - self.stream1 = stream1 - self.stream2 = stream2 - - def write(self, text: str) -> None: - self.stream1.write(text) - self.stream2.write(text) - - def flush(self) -> None: - if hasattr(self.stream1, 'flush'): - self.stream1.flush() - if hasattr(self.stream2, 'flush'): - self.stream2.flush() - - def parselinenos(spec: str, total: int) -> list[int]: """Parse a line number spec (such as "1,2,4-6") and return a list of wanted line numbers.