Skip to content

Commit

Permalink
Merge pull request #993 from dsully/patch-1
Browse files Browse the repository at this point in the history
Add Py2/3 unicode / str compat for documentation tools.
  • Loading branch information
davidism authored May 14, 2018
2 parents 1ea6a75 + 08bee9e commit 0bfac43
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion docs/clickdoctools.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
from sphinx.domains import Domain
from sphinx.util.compat import Directive

PY2 = sys.version_info[0] == 2

if PY2:
text_type = unicode
else:
text_type = str


class EchoingStdin(object):

Expand Down Expand Up @@ -70,7 +77,7 @@ def dummy_call(*args, **kwargs):

@contextlib.contextmanager
def isolation(input=None, env=None):
if isinstance(input, unicode):
if isinstance(input, text_type):
input = input.encode('utf-8')
input = StringIO(input or '')
output = StringIO()
Expand Down

0 comments on commit 0bfac43

Please sign in to comment.