summaryrefslogtreecommitdiff
path: root/cmd2/table_creator.py
diff options
context:
space:
mode:
authorEric Lin <anselor@gmail.com>2020-08-06 14:45:55 -0400
committeranselor <anselor@gmail.com>2020-08-10 23:00:09 -0400
commit9d314de00100642679abda2cd5e7e0302cde9679 (patch)
tree3ab8965c096f6953ced2a0c82b28e89862cdb686 /cmd2/table_creator.py
parentfaaf79b695a4ee91634d166dd050d2a28bb65632 (diff)
downloadcmd2-git-9d314de00100642679abda2cd5e7e0302cde9679.tar.gz
Adding explicit python 3.5.3 test to nox, travis.
Copied 3.5.4 definition of typing.Deque
Diffstat (limited to 'cmd2/table_creator.py')
-rw-r--r--cmd2/table_creator.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd2/table_creator.py b/cmd2/table_creator.py
index 8b9524a1..7a5c826c 100644
--- a/cmd2/table_creator.py
+++ b/cmd2/table_creator.py
@@ -22,8 +22,17 @@ try:
except ImportError: # pragma: no cover
import typing
+ # The following copied from the implementation of Deque in Python 3.5.4
# noinspection PyProtectedMember, PyUnresolvedReferences
- Deque = typing._alias(deque, typing.T)
+ class Deque(deque, typing.MutableSequence[typing.T]):
+ __slots__ = ()
+ __extra__ = deque
+
+ def __new__(cls, *args, **kwds):
+ if typing._geqv(cls, Deque):
+ raise TypeError('Type Deque cannot be instantiated; use deque() instead')
+ return typing._generic_new(deque, cls, *args, **kwds)
+
# Constants
EMPTY = ''