From 252bde4e57a203550f6c48d12c6f13ccebf47d1d Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Mon, 13 Jul 2020 20:18:00 -0400 Subject: Address fact that typing.Deque wasn't defined prior to 3.5.4 --- cmd2/table_creator.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cmd2/table_creator.py') diff --git a/cmd2/table_creator.py b/cmd2/table_creator.py index b35cade6..322f2089 100644 --- a/cmd2/table_creator.py +++ b/cmd2/table_creator.py @@ -10,12 +10,20 @@ import functools import io from collections import deque from enum import Enum -from typing import Any, Deque, Optional, Sequence, Tuple, Union +from typing import Any, Optional, Sequence, Tuple, Union from wcwidth import wcwidth from . import ansi, constants, utils +# This is needed for compatibility with early versions of Python 3.5 prior to 3.5.4 +try: + from typing import Deque +except ImportError: + from typing import _alias, T + import collections + Deque = _alias(collections.deque, T) + # Constants EMPTY = '' SPACE = ' ' -- cgit v1.2.1