|
100 | 100 | from fire.console import encoding as encoding_util |
101 | 101 | from fire.console import text |
102 | 102 |
|
103 | | -import six |
104 | | - |
105 | 103 |
|
106 | 104 | # TODO: Unify this logic with console.style.mappings |
107 | 105 | class BoxLineCharacters(object): |
@@ -355,9 +353,9 @@ def ConvertOutputToUnicode(self, buf): |
355 | 353 | Returns: |
356 | 354 | The console output string buf converted to unicode. |
357 | 355 | """ |
358 | | - if isinstance(buf, six.text_type): |
| 356 | + if isinstance(buf, str): |
359 | 357 | buf = buf.encode(self._encoding) |
360 | | - return six.text_type(buf, self._encoding, 'replace') |
| 358 | + return str(buf, self._encoding, 'replace') |
361 | 359 |
|
362 | 360 | def GetBoxLineCharacters(self): |
363 | 361 | """Returns the box/line drawing characters object. |
@@ -480,7 +478,7 @@ def DisplayWidth(self, buf): |
480 | 478 | Returns: |
481 | 479 | The display width of buf, handling unicode and ANSI controls. |
482 | 480 | """ |
483 | | - if not isinstance(buf, six.string_types): |
| 481 | + if not isinstance(buf, str): |
484 | 482 | # Handle non-string objects like Colorizer(). |
485 | 483 | return len(buf) |
486 | 484 |
|
@@ -595,16 +593,16 @@ def __init__(self, string, color, justify=None): |
595 | 593 | self._justify = justify |
596 | 594 |
|
597 | 595 | def __eq__(self, other): |
598 | | - return self._string == six.text_type(other) |
| 596 | + return self._string == str(other) |
599 | 597 |
|
600 | 598 | def __ne__(self, other): |
601 | 599 | return not self == other |
602 | 600 |
|
603 | 601 | def __gt__(self, other): |
604 | | - return self._string > six.text_type(other) |
| 602 | + return self._string > str(other) |
605 | 603 |
|
606 | 604 | def __lt__(self, other): |
607 | | - return self._string < six.text_type(other) |
| 605 | + return self._string < str(other) |
608 | 606 |
|
609 | 607 | def __ge__(self, other): |
610 | 608 | return not self < other |
@@ -692,7 +690,7 @@ def GetCharacterDisplayWidth(char): |
692 | 690 | Returns: |
693 | 691 | The monospaced terminal display width of char: either 0, 1, or 2. |
694 | 692 | """ |
695 | | - if not isinstance(char, six.text_type): |
| 693 | + if not isinstance(char, str): |
696 | 694 | # Non-unicode chars have width 1. Don't use this function on control chars. |
697 | 695 | return 1 |
698 | 696 |
|
@@ -779,7 +777,7 @@ def EncodeToBytes(data): |
779 | 777 | return data |
780 | 778 |
|
781 | 779 | # Coerce to text that will be converted to bytes. |
782 | | - s = six.text_type(data) |
| 780 | + s = str(data) |
783 | 781 |
|
784 | 782 | try: |
785 | 783 | # Assume the text can be directly converted to bytes (8-bit ascii). |
|
0 commit comments