diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2020-07-13 21:02:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-13 21:02:54 -0400 |
commit | 104f9af985b7bd963f3e2daa180d681283bf80c5 (patch) | |
tree | 6244d51dcc3814843ce72f963e7cddb9b6554be4 | |
parent | 27a8414f334ee1b1e181c8c2f74a9e62ee17b308 (diff) | |
parent | 95d6a257c5738de8499d72846f0688a042220b70 (diff) | |
download | cmd2-git-104f9af985b7bd963f3e2daa180d681283bf80c5.tar.gz |
Merge pull request #955 from python-cmd2/typing_deque1.2.0
Fix compatibility with Python 3.5 versions prior to 3.5.4
-rw-r--r-- | cmd2/table_creator.py | 11 | ||||
-rw-r--r-- | docs/conf.py | 1 |
2 files changed, 11 insertions, 1 deletions
diff --git a/cmd2/table_creator.py b/cmd2/table_creator.py index b35cade6..bc0bb4c8 100644 --- a/cmd2/table_creator.py +++ b/cmd2/table_creator.py @@ -10,12 +10,21 @@ 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: + import typing + + # noinspection PyProtectedMember, PyUnresolvedReferences + Deque = typing._alias(deque, typing.T) + # Constants EMPTY = '' SPACE = ' ' diff --git a/docs/conf.py b/docs/conf.py index 8a71268a..9396f000 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -19,6 +19,7 @@ documentation root, use os.path.abspath to make it absolute, like shown here. """ # Import for custom theme from Read the Docs import sphinx_rtd_theme + import cmd2 # -- General configuration ----------------------------------------------------- |