Skip to content

Remove if six.PY2 code paths from boilerplate.py #10558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 4 additions & 21 deletions tools/boilerplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
# For some later history, see
# http://thread.gmane.org/gmane.comp.python.matplotlib.devel/7068

from __future__ import (absolute_import, division, print_function,
unicode_literals)

import six

import os
import inspect
import random
Expand Down Expand Up @@ -154,7 +149,7 @@ def boilerplate_gen():
'semilogx',
'semilogy',
'specgram',
#'spy',
# 'spy',
'stackplot',
'stem',
'step',
Expand Down Expand Up @@ -233,22 +228,10 @@ def format_value(value):
has_data = 'data' in inspect.signature(base_func).parameters
work_func = inspect.unwrap(base_func)

if six.PY2:
args, varargs, varkw, defaults = inspect.getargspec(work_func)
else:
(args, varargs, varkw, defaults, kwonlyargs, kwonlydefs,
annotations) = inspect.getfullargspec(work_func)
(args, varargs, varkw, defaults, kwonlyargs, kwonlydefs,
annotations) = inspect.getfullargspec(work_func)
args.pop(0) # remove 'self' argument
if defaults is None:
defaults = ()
else:
def_edited = []
for val in defaults:
if six.PY2:
if isinstance(val, unicode):
val = val.encode('ascii', 'ignore')
def_edited.append(val)
defaults = tuple(def_edited)
defaults = tuple(defaults or ())

# Add a data keyword argument if needed (fmt is PLOT_TEMPLATE) and
# possible (if *args is used, we can't just add a data
Expand Down