diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2020-07-13 20:18:00 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2020-07-13 20:18:00 -0400 |
commit | 252bde4e57a203550f6c48d12c6f13ccebf47d1d (patch) | |
tree | 04fef5541f7d198d1758722ba814a564b3fd3502 /cmd2/table_creator.py | |
parent | 27a8414f334ee1b1e181c8c2f74a9e62ee17b308 (diff) | |
download | cmd2-git-252bde4e57a203550f6c48d12c6f13ccebf47d1d.tar.gz |
Address fact that typing.Deque wasn't defined prior to 3.5.4
Diffstat (limited to 'cmd2/table_creator.py')
-rw-r--r-- | cmd2/table_creator.py | 10 |
1 files changed, 9 insertions, 1 deletions
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 = ' ' |