From 37784c170a423faa8a7970ece416c99b93692f79 Mon Sep 17 00:00:00 2001 From: Dave Hunt Date: Mon, 18 Jun 2018 15:54:34 +0100 Subject: Import constants from six instead of importing the six module --- blessings/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/blessings/__init__.py b/blessings/__init__.py index 0212ae9..ebace02 100644 --- a/blessings/__init__.py +++ b/blessings/__init__.py @@ -6,7 +6,7 @@ from contextlib import contextmanager import curses from curses import setupterm, tigetnum, tigetstr, tparm from fcntl import ioctl -import six +from six import text_type, string_types try: from io import UnsupportedOperation as IOUnsupportedOperation @@ -422,7 +422,7 @@ COMPOUNDABLES = (COLORS | 'shadow', 'standout', 'subscript', 'superscript'])) -class ParametrizingString(six.text_type): +class ParametrizingString(text_type): """A Unicode string which can be called to parametrize it as a terminal capability""" @@ -434,7 +434,7 @@ class ParametrizingString(six.text_type): "normal" capability. """ - new = six.text_type.__new__(cls, formatting) + new = text_type.__new__(cls, formatting) new._normal = normal return new @@ -463,7 +463,7 @@ class ParametrizingString(six.text_type): except TypeError: # If the first non-int (i.e. incorrect) arg was a string, suggest # something intelligent: - if len(args) == 1 and isinstance(args[0], six.string_types): + if len(args) == 1 and isinstance(args[0], string_types): raise TypeError( 'A native or nonexistent capability template received ' '%r when it was expecting ints. You probably misspelled a ' @@ -474,12 +474,12 @@ class ParametrizingString(six.text_type): raise -class FormattingString(six.text_type): +class FormattingString(text_type): """A Unicode string which can be called upon a piece of text to wrap it in formatting""" def __new__(cls, formatting, normal): - new = six.text_type.__new__(cls, formatting) + new = text_type.__new__(cls, formatting) new._normal = normal return new @@ -494,7 +494,7 @@ class FormattingString(six.text_type): return self + text + self._normal -class NullCallableString(six.text_type): +class NullCallableString(text_type): """A dummy callable Unicode to stand in for ``FormattingString`` and ``ParametrizingString`` @@ -502,7 +502,7 @@ class NullCallableString(six.text_type): """ def __new__(cls): - new = six.text_type.__new__(cls, u'') + new = text_type.__new__(cls, u'') return new def __call__(self, *args): -- cgit v1.2.1