Skip to content

Commit 7ce0020

Browse files
committed
use six.string_types instead of _six.basestring
1 parent 11e9fc3 commit 7ce0020

4 files changed

Lines changed: 8 additions & 16 deletions

File tree

progressbar/_six.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
11
'''Library to make differences between Python 2 and 3 transparent'''
22
import sys
33

4-
__all__ = [
5-
'basestring',
6-
]
7-
84
PY3 = sys.version_info[0] == 3
95

10-
if PY3: # pragma: no cover
11-
basestring = str,
12-
else: # pragma: no cover
13-
basestring = str, unicode # NOQA
14-
15-
166
if PY3: # pragma: no cover
177
long_int = int
188
else: # pragma: no cover

progressbar/bar.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313

1414
from python_utils import converters
1515

16+
import six
17+
1618
from . import widgets
1719
from . import widgets as widgets_module # Avoid name collision
18-
from . import _six
1920
from . import base
2021
from . import utils
2122

@@ -468,7 +469,7 @@ def _format_widgets(self):
468469
if isinstance(widget, widgets.AutoWidthWidgetBase):
469470
result.append(widget)
470471
expanding.insert(0, index)
471-
elif isinstance(widget, _six.basestring):
472+
elif isinstance(widget, six.string_types):
472473
result.append(widget)
473474
width -= self.custom_len(widget)
474475
else:

progressbar/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ def format_time(time, precision=datetime.timedelta(seconds=1)):
386386
'''
387387
precision_seconds = precision.total_seconds()
388388

389-
if isinstance(time, _six.basestring + six.integer_types + (float, )):
389+
if isinstance(time, six.string_types + six.integer_types + (float, )):
390390
try:
391391
time = datetime.timedelta(seconds=_six.long_int(time))
392392
except OverflowError: # pragma: no cover

progressbar/widgets.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111

1212
from python_utils import converters
1313

14+
import six
15+
1416
from . import base
15-
from . import _six
1617
from . import utils
1718

1819
MAX_DATE = datetime.date(year=datetime.MAXYEAR, month=12, day=31)
@@ -21,7 +22,7 @@
2122

2223

2324
def string_or_lambda(input_):
24-
if isinstance(input_, _six.basestring):
25+
if isinstance(input_, six.string_types):
2526
def render_input(progress, data, width):
2627
return input_ % data
2728

@@ -39,7 +40,7 @@ def _marker(progress, data, width):
3940
else:
4041
return marker
4142

42-
if isinstance(marker, _six.basestring):
43+
if isinstance(marker, six.string_types):
4344
marker = converters.to_unicode(marker)
4445
assert len(marker) == 1, 'Markers are required to be 1 char'
4546
return _marker

0 commit comments

Comments
 (0)