MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / get_aliases

Method get_aliases

lib/matplotlib/artist.py:1516–1538  ·  view source on GitHub ↗

Get a dict mapping property fullnames to sets of aliases for each alias in the :class:`~matplotlib.artist.ArtistInspector`. e.g., for lines:: {'markerfacecolor': {'mfc'}, 'linewidth' : {'lw'}, }

(self)

Source from the content-addressed store, hash-verified

1514 self.aliasd = self.get_aliases()
1515
1516 def get_aliases(self):
1517 """
1518 Get a dict mapping property fullnames to sets of aliases for each alias
1519 in the :class:`~matplotlib.artist.ArtistInspector`.
1520
1521 e.g., for lines::
1522
1523 {'markerfacecolor': {'mfc'},
1524 'linewidth' : {'lw'},
1525 }
1526 """
1527 names = [name for name in dir(self.o)
1528 if name.startswith(('set_', 'get_'))
1529 and callable(getattr(self.o, name))]
1530 aliases = {}
1531 for name in names:
1532 func = getattr(self.o, name)
1533 if not self.is_alias(func):
1534 continue
1535 propname = re.search(f"`({name[:4]}.*)`", # get_.*/set_.*
1536 inspect.getdoc(func)).group(1)
1537 aliases.setdefault(propname[4:], set()).add(name[4:])
1538 return aliases
1539
1540 _get_valid_values_regex = re.compile(
1541 r"\n\s*(?:\.\.\s+)?ACCEPTS:\s*((?:.|\n)*?)(?:$|(?:\n\n))"

Callers 2

__init__Method · 0.95

Calls 4

is_aliasMethod · 0.95
groupMethod · 0.80
searchMethod · 0.80
addMethod · 0.45

Tested by 1