Remove `sphinx.util.Tee` (#12763)

This commit is contained in:
Adam Turner 2024-08-11 17:35:04 +01:00 committed by GitHub
parent daf1e28384
commit 629b0aef8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 21 deletions

View File

@ -10,6 +10,9 @@ Dependencies
Incompatible changes Incompatible changes
-------------------- --------------------
* #12763: Remove unused internal class ``sphinx.util.Tee``.
Patch by Adam Turner.
Deprecated Deprecated
---------- ----------

View File

@ -7,7 +7,7 @@ import os
import posixpath import posixpath
import re import re
from os import path 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 urllib.parse import parse_qsl, quote_plus, urlencode, urlsplit, urlunsplit
from sphinx.errors import FiletypeNotFoundError from sphinx.errors import FiletypeNotFoundError
@ -164,26 +164,6 @@ class UnicodeDecodeErrorHandler:
# Low-level utility functions and classes. # 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]: def parselinenos(spec: str, total: int) -> list[int]:
"""Parse a line number spec (such as "1,2,4-6") and return a list of """Parse a line number spec (such as "1,2,4-6") and return a list of
wanted line numbers. wanted line numbers.