summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason kirtland <jek@discorporate.us>2019-11-02 14:04:35 -0700
committerGitHub <noreply@github.com>2019-11-02 14:04:35 -0700
commit6f86085e71661d874c6c56f49c76044c9b7f29c0 (patch)
tree910e865bdccdc6f79546ba6054a603150c482b96
parent398ef40a52749dfa005609f6b1f5b180fb4b3fbe (diff)
parent17653564e53669899275d23f60b4c7b162218293 (diff)
downloadblinker-6f86085e71661d874c6c56f49c76044c9b7f29c0.tar.gz
Merge pull request #41 from hugovk/rm-eol
Drop support for EOL Python
-rw-r--r--.travis.yml12
-rw-r--r--README.md42
-rw-r--r--blinker/_saferef.py2
-rw-r--r--blinker/_utilities.py14
-rw-r--r--blinker/base.py4
-rw-r--r--docs/source/index.rst4
-rw-r--r--setup.py9
-rw-r--r--tests/test_signals.py21
-rw-r--r--tox.ini2
9 files changed, 38 insertions, 72 deletions
diff --git a/.travis.yml b/.travis.yml
index 7af8b0a..cb889b5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,10 +2,6 @@ language: python
matrix:
include:
- - python: 2.6
- os: linux
- dist: trusty
- env: TOXENV=py26
- python: 2.7
os: linux
dist: trusty
@@ -14,14 +10,6 @@ matrix:
os: linux
dist: trusty
env: TOXENV=pypy
- - python: 3.3
- os: linux
- dist: trusty
- env: TOXENV=py33
- - python: 3.4
- os: linux
- dist: trusty
- env: TOXENV=py34
- python: 3.5
os: linux
dist: trusty
diff --git a/README.md b/README.md
index fcdccdc..907a3ec 100644
--- a/README.md
+++ b/README.md
@@ -9,31 +9,33 @@ interested parties to subscribe to events, or "signals".
Signal receivers can subscribe to specific senders or receive signals
sent by any sender.
- >>> from blinker import signal
- >>> started = signal('round-started')
- >>> def each(round):
- ... print "Round %s!" % round
- ...
- >>> started.connect(each)
-
- >>> def round_two(round):
- ... print "This is round two."
- ...
- >>> started.connect(round_two, sender=2)
-
- >>> for round in range(1, 4):
- ... started.send(round)
- ...
- Round 1!
- Round 2!
- This is round two.
- Round 3!
+```python
+>>> from blinker import signal
+>>> started = signal('round-started')
+>>> def each(round):
+... print "Round %s!" % round
+...
+>>> started.connect(each)
+
+>>> def round_two(round):
+... print "This is round two."
+...
+>>> started.connect(round_two, sender=2)
+
+>>> for round in range(1, 4):
+... started.send(round)
+...
+Round 1!
+Round 2!
+This is round two.
+Round 3!
+```
See the [Blinker documentation](https://pythonhosted.org/blinker/) for more information.
## Requirements
-Blinker requires Python 2.4 or higher, Python 3.0 or higher, or Jython 2.5 or higher.
+Blinker requires Python 2.7, Python 3.4 or higher, or Jython 2.7 or higher.
## Changelog Summary
diff --git a/blinker/_saferef.py b/blinker/_saferef.py
index 269e362..081173d 100644
--- a/blinker/_saferef.py
+++ b/blinker/_saferef.py
@@ -198,7 +198,7 @@ class BoundMethodWeakref(object):
def __str__(self):
"""Give a friendly representation of the object."""
- return "%s(%s.%s)" % (
+ return "{}({}.{})".format(
self.__class__.__name__,
self.self_name,
self.func_name,
diff --git a/blinker/_utilities.py b/blinker/_utilities.py
index 056270d..133c57a 100644
--- a/blinker/_utilities.py
+++ b/blinker/_utilities.py
@@ -36,7 +36,7 @@ except:
def __reduce__(self):
if self.default_factory is None:
- args = tuple()
+ args = ()
else:
args = self.default_factory,
return type(self), args, None, None, self.items()
@@ -53,20 +53,10 @@ except:
copy.deepcopy(self.items()))
def __repr__(self):
- return 'defaultdict(%s, %s)' % (self.default_factory,
+ return 'defaultdict({}, {})'.format(self.default_factory,
dict.__repr__(self))
-try:
- from contextlib import contextmanager
-except ImportError:
- def contextmanager(fn):
- def oops(*args, **kw):
- raise RuntimeError("Python 2.5 or above is required to use "
- "context managers.")
- oops.__name__ = fn.__name__
- return oops
-
class _symbol(object):
def __init__(self, name):
diff --git a/blinker/base.py b/blinker/base.py
index c9f65de..52b9a6b 100644
--- a/blinker/base.py
+++ b/blinker/base.py
@@ -8,12 +8,12 @@ each manages its own receivers and message emission.
The :func:`signal` function provides singleton behavior for named signals.
"""
+from contextlib import contextmanager
from warnings import warn
from weakref import WeakValueDictionary
from blinker._utilities import (
WeakTypes,
- contextmanager,
defaultdict,
hashable_identity,
lazy_property,
@@ -416,7 +416,7 @@ class NamedSignal(Signal):
def __repr__(self):
base = Signal.__repr__(self)
- return "%s; %r>" % (base[:-1], self.name)
+ return "{}; {!r}>".format(base[:-1], self.name)
class Namespace(dict):
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 28976d8..bdb40ef 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -16,8 +16,8 @@ The core of Blinker is quite small but provides powerful features:
- thread safety
Blinker was written by Jason Kirtand and is provided under the MIT
-License. The library supports Python 2.4 or later; Python 3.0 or later;
-or Jython 2.5 or later; or PyPy 1.6 or later.
+License. The library supports Python 2.7 and Python 3.5 or later;
+or Jython 2.7 or later; or PyPy 2.7 or later.
Decoupling With Named Signals
diff --git a/setup.py b/setup.py
index ab4b263..2f81494 100644
--- a/setup.py
+++ b/setup.py
@@ -17,6 +17,7 @@ setup(name="blinker",
long_description=readme,
license='MIT License',
url='http://pythonhosted.org/blinker/',
+ python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
@@ -24,16 +25,8 @@ setup(name="blinker",
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.4',
- 'Programming Language :: Python :: 2.5',
- 'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.0',
- 'Programming Language :: Python :: 3.1',
- 'Programming Language :: Python :: 3.2',
- 'Programming Language :: Python :: 3.3',
- 'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
diff --git a/tests/test_signals.py b/tests/test_signals.py
index a1172ed..2d6a65a 100644
--- a/tests/test_signals.py
+++ b/tests/test_signals.py
@@ -48,10 +48,10 @@ def test_meta_connect():
sig = blinker.Signal()
sig.connect(receiver)
- assert sentinel == [dict(sender=sig,
- receiver_arg=receiver,
- sender_arg=blinker.ANY,
- weak_arg=True)]
+ assert sentinel == [{'sender': sig,
+ 'receiver_arg': receiver,
+ 'sender_arg': blinker.ANY,
+ 'weak_arg': True}]
blinker.receiver_connected._clear_state()
@@ -78,7 +78,7 @@ def _test_signal_signals(sender):
expected = ('receiver_connected',
sig,
- dict(receiver=receiver, sender=sender, weak=weak))
+ {'receiver': receiver, 'sender': sender, 'weak': weak})
assert sentinel[-1] == expected
@@ -87,14 +87,14 @@ def _test_signal_signals(sender):
expected = ('receiver_disconnected',
sig,
- dict(receiver=receiver1, sender=sender))
+ {'receiver': receiver1, 'sender': sender})
assert sentinel[-1] == expected
# disconnect from ANY and all senders (implicit disconnect signature)
sig.disconnect(receiver2)
assert sentinel[-1] == ('receiver_disconnected',
sig,
- dict(receiver=receiver2, sender=blinker.ANY))
+ {'receiver': receiver2, 'sender': blinker.ANY})
def test_signal_signals_any_sender():
@@ -486,10 +486,3 @@ def test_named_blinker():
def values_are_empty_sets_(dictionary):
for val in dictionary.values():
assert val == set()
-
-if sys.version_info < (2, 5):
- def test_context_manager_warning():
- sig = blinker.Signal()
- receiver = lambda sender: None
-
- assert_raises(RuntimeError, sig.connected_to, receiver)
diff --git a/tox.ini b/tox.ini
index ec20464..ddcfd38 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py25,py26,py27,py30,py31,py32,py33,py34,py35,py36,py37,jython
+envlist = py27,py35,py36,py37,jython
[testenv]
deps=nose