Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Python3.5 dictview support#6787

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mdboom merged 1 commit intomatplotlib:masterfromstory645:dict3
Aug 10, 2016
Merged
Show file tree
Hide file tree
Changes fromall 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
23 changes: 17 additions & 6 deletionslib/matplotlib/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -119,7 +119,10 @@
import functools
# cbook must import matplotlib only within function
# definitions, so it is safe to import from it here.
from matplotlib.cbook import is_string_like, mplDeprecation, dedent, get_label
from matplotlib.cbook import (is_string_like,
mplDeprecation,
dedent, get_label,
sanitize_sequence)
from matplotlib.compat import subprocess
from matplotlib.rcsetup import (defaultParams,
validate_backend,
Expand DownExpand Up@@ -1541,7 +1544,7 @@ def _jupyter_nbextension_paths():
'matplotlib.tests.test_units',
'matplotlib.tests.test_widgets',
'matplotlib.tests.test_cycles',
'matplotlib.tests.test_labeled_data_unpacking',
'matplotlib.tests.test_preprocess_data',
'matplotlib.sphinxext.tests.test_tinypages',
'mpl_toolkits.tests.test_mplot3d',
'mpl_toolkits.tests.test_axes_grid1',
Expand DownExpand Up@@ -1649,12 +1652,15 @@ def test(verbosity=1, coverage=False):


def _replacer(data, key):
"""Either returns data[key] or passes data back. Also
converts input data to a sequence as needed.
"""
# if key isn't a string don't bother
if not isinstance(key, six.string_types):
return key
return(key)
# try to use __getitem__
try:
return data[key]
returnsanitize_sequence(data[key])
# key does not exist, silently fall back to key
except KeyError:
return key
Expand All@@ -1673,7 +1679,7 @@ def _replacer(data, key):
"""


defunpack_labeled_data(replace_names=None, replace_all_args=False,
def_preprocess_data(replace_names=None, replace_all_args=False,
label_namer=None, positional_parameter_names=None):
"""
A decorator to add a 'data' kwarg to any a function. The signature
Expand DownExpand Up@@ -1707,6 +1713,8 @@ def foo(ax, *args, **kwargs)
NOTE: callables should only be used when the names and order of *args
can only be determined at runtime. Please use list of names
when the order and names of *args is clear before runtime!

.. note:: decorator also converts MappingView input data to list.
"""
if replace_names is not None:
replace_names = set(replace_names)
Expand DownExpand Up@@ -1847,7 +1855,10 @@ def inner(ax, *args, **kwargs):
label = None

data = kwargs.pop('data', None)
if data is not None:

if data is None: # data validation
args = tuple(sanitize_sequence(a) for a in args)
else:
if arg_names_at_runtime:
# update the information about replace names and
# label position
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp