Skip to content

Commit e8c90ae

Browse files
committed
Intermediate changes
commit_hash:d3ad801a6e5fb7eb38c6c78286f53c3b165b87c2
1 parent 3ceb82b commit e8c90ae

File tree

4 files changed

+14
-166
lines changed

4 files changed

+14
-166
lines changed

contrib/python/blinker/py3/.dist-info/METADATA

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
Metadata-Version: 2.1
1+
Metadata-Version: 2.3
22
Name: blinker
3-
Version: 1.8.2
3+
Version: 1.9.0
44
Summary: Fast, simple object-to-object and broadcast signaling
55
Author: Jason Kirtland
66
Maintainer-email: Pallets Ecosystem <contact@palletsprojects.com>
7-
Requires-Python: >=3.8
7+
Requires-Python: >=3.9
88
Description-Content-Type: text/markdown
99
Classifier: Development Status :: 5 - Production/Stable
1010
Classifier: License :: OSI Approved :: MIT License
Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
import typing as t
4-
53
from .base import ANY
64
from .base import default_namespace
75
from .base import NamedSignal
@@ -17,44 +15,3 @@
1715
"Signal",
1816
"signal",
1917
]
20-
21-
22-
def __getattr__(name: str) -> t.Any:
23-
import warnings
24-
25-
if name == "__version__":
26-
import importlib.metadata
27-
28-
warnings.warn(
29-
"The '__version__' attribute is deprecated and will be removed in"
30-
" Blinker 1.9.0. Use feature detection or"
31-
" 'importlib.metadata.version(\"blinker\")' instead.",
32-
DeprecationWarning,
33-
stacklevel=2,
34-
)
35-
return importlib.metadata.version("blinker")
36-
37-
if name == "receiver_connected":
38-
from .base import _receiver_connected
39-
40-
warnings.warn(
41-
"The global 'receiver_connected' signal is deprecated and will be"
42-
" removed in Blinker 1.9. Use 'Signal.receiver_connected' and"
43-
" 'Signal.receiver_disconnected' instead.",
44-
DeprecationWarning,
45-
stacklevel=2,
46-
)
47-
return _receiver_connected
48-
49-
if name == "WeakNamespace":
50-
from .base import _WeakNamespace
51-
52-
warnings.warn(
53-
"'WeakNamespace' is deprecated and will be removed in Blinker 1.9."
54-
" Use 'Namespace' instead.",
55-
DeprecationWarning,
56-
stacklevel=2,
57-
)
58-
return _WeakNamespace
59-
60-
raise AttributeError(name)

contrib/python/blinker/py3/blinker/base.py

Lines changed: 10 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
from __future__ import annotations
22

33
import collections.abc as c
4+
import sys
45
import typing as t
5-
import warnings
66
import weakref
77
from collections import defaultdict
8-
from contextlib import AbstractContextManager
98
from contextlib import contextmanager
109
from functools import cached_property
1110
from inspect import iscoroutinefunction
12-
from weakref import WeakValueDictionary
1311

1412
from ._utilities import make_id
1513
from ._utilities import make_ref
1614
from ._utilities import Symbol
1715

18-
if t.TYPE_CHECKING:
19-
F = t.TypeVar("F", bound=c.Callable[..., t.Any])
16+
F = t.TypeVar("F", bound=c.Callable[..., t.Any])
2017

2118
ANY = Symbol("ANY")
2219
"""Symbol for "any sender"."""
@@ -139,15 +136,6 @@ def connect(self, receiver: F, sender: t.Any = ANY, weak: bool = True) -> F:
139136
self.disconnect(receiver, sender)
140137
raise
141138

142-
if _receiver_connected.receivers and self is not _receiver_connected:
143-
try:
144-
_receiver_connected.send(
145-
self, receiver_arg=receiver, sender_arg=sender, weak_arg=weak
146-
)
147-
except TypeError:
148-
self.disconnect(receiver, sender)
149-
raise
150-
151139
return receiver
152140

153141
def connect_via(self, sender: t.Any, weak: bool = False) -> c.Callable[[F], F]:
@@ -213,24 +201,6 @@ def muted(self) -> c.Generator[None, None, None]:
213201
finally:
214202
self.is_muted = False
215203

216-
def temporarily_connected_to(
217-
self, receiver: c.Callable[..., t.Any], sender: t.Any = ANY
218-
) -> AbstractContextManager[None]:
219-
"""Deprecated alias for :meth:`connected_to`.
220-
221-
.. deprecated:: 1.1
222-
Renamed to ``connected_to``. Will be removed in Blinker 1.9.
223-
224-
.. versionadded:: 0.9
225-
"""
226-
warnings.warn(
227-
"'temporarily_connected_to' is renamed to 'connected_to'. The old name is"
228-
" deprecated and will be removed in Blinker 1.9.",
229-
DeprecationWarning,
230-
stacklevel=2,
231-
)
232-
return self.connected_to(receiver, sender)
233-
234204
def send(
235205
self,
236206
sender: t.Any | None = None,
@@ -434,7 +404,10 @@ def _make_cleanup_receiver(
434404
"""
435405

436406
def cleanup(ref: weakref.ref[c.Callable[..., t.Any]]) -> None:
437-
self._disconnect(receiver_id, ANY_ID)
407+
# If the interpreter is shutting down, disconnecting can result in a
408+
# weird ignored exception. Don't call it in that case.
409+
if not sys.is_finalizing():
410+
self._disconnect(receiver_id, ANY_ID)
438411

439412
return cleanup
440413

@@ -488,23 +461,6 @@ def _clear_state(self) -> None:
488461
self._by_receiver.clear()
489462

490463

491-
_receiver_connected = Signal(
492-
"""\
493-
Sent by a :class:`Signal` after a receiver connects.
494-
495-
:argument: the Signal that was connected to
496-
:keyword receiver_arg: the connected receiver
497-
:keyword sender_arg: the sender to connect to
498-
:keyword weak_arg: true if the connection to receiver_arg is a weak reference
499-
500-
.. deprecated:: 1.2
501-
Individual signals have their own :attr:`~Signal.receiver_connected` and
502-
:attr:`~Signal.receiver_disconnected` signals with a slightly simplified
503-
call signature. This global signal will be removed in Blinker 1.9.
504-
"""
505-
)
506-
507-
508464
class NamedSignal(Signal):
509465
"""A named generic notification emitter. The name is not used by the signal
510466
itself, but matches the key in the :class:`Namespace` that it belongs to.
@@ -524,18 +480,7 @@ def __repr__(self) -> str:
524480
return f"{base[:-1]}; {self.name!r}>" # noqa: E702
525481

526482

527-
if t.TYPE_CHECKING:
528-
529-
class PNamespaceSignal(t.Protocol):
530-
def __call__(self, name: str, doc: str | None = None) -> NamedSignal: ...
531-
532-
# Python < 3.9
533-
_NamespaceBase = dict[str, NamedSignal] # type: ignore[misc]
534-
else:
535-
_NamespaceBase = dict
536-
537-
538-
class Namespace(_NamespaceBase):
483+
class Namespace(dict[str, NamedSignal]):
539484
"""A dict mapping names to signals."""
540485

541486
def signal(self, name: str, doc: str | None = None) -> NamedSignal:
@@ -551,71 +496,17 @@ def signal(self, name: str, doc: str | None = None) -> NamedSignal:
551496
return self[name]
552497

553498

554-
class _WeakNamespace(WeakValueDictionary): # type: ignore[type-arg]
555-
"""A weak mapping of names to signals.
556-
557-
Automatically cleans up unused signals when the last reference goes out
558-
of scope. This namespace implementation provides similar behavior to Blinker
559-
<= 1.2.
560-
561-
.. deprecated:: 1.3
562-
Will be removed in Blinker 1.9.
563-
564-
.. versionadded:: 1.3
565-
"""
566-
567-
def __init__(self) -> None:
568-
warnings.warn(
569-
"'WeakNamespace' is deprecated and will be removed in Blinker 1.9."
570-
" Use 'Namespace' instead.",
571-
DeprecationWarning,
572-
stacklevel=2,
573-
)
574-
super().__init__()
575-
576-
def signal(self, name: str, doc: str | None = None) -> NamedSignal:
577-
"""Return the :class:`NamedSignal` for the given ``name``, creating it
578-
if required. Repeated calls with the same name return the same signal.
579-
580-
:param name: The name of the signal.
581-
:param doc: The docstring of the signal.
582-
"""
583-
if name not in self:
584-
self[name] = NamedSignal(name, doc)
585-
586-
return self[name] # type: ignore[no-any-return]
499+
class _PNamespaceSignal(t.Protocol):
500+
def __call__(self, name: str, doc: str | None = None) -> NamedSignal: ...
587501

588502

589503
default_namespace: Namespace = Namespace()
590504
"""A default :class:`Namespace` for creating named signals. :func:`signal`
591505
creates a :class:`NamedSignal` in this namespace.
592506
"""
593507

594-
signal: PNamespaceSignal = default_namespace.signal
508+
signal: _PNamespaceSignal = default_namespace.signal
595509
"""Return a :class:`NamedSignal` in :data:`default_namespace` with the given
596510
``name``, creating it if required. Repeated calls with the same name return the
597511
same signal.
598512
"""
599-
600-
601-
def __getattr__(name: str) -> t.Any:
602-
if name == "receiver_connected":
603-
warnings.warn(
604-
"The global 'receiver_connected' signal is deprecated and will be"
605-
" removed in Blinker 1.9. Use 'Signal.receiver_connected' and"
606-
" 'Signal.receiver_disconnected' instead.",
607-
DeprecationWarning,
608-
stacklevel=2,
609-
)
610-
return _receiver_connected
611-
612-
if name == "WeakNamespace":
613-
warnings.warn(
614-
"'WeakNamespace' is deprecated and will be removed in Blinker 1.9."
615-
" Use 'Namespace' instead.",
616-
DeprecationWarning,
617-
stacklevel=2,
618-
)
619-
return _WeakNamespace
620-
621-
raise AttributeError(name)

contrib/python/blinker/py3/ya.make

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
PY3_LIBRARY()
44

5-
VERSION(1.8.2)
5+
VERSION(1.9.0)
66

77
LICENSE(MIT)
88

0 commit comments

Comments
 (0)