Skip to content

Commit 252bde4

Browse files
committed
Address fact that typing.Deque wasn't defined prior to 3.5.4
1 parent 27a8414 commit 252bde4

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

cmd2/table_creator.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@
1010
import io
1111
from collections import deque
1212
from enum import Enum
13-
from typing import Any, Deque, Optional, Sequence, Tuple, Union
13+
from typing import Any, Optional, Sequence, Tuple, Union
1414

1515
from wcwidth import wcwidth
1616

1717
from . import ansi, constants, utils
1818

19+
# This is needed for compatibility with early versions of Python 3.5 prior to 3.5.4
20+
try:
21+
from typing import Deque
22+
except ImportError:
23+
from typing import _alias, T
24+
import collections
25+
Deque = _alias(collections.deque, T)
26+
1927
# Constants
2028
EMPTY = ''
2129
SPACE = ' '

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"""
2020
# Import for custom theme from Read the Docs
2121
import sphinx_rtd_theme
22+
2223
import cmd2
2324

2425
# -- General configuration -----------------------------------------------------

0 commit comments

Comments
 (0)