8000 Merge pull request #10044 from embray/unicode-literals · matplotlib/matplotlib@207b9a7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 207b9a7

Browse files
authored
Merge pull request #10044 from embray/unicode-literals
MNT: Remove some uses of unicode_literals
2 parents febde4b + 461ae12 commit 207b9a7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+151
-237
lines changed

lib/matplotlib/__init__.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@
9999
to MATLAB®, a registered trademark of The MathWorks, Inc.
100100
101101
"""
102-
from __future__ import (absolute_import, division, print_function,
103-
unicode_literals)
102+
from __future__ import absolute_import, division, print_function
104103

105104
import six
106105

@@ -277,10 +276,7 @@ def _parse_commandline():
277276
'info', 'warning')
278277

279278
for arg in sys.argv[1:]:
280-
# cast to str because we are using unicode_literals,
281-
# and argv is always str
282-
283-
if arg.startswith(str('--verbose-')):
279+
if arg.startswith('--verbose-'):
284280
level_str = arg[10:]
285281
# If it doesn't match one of ours, then don't even
286282
# bother noting it, we are just a 3rd-party library
@@ -305,9 +301,7 @@ class Verbose(object):
305301
_commandLineVerbose = None
306302

307303
for arg in sys.argv[1:]:
308-
# cast to str because we are using unicode_literals,
309-
# and argv is always str
310-
if not arg.startswith(str('--verbose-')):
304+
if not arg.startswith('--verbose-'):
311305
continue
312306
level_str = arg[10:]
313307
# If it doesn't match one of ours, then don't even
@@ -716,7 +710,7 @@ def _get_cachedir():
716710

717711

718712
def _decode_filesystem_path(path):
719-
if isinstance(path, bytes):
713+
if not isinstance(path, str):
720714
return path.decode(sys.getfilesystemencoding())
721715
else:
722716
return path

lib/matplotlib/cbook/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
it imports matplotlib only at runtime.
77
"""
88

9-
from __future__ import (absolute_import, division, print_function,
10-
unicode_literals)
9+
from __future__ import absolute_import, division, print_function
1110

1211
import six
1312
from six.moves import xrange, zip

lib/matplotlib/dviread.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
...
1818
1919
"""
20-
from __future__ import (absolute_import, division, print_function,
21-
unicode_literals)
20+
from __future__ import absolute_import, division, print_function
2221

2322
import six
2423
from six.moves import xrange
@@ -764,13 +763,13 @@ def __init__(self, filename):
764763
with open(filename, 'rb') as file:
765764
header1 = file.read(24)
766765
lh, bc, ec, nw, nh, nd = \
767-
struct.unpack(str('!6H'), header1[2:14])
766+
struct.unpack('!6H', header1[2:14])
768767
_log.debug(
769768
'lh=%d, bc=%d, ec=%d, nw=%d, nh=%d, nd=%d' % (
770769
lh, bc, ec, nw, nh, nd))
771770
header2 = file.read(4*lh)
772771
self.checksum, self.design_size = \
773-
struct.unpack(str('!2I'), header2[:8])
772+
struct.unpack('!2I', header2[:8])
774773
# there is also encoding information etc.
775774
char_info = file.read(4*(ec-bc+1))
776775
widths = file.read(4*nw)
@@ -779,7 +778,7 @@ def __init__(self, filename):
779778

780779
self.width, self.height, self.depth = {}, {}, {}
781780
widths, heights, depths = \
782-
[struct.unpack(str('!%dI') % (len(x)/4), x)
781+
[struct.unpack('!%dI' % (len(x)/4), x)
783782
for x in (widths, heights, depths)]
784783
for idx, char in enumerate(xrange(bc, ec+1)):
785784
byte0 = ord(char_info[4*idx])
@@ -1040,7 +1039,7 @@ def find_tex_file(filename, format=None):
10401039
if isinstance(format, bytes):
10411040
format = format.decode('utf-8', errors='replace')
10421041

1043-
cmd = [str('kpsewhich')]
1042+
cmd = ['kpsewhich']
10441043
if format is not None:
10451044
cmd += ['--format=' + format]
10461045
cmd += [filename]

lib/matplotlib/finance.py

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
This module is deprecated in 2.0 and has been moved to a module called
66
`mpl_finance`.
77
"""
8-
from __future__ import (absolute_import, division, print_function,
9-
unicode_literals)
8+
from __future__ import absolute_import, division, print_function
109

1110
import six
1211
from six.moves import xrange, zip
@@ -57,31 +56,31 @@ def md5(x):
5756

5857

5958
stock_dt_ohlc = np.dtype([
60-
(str('date'), object),
61-
(str('year'), np.int16),
62-
(str('month'), np.int8),
63-
(str('day'), np.int8),
64-
(str('d'), float), # mpl datenum
65-
(str('open'), float),
66-
(str('high'), float),
67-
(str('low'), float),
68-
(str('close'), float),
69-
(str('volume'), float),
70-
(str('aclose'), float)])
59+
('date', object),
60+
('year', np.int16),
61+
('month', np.int8),
62+
('day', np.int8),
63+
('d', float), # mpl datenum
64+
('open', float),
65+
('high', float),
66+
('low', float),
67+
('close', float),
68+
('volume', float),
69+
('aclose', float)])
7170

7271

7372
stock_dt_ochl = np.dtype(
74-
[(str('date'), object),
75-
(str('year'), np.int16),
76-
(str('month'), np.int8),
77-
(str('day'), np.int8),
78-
(str('d'), float), # mpl datenum
79-
(str('open'), float),
80-
(str('close'), float),
81-
(str('high'), float),
82-
(str('low'), float),
83-
(str('volume'), float),
84-
(str('aclose'), float)])
73+
[('date', object),
74+
('year', np.int16),
75+
('month', np.int8),
76+
('day', np.int8),
77+
('d', float), # mpl datenum
78+
('open', float),
79+
('close', float),
80+
('high', float),
81+
('low', float),
82+
('volume', float),
83+
('aclose', float)])
8584

8685

8786
def parse_yahoo_historical_ochl(fh, adjusted=True, asobject=False):

lib/matplotlib/font_manager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
platforms, so if a font is installed, it is much more likely to be
2020
found.
2121
"""
22-
from __future__ import (absolute_import, division, print_function,
23-
unicode_literals)
22+
from __future__ import absolute_import, division, print_function
2423

2524
import six
2625
from six.moves import cPickle as pickle

0 commit comments

Comments
 (0)
0