Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
464d41e
Import docstring
lukelbd Sep 17, 2019
c962d63
Merge branch 'master' into wrapper-docs-on-methods
lukelbd Sep 17, 2019
e2f0777
Merge branch 'master' into wrapper-docs-on-methods
lukelbd Sep 17, 2019
a89016c
Add _concatenate_axes_docstrings, make behavior dependent on whether …
lukelbd Sep 17, 2019
93c6405
Prepend matplotlib summary to proplot method docstrings
lukelbd Sep 17, 2019
7a5692b
Implement 1d wrappers and begin adding interp docstring segments
lukelbd Sep 17, 2019
cd43068
Standardize docstring fragment names, add new fragments
lukelbd Sep 29, 2019
1ff63cc
Fix ginormous merge conflict
lukelbd Nov 28, 2019
b9c9e6c
Merge branch 'master' into wrapper-docs-on-methods
lukelbd Nov 30, 2019
a41df85
Pep8 compliance
lukelbd Nov 30, 2019
da9e82a
Merge branch 'master' into wrapper-docs-on-methods
lukelbd Nov 30, 2019
fb37b47
Merge branch 'master' into wrapper-docs-on-methods
lukelbd Dec 2, 2019
9ac7946
Merge from master
lukelbd Dec 2, 2019
ae389be
Merge branch 'master' into wrapper-docs-on-methods
lukelbd Dec 2, 2019
27bae6f
Fix RST links
lukelbd Dec 2, 2019
ec6c359
Merge from master
lukelbd Dec 7, 2019
65d3142
Merge from master
lukelbd Dec 14, 2019
902f101
Fix example size
lukelbd Dec 14, 2019
63474ad
Merge branch 'master' into wrapper-docs-on-methods
lukelbd Dec 14, 2019
499d7f2
Merge branch 'master' into wrapper-docs-on-methods
lukelbd Jan 7, 2020
7ff34f0
Merge branch 'master' into wrapper-docs-on-methods
lukelbd Jan 7, 2020
e1131f5
Merge branch 'master' into wrapper-docs-on-methods
lukelbd Jan 7, 2020
d9c2260
Merge branch 'master' into wrapper-docs-on-methods
lukelbd Jan 7, 2020
6c86d3c
Merge branch 'master' into wrapper-docs-on-methods
lukelbd Jan 7, 2020
fb9ba07
Merge branch 'master' into wrapper-docs-on-methods
lukelbd Jan 7, 2020
ca72203
Merge branch 'master' into wrapper-docs-on-methods
lukelbd Jan 20, 2020
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
Prev Previous commit
Next Next commit
Prepend matplotlib summary to proplot method docstrings
  • Loading branch information
lukelbd committed Sep 17, 2019
commit 93c640566d856a288907d39e1c26f6616d13c110
15 changes: 9 additions & 6 deletions proplot/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,21 @@ def _concatenate_axes_docstrings(func):
"""Concatenates docstrings from a matplotlib axes method with a ProPlot
axes method. Requires that proplot documentation has no other parameters,
notes, or examples sections."""
if rc.get('docstring.hardcopy'): # True when running sphinx
return func
# Get matplotlib axes func
# If current func has no docstring just blindly copy matplotlib one
name = func.__name__
orig = getattr(maxes.Axes, name)
odoc = inspect.getdoc(orig)
if not odoc: # should never happen
return func
fdoc = inspect.getdoc(func) # also dedents
if not fdoc:
func.__doc__ = odoc

# Prepend summary and potentially bail
# TODO: Does this break anything on sphinx website?
fdoc = inspect.getdoc(func) or '' # also dedents
summary = odoc[:re.search('\.( | *\n|\Z)', odoc).start() + 1]
fdoc = f'{summary}\n\n{fdoc}'
if rc.get('docstring.hardcopy'): # True when running sphinx
func.__doc__ = fdoc
return func

# Obfuscate signature by converting to *args **kwargs. Note this does
Expand All @@ -126,7 +129,7 @@ def _dummy(*args, **kwargs):
func.__signature__ = (
fsig.replace(parameters=tuple(dsig.parameters.values())))

# Concatenate docstrings
# Concatenate docstrings and copy summary
# Make sure different sections are very visible
doc = f"""
==========================={"="*len(name)}
Expand Down
3 changes: 3 additions & 0 deletions proplot/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2717,6 +2717,7 @@ def _redirect(func):
name = func.__name__
@functools.wraps(func)
def _wrapper(self, *args, **kwargs):
""""""
if getattr(self, 'name', '') == 'basemap':
return getattr(self.projection, name)(*args, ax=self, **kwargs)
else:
Expand All @@ -2732,6 +2733,7 @@ def _norecurse(func):
func._has_recurred = False
@functools.wraps(func)
def _wrapper(self, *args, **kwargs):
""""""
if func._has_recurred:
# Return the *original* version of the matplotlib method
func._has_recurred = False
Expand All @@ -2754,6 +2756,7 @@ def _wrapper_decorator(driver):
driver._docstring_orig = driver.__doc__ or ''
driver._methods_wrapped = []
def decorator(func):
""""""
# Define wrapper
@functools.wraps(func)
def _wrapper(self, *args, **kwargs):
Expand Down