Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9091c8d

Browse filesBrowse files
committed
Unsixify trivial modules.
1 parent 91bc843 commit 9091c8d
Copy full SHA for 9091c8d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

69 files changed

+186
-509
lines changed

‎doc/conf.py

Copy file name to clipboardExpand all lines: doc/conf.py
+5-12Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
# Matplotlib documentation build configuration file, created by
42
# sphinx-quickstart on Fri May 2 12:33:25 2008.
53
#
@@ -11,12 +9,13 @@
119
# All configuration values have a default value; values that are commented out
1210
# serve to show the default value.
1311

14-
import matplotlib
12+
from glob import glob
1513
import os
14+
import shutil
1615
import sys
16+
17+
import matplotlib
1718
import sphinx
18-
import six
19-
from glob import glob
2019

2120
# If your extensions are in another directory, add it here. If the directory
2221
# is relative to the documentation root, use os.path.abspath to make it
@@ -74,13 +73,7 @@ def _check_deps():
7473
# Import only after checking for dependencies.
7574
from sphinx_gallery.sorting import ExplicitOrder
7675

77-
if six.PY2:
78-
from distutils.spawn import find_executable
79-
has_dot = find_executable('dot') is not None
80-
else:
81-
from shutil import which # Python >= 3.3
82-
has_dot = which('dot') is not None
83-
if not has_dot:
76+
if shutil.which('dot') is None:
8477
raise OSError(
8578
"No binary named dot - you need to install the Graph Visualization "
8679
"software (usually packaged as 'graphviz') to build the documentation")

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+22-26Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@
124124
import distutils.sysconfig
125125
import functools
126126
import io
127+
import importlib
127128
import inspect
128129
from inspect import Parameter
129130
import itertools
@@ -136,6 +137,7 @@
136137
import stat
137138
import subprocess
138139
import tempfile
140+
import urllib.request
139141
import warnings
140142

141143
# cbook must import matplotlib only within function
@@ -146,8 +148,6 @@
146148
from matplotlib.rcsetup import defaultParams, validate_backend, cycler
147149

148150
import numpy
149-
from six.moves.urllib.request import urlopen
150-
from six.moves import reload_module as reload
151151

152152
# Get the version from the _version.py versioneer file. For a git checkout,
153153
# this is computed based on the number of commits since the last tag.
@@ -562,10 +562,7 @@ def _get_home():
562562
:see:
563563
http://mail.python.org/pipermail/python-list/2005-February/325395.html
564564
"""
565-
if six.PY2 and sys.platform == 'win32':
566-
path = os.path.expanduser(b"~").decode(sys.getfilesystemencoding())
567-
else:
568-
path = os.path.expanduser("~")
565+
path = os.path.expanduser("~")
569566
if os.path.isdir(path):
570567
return path
571568
for evar in ('HOME', 'USERPROFILE', 'TMP'):
@@ -789,7 +786,7 @@ def matplotlib_fname():
789786
"""
790787

791788
def gen_candidates():
792-
yield os.path.join(six.moves.getcwd(), 'matplotlibrc')
789+
yield os.path.join(os.getcwd(), 'matplotlibrc')
793790
try:
794791
matplotlibrc = os.environ['MATPLOTLIBRC']
795792
except KeyError:
@@ -838,9 +835,9 @@ class RcParams(MutableMapping, dict):
838835
:mod:`matplotlib.rcsetup`
839836
"""
840837

841-
validate = dict((key, converter) for key, (default, converter) in
842-
six.iteritems(defaultParams)
843-
if key not in _all_deprecated)
838+
validate = {key: converter
839+
for key, (default, converter) in defaultParams.items()
840+
if key not in _all_deprecated}
844841
msg_depr = "%s is deprecated and replaced with %s; please use the latter."
845842
msg_depr_set = ("%s is deprecated. Please remove it from your "
846843
"matplotlibrc and/or style files.")
@@ -958,7 +955,7 @@ def rc_params(fail_on_error=False):
958955
# this should never happen, default in mpl-data should always be found
959956
message = 'could not find rc file; returning defaults'
960957
ret = RcParams([(key, default) for key, (default, _) in
961-
six.iteritems(defaultParams)
958+
defaultParams.items()
962959
if key not in _all_deprecated])
963960
warnings.warn(message)
964961
return ret
@@ -977,7 +974,7 @@ def is_url(filename):
977974
@contextlib.contextmanager
978975
def _open_file_or_url(fname):
979976
if is_url(fname):
980-
with urlopen(fname) as f:
977+
with urllib.request.urlopen(fname) as f:
981978
yield (line.decode('utf-8') for line in f)
982979
else:
983980
fname = os.path.expanduser(fname)
@@ -1041,7 +1038,7 @@ def _rc_params_in_file(fname, fail_on_error=False):
10411038
warnings.warn('Bad val "%s" on %s\n\t%s' %
10421039
(val, error_details, msg))
10431040

1044-
for key, (val, line, cnt) in six.iteritems(rc_temp):
1041+
for key, (val, line, cnt) in rc_temp.items():
10451042
if key in defaultParams:
10461043
if fail_on_error:
10471044
config[key] = val # try to convert to proper type or raise
@@ -1088,7 +1085,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
10881085
if not use_default_template:
10891086
return config_from_file
10901087

1091-
iter_params = six.iteritems(defaultParams)
1088+
iter_params = defaultParams.items()
10921089
with warnings.catch_warnings():
10931090
warnings.simplefilter("ignore", mplDeprecation)
10941091
config = RcParams([(key, default) for key, (default, _) in iter_params
@@ -1133,7 +1130,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
11331130
with warnings.catch_warnings():
11341131
warnings.simplefilter("ignore", mplDeprecation)
11351132
rcParamsDefault = RcParams([(key, default) for key, (default, converter) in
1136-
six.iteritems(defaultParams)
1133+
defaultParams.items()
11371134
if key not in _all_deprecated])
11381135

11391136
rcParams['ps.usedistiller'] = checkdep_ps_distiller(
@@ -1205,10 +1202,10 @@ def rc(group, **kwargs):
12051202
'aa': 'antialiased',
12061203
}
12071204

1208-
if isinstance(group, six.string_types):
1205+
if isinstance(group, str):
12091206
group = (group,)
12101207
for g in group:
1211-
for k, v in six.iteritems(kwargs):
1208+
for k, v in kwargs.items():
12121209
name = aliases.get(k) or k
12131210
key = '%s.%s' % (g, name)
12141211
try:
@@ -1359,7 +1356,7 @@ def use(arg, warn=True, force=False):
13591356
# If needed we reload here because a lot of setup code is triggered on
13601357
# module import. See backends/__init__.py for more detail.
13611358
if need_reload:
1362-
reload(sys.modules['matplotlib.backends'])
1359+
importlib.reload(sys.modules['matplotlib.backends'])
13631360

13641361

13651362
try:
@@ -1501,8 +1498,8 @@ def _replacer(data, key):
15011498
converts input data to a sequence as needed.
15021499
"""
15031500
# if key isn't a string don't bother
1504-
if not isinstance(key, six.string_types):
1505-
return (key)
1501+
if not isinstance(key, str):
1502+
return key
15061503
# try to use __getitem__
15071504
try:
15081505
return sanitize_sequence(data[key])
@@ -1726,7 +1723,7 @@ def inner(ax, *args, **kwargs):
17261723
else:
17271724
label = kwargs.get(label_namer, None)
17281725
# ensure a string, as label can't be anything else
1729-
if not isinstance(label, six.string_types):
1726+
if not isinstance(label, str):
17301727
label = None
17311728

17321729
if (replace_names is None) or (replace_all_args is True):
@@ -1745,13 +1742,12 @@ def inner(ax, *args, **kwargs):
17451742

17461743
if replace_names is None:
17471744
# replace all kwargs ...
1748-
kwargs = dict((k, _replacer(data, v))
1749-
for k, v in six.iteritems(kwargs))
1745+
kwargs = {k: _replacer(data, v) for k, v in kwargs.items()}
17501746
else:
17511747
# ... or only if a kwarg of that name is in replace_names
1752-
kwargs = dict((k, _replacer(data, v)
1753-
if k in replace_names else v)
1754-
for k, v in six.iteritems(kwargs))
1748+
kwargs = {
1749+
k: _replacer(data, v) if k in replace_names else v
1750+
for k, v in kwargs.items()}
17551751

17561752
# replace the label if this func "wants" a label arg and the user
17571753
# didn't set one. Note: if the user puts in "label=None", it does

‎lib/matplotlib/_color_data.py

Copy file name to clipboardExpand all lines: lib/matplotlib/_color_data.py
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
from __future__ import (absolute_import, division, print_function,
2-
unicode_literals)
31
from collections import OrderedDict
4-
import six
52

63

74
BASE_COLORS = {

‎lib/matplotlib/_layoutbox.py

Copy file name to clipboardExpand all lines: lib/matplotlib/_layoutbox.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
"""
32
43
Conventions:

‎lib/matplotlib/_mathtext_data.py

Copy file name to clipboardExpand all lines: lib/matplotlib/_mathtext_data.py
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
"""
22
font data tables for truetype and afm computer modern fonts
33
"""
4-
from __future__ import (absolute_import, division, print_function,
5-
unicode_literals)
6-
7-
import six
84

95
latex_to_bakoma = {
106
'\\__sqrt__' : ('cmex10', 0x70),
@@ -1752,7 +1748,7 @@
17521748
'uni044B' : 1099
17531749
}
17541750

1755-
uni2type1 = dict(((v,k) for k,v in six.iteritems(type12uni)))
1751+
uni2type1 = {v: k for k, v in type12uni.items()}
17561752

17571753
tex2uni = {
17581754
'widehat' : 0x0302,

‎lib/matplotlib/_pylab_helpers.py

Copy file name to clipboardExpand all lines: lib/matplotlib/_pylab_helpers.py
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
"""
22
Manage figures for pyplot interface.
33
"""
4-
from __future__ import (absolute_import, division, print_function,
5-
unicode_literals)
6-
7-
import six
84

95
import atexit
106
import gc
@@ -63,7 +59,7 @@ def destroy(cls, num):
6359
@classmethod
6460
def destroy_fig(cls, fig):
6561
"*fig* is a Figure instance"
66-
num = next((manager.num for manager in six.itervalues(cls.figs)
62+
num = next((manager.num for manager in cls.figs.values()
6763
if manager.canvas.figure == fig), None)
6864
if num is not None:
6965
cls.destroy(num)

‎lib/matplotlib/afm.py

Copy file name to clipboardExpand all lines: lib/matplotlib/afm.py
+3-8Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,9 @@
3434
3535
"""
3636

37-
from __future__ import (absolute_import, division, print_function,
38-
unicode_literals)
39-
40-
import six
41-
from six.moves import map
42-
43-
import sys
4437
import re
38+
import sys
39+
4540
from ._mathtext_data import uni2type1
4641

4742
# Convert string the a python type
@@ -394,7 +389,7 @@ def get_str_bbox_and_descent(self, s):
394389
miny = 1e9
395390
maxy = 0
396391
left = 0
397-
if not isinstance(s, six.text_type):
392+
if not isinstance(s, str):
398393
s = _to_str(s)
399394
for c in s:
400395
if c == '\n':

‎lib/matplotlib/animation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/animation.py
+6-8Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
# * Can blit be enabled for movies?
1717
# * Need to consider event sources to allow clicking through multiple figures
1818

19-
import six
20-
2119
import abc
2220
import base64
2321
import contextlib
@@ -168,7 +166,7 @@ def __getitem__(self, name):
168166
writers = MovieWriterRegistry()
169167

170168

171-
class AbstractMovieWriter(six.with_metaclass(abc.ABCMeta)):
169+
class AbstractMovieWriter(abc.ABC):
172170
'''
173171
Abstract base class for writing movies. Fundamentally, what a MovieWriter
174172
does is provide is a way to grab frames by calling grab_frame().
@@ -629,7 +627,7 @@ def output_args(self):
629627
args.extend(['-b', '%dk' % self.bitrate])
630628
if self.extra_args:
631629
args.extend(self.extra_args)
632-
for k, v in six.iteritems(self.metadata):
630+
for k, v in self.metadata.items():
633631
args.extend(['-metadata', '%s=%s' % (k, v)])
634632

635633
return args + ['-y', self.outfile]
@@ -1096,9 +1094,9 @@ class to use, such as 'ffmpeg'. If ``None``, defaults to
10961094
# to use
10971095
if writer is None:
10981096
writer = rcParams['animation.writer']
1099-
elif (not isinstance(writer, six.string_types) and
1100-
any(arg is not None
1101-
for arg in (fps, codec, bitrate, extra_args, metadata))):
1097+
elif (not isinstance(writer, str) and
1098+
any(arg is not None
1099+
for arg in (fps, codec, bitrate, extra_args, metadata))):
11021100
raise RuntimeError('Passing in values for arguments '
11031101
'fps, codec, bitrate, extra_args, or metadata '
11041102
'is not supported when writer is an existing '
@@ -1141,7 +1139,7 @@ class to use, such as 'ffmpeg'. If ``None``, defaults to
11411139

11421140
# If we have the name of a writer, instantiate an instance of the
11431141
# registered class.
1144-
if isinstance(writer, six.string_types):
1142+
if isinstance(writer, str):
11451143
if writer in writers.avail:
11461144
writer = writers[writer](fps, codec, bitrate,
11471145
extra_args=extra_args,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.