#1726 Stop allowing subclassing public classes

Merged Quentin Pradet pquentin
Coverage Reach
_core/tests/test_run.py _core/tests/test_multierror.py _core/tests/test_ki.py _core/tests/test_guest_mode.py _core/tests/test_io.py _core/tests/test_asyncgen.py _core/tests/test_instrumentation.py _core/tests/test_parking_lot.py _core/tests/test_windows.py _core/tests/test_mock_clock.py _core/tests/test_unbounded_queue.py _core/tests/test_thread_cache.py _core/tests/test_local.py _core/tests/tutil.py _core/tests/test_multierror_scripts/simple_excepthook.py _core/tests/test_multierror_scripts/custom_excepthook.py _core/tests/test_multierror_scripts/simple_excepthook_partial.py _core/tests/test_multierror_scripts/apport_excepthook.py _core/tests/test_multierror_scripts/simple_excepthook_IPython.py _core/tests/test_multierror_scripts/_common.py _core/tests/conftest.py _core/tests/test_tutil.py _core/tests/test_util.py _core/_run.py _core/_io_windows.py _core/_multierror.py _core/_io_kqueue.py _core/_io_epoll.py _core/_windows_cffi.py _core/_ki.py _core/_mock_clock.py _core/_asyncgens.py _core/_entry_queue.py _core/_local.py _core/_wakeup_socketpair.py _core/_unbounded_queue.py _core/_instrumentation.py _core/_parking_lot.py _core/_thread_cache.py _core/_traps.py _core/_io_common.py _core/__init__.py _core/_exceptions.py tests/test_ssl.py tests/test_socket.py tests/test_testing.py tests/test_sync.py tests/test_threads.py tests/test_subprocess.py tests/test_highlevel_open_tcp_stream.py tests/test_channel.py tests/test_highlevel_open_tcp_listeners.py tests/test_highlevel_socket.py tests/test_unix_pipes.py tests/test_path.py tests/test_wait_for_object.py tests/test_deprecate.py tests/test_signals.py tests/test_file_io.py tests/test_util.py tests/test_highlevel_serve_listeners.py tests/test_windows_pipes.py tests/test_exports.py tests/test_highlevel_generic.py tests/test_highlevel_ssl_helpers.py tests/test_timeouts.py tests/test_highlevel_open_unix_stream.py tests/tools/test_gen_exports.py tests/test_scheduler_determinism.py tests/test_abc.py tests/conftest.py tests/module_with_deprecations.py testing/_check_streams.py testing/_memory_streams.py testing/_sequencer.py testing/_checkpoints.py testing/_trio_test.py testing/_network.py testing/__init__.py _socket.py _sync.py _subprocess.py _ssl.py _channel.py _util.py _path.py _highlevel_socket.py _threads.py _subprocess_platform/waitid.py _subprocess_platform/__init__.py _subprocess_platform/kqueue.py _subprocess_platform/windows.py _unix_pipes.py _abc.py _tools/gen_exports.py _windows_pipes.py _highlevel_open_tcp_stream.py _deprecate.py _signals.py _file_io.py _highlevel_open_tcp_listeners.py socket.py __init__.py _timeouts.py _highlevel_serve_listeners.py _highlevel_generic.py _wait_for_object.py _highlevel_open_unix_stream.py _highlevel_ssl_helpers.py lowlevel.py to_thread.py from_thread.py abc.py _version.py

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -7,11 +7,11 @@
Loading
7 7
8 8
from ._core import enable_ki_protection, ParkingLot
9 9
from ._deprecate import deprecated
10 -
from ._util import SubclassingDeprecatedIn_v0_15_0
10 +
from ._util import Final
11 11
12 12
13 13
@attr.s(repr=False, eq=False, hash=False)
14 -
class Event(metaclass=SubclassingDeprecatedIn_v0_15_0):
14 +
class Event(metaclass=Final):
15 15
    """A waitable boolean value useful for inter-task synchronization,
16 16
    inspired by :class:`threading.Event`.
17 17
@@ -99,7 +99,7 @@
Loading
99 99
100 100
101 101
@async_cm
102 -
class CapacityLimiter(metaclass=SubclassingDeprecatedIn_v0_15_0):
102 +
class CapacityLimiter(metaclass=Final):
103 103
    """An object for controlling access to a resource with limited capacity.
104 104
105 105
    Sometimes you need to put a limit on how many tasks can do something at
@@ -342,7 +342,7 @@
Loading
342 342
343 343
344 344
@async_cm
345 -
class Semaphore(metaclass=SubclassingDeprecatedIn_v0_15_0):
345 +
class Semaphore(metaclass=Final):
346 346
    """A `semaphore <https://en.wikipedia.org/wiki/Semaphore_(programming)>`__.
347 347
348 348
    A semaphore holds an integer value, which can be incremented by
@@ -562,7 +562,7 @@
Loading
562 562
        )
563 563
564 564
565 -
class Lock(_LockImpl, metaclass=SubclassingDeprecatedIn_v0_15_0):
565 +
class Lock(_LockImpl, metaclass=Final):
566 566
    """A classic `mutex
567 567
    <https://en.wikipedia.org/wiki/Lock_(computer_science)>`__.
568 568
@@ -576,7 +576,7 @@
Loading
576 576
    """
577 577
578 578
579 -
class StrictFIFOLock(_LockImpl, metaclass=SubclassingDeprecatedIn_v0_15_0):
579 +
class StrictFIFOLock(_LockImpl, metaclass=Final):
580 580
    r"""A variant of :class:`Lock` where tasks are guaranteed to acquire the
581 581
    lock in strict first-come-first-served order.
582 582
@@ -646,7 +646,7 @@
Loading
646 646
647 647
648 648
@async_cm
649 -
class Condition(metaclass=SubclassingDeprecatedIn_v0_15_0):
649 +
class Condition(metaclass=Final):
650 650
    """A classic `condition variable
651 651
    <https://en.wikipedia.org/wiki/Monitor_(synchronization)>`__, similar to
652 652
    :class:`threading.Condition`.

@@ -75,7 +75,7 @@
Loading
75 75
from collections import OrderedDict
76 76
77 77
from .. import _core
78 -
from .._util import SubclassingDeprecatedIn_v0_15_0
78 +
from .._util import Final
79 79
80 80
_counter = count()
81 81
@@ -86,7 +86,7 @@
Loading
86 86
87 87
88 88
@attr.s(eq=False, hash=False)
89 -
class ParkingLot(metaclass=SubclassingDeprecatedIn_v0_15_0):
89 +
class ParkingLot(metaclass=Final):
90 90
    """A fair wait queue with cancellation and requeueing.
91 91
92 92
    This class encapsulates the tricky parts of implementing a wait

@@ -2,7 +2,7 @@
Loading
2 2
import errno
3 3
4 4
from ._abc import Stream
5 -
from ._util import ConflictDetector, SubclassingDeprecatedIn_v0_15_0
5 +
from ._util import ConflictDetector, Final
6 6
7 7
import trio
8 8
@@ -74,7 +74,7 @@
Loading
74 74
        await trio.lowlevel.checkpoint()
75 75
76 76
77 -
class FdStream(Stream, metaclass=SubclassingDeprecatedIn_v0_15_0):
77 +
class FdStream(Stream, metaclass=Final):
78 78
    """
79 79
    Represents a stream given the file descriptor to a pipe, TTY, etc.
80 80

@@ -158,7 +158,7 @@
Loading
158 158
from .abc import Stream, Listener
159 159
from ._highlevel_generic import aclose_forcefully
160 160
from . import _sync
161 -
from ._util import ConflictDetector, SubclassingDeprecatedIn_v0_15_0
161 +
from ._util import ConflictDetector, Final
162 162
from ._deprecate import warn_deprecated
163 163
164 164
################################################################
@@ -224,7 +224,7 @@
Loading
224 224
_State = _Enum("_State", ["OK", "BROKEN", "CLOSED"])
225 225
226 226
227 -
class SSLStream(Stream, metaclass=SubclassingDeprecatedIn_v0_15_0):
227 +
class SSLStream(Stream, metaclass=Final):
228 228
    r"""Encrypted communication using SSL/TLS.
229 229
230 230
    :class:`SSLStream` wraps an arbitrary :class:`~trio.abc.Stream`, and
@@ -870,7 +870,7 @@
Loading
870 870
                await self.transport_stream.wait_send_all_might_not_block()
871 871
872 872
873 -
class SSLListener(Listener[SSLStream], metaclass=SubclassingDeprecatedIn_v0_15_0):
873 +
class SSLListener(Listener[SSLStream], metaclass=Final):
874 874
    """A :class:`~trio.abc.Listener` for SSL/TLS-encrypted servers.
875 875
876 876
    :class:`SSLListener` wraps around another Listener, and converts

@@ -1,7 +1,7 @@
Loading
1 1
# Runvar implementations
2 2
from . import _run
3 3
4 -
from .._util import SubclassingDeprecatedIn_v0_15_0
4 +
from .._util import Final
5 5
6 6
7 7
class _RunVarToken:
@@ -19,7 +19,7 @@
Loading
19 19
        self.redeemed = False
20 20
21 21
22 -
class RunVar(metaclass=SubclassingDeprecatedIn_v0_15_0):
22 +
class RunVar(metaclass=Final):
23 23
    """The run-local variant of a context variable.
24 24
25 25
    :class:`RunVar` objects are similar to context variable objects,

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Learn more Showing 2 files with coverage changes found.

Changes in trio/__init__.py
-1
Loading file...
trio/hazmat.py
Loading file...
Files Coverage
trio 0.03% 99.64%
Project Totals (114 files) 99.64%
Loading