Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sphinx.util.Tee #12763

Merged
merged 2 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Dependencies
Incompatible changes
--------------------

* #12763: Remove unused internal class ``sphinx.util.Tee``.
Patch by Adam Turner.

Deprecated
----------

Expand Down
26 changes: 1 addition & 25 deletions sphinx/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -142,10 +142,6 @@ def merge_other(self, docnames: set[str], other: dict[str, tuple[set[str], Any]]
self.add_file(docname, filename)


# a regex to recognize coding cookies
_coding_re = re.compile(r'coding[:=]\s*([-\w.]+)')


class UnicodeDecodeErrorHandler:
"""Custom error handler for open() that warns and replaces."""

Expand All @@ -168,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.
Expand Down