Skip to content

Commit 104f9af

Browse files
authored
Merge pull request #955 from python-cmd2/typing_deque
Fix compatibility with Python 3.5 versions prior to 3.5.4
2 parents 27a8414 + 95d6a25 commit 104f9af

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

cmd2/table_creator.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,21 @@
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+
import typing
24+
25+
# noinspection PyProtectedMember, PyUnresolvedReferences
26+
Deque = typing._alias(deque, typing.T)
27+
1928
# Constants
2029
EMPTY = ''
2130
SPACE = ' '

docs/conf.py

+1
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)