@withTiming('findPlug() reuse {time:.4f} ns')
def findPlug(self, name, cached=False):
    'Cache previously found plugs, for performance\n\n        Cost: 4.9 microseconds/call\n\n        Part of the time taken in querying an attribute is the\n        act of finding a plug given its name as a string.\n\n        This causes a 25% reduction in time taken for repeated\n        attribute queries. Though keep in mind that state is stored\n        in the `cmdx` object which currently does not survive rediscovery.\n        That is, if a node is created and later discovered through a call\n        to `encode`, then the original and discovered nodes carry one\n        state each.\n\n        Additional challenges include storing the same plug for both\n        long and short name of said attribute, which is currently not\n        the case.\n\n        Arguments:\n            name (str): Name of plug to find\n            cached (bool, optional): Return cached plug, or\n                throw an exception. Default to False, which\n                means it will run Maya\'s findPlug() and cache\n                the result.\n            safe (bool, optional): Always find the plug through\n                Maya\'s API, defaults to False. This will not perform\n                any caching and is intended for use during debugging\n                to spot whether caching is causing trouble.\n\n        Example:\n            >>> node = createNode("transform")\n            >>> node.findPlug("translateX", cached=True)\n            Traceback (most recent call last):\n            ...\n            KeyError: "\'translateX\' not cached"\n            >>> plug1 = node.findPlug("translateX")\n            >>> isinstance(plug1, om.MPlug)\n            True\n            >>> plug1 is node.findPlug("translateX")\n            True\n            >>> plug1 is node.findPlug("translateX", cached=True)\n            True\n\n        '
    try:
        existing = self._state['plugs'][name]
        Stats.PlugReuseCount += 1
        return existing
    except KeyError:
        if cached:
            raise KeyError(("'%s' not cached" % name))
    plug = self._fn.findPlug(name, False)
    self._state['plugs'][name] = plug
    return plug
Cache previously found plugs, for performance

Cost: 4.9 microseconds/call

Part of the time taken in querying an attribute is the
act of finding a plug given its name as a string.

This causes a 25% reduction in time taken for repeated
attribute queries. Though keep in mind that state is stored
in the `cmdx` object which currently does not survive rediscovery.
That is, if a node is created and later discovered through a call
to `encode`, then the original and discovered nodes carry one
state each.

Additional challenges include storing the same plug for both
long and short name of said attribute, which is currently not
the case.

Arguments:
    name (str): Name of plug to find
    cached (bool, optional): Return cached plug, or
        throw an exception. Default to False, which
        means it will run Maya's findPlug() and cache
        the result.
    safe (bool, optional): Always find the plug through
        Maya's API, defaults to False. This will not perform
        any caching and is intended for use during debugging
        to spot whether caching is causing trouble.

Example:
    >>> node = createNode("transform")
    >>> node.findPlug("translateX", cached=True)
    Traceback (most recent call last):
    ...
    KeyError: "'translateX' not cached"
    >>> plug1 = node.findPlug("translateX")
    >>> isinstance(plug1, om.MPlug)
    True
    >>> plug1 is node.findPlug("translateX")
    True
    >>> plug1 is node.findPlug("translateX", cached=True)
    True
@withTiming('findPlug() reuse {time:.4f} ns')
def findPlug(self, name, cached=False):
    'Cache previously found plugs, for performance\n\n        Cost: 4.9 microseconds/call\n\n        Part of the time taken in querying an attribute is the\n        act of finding a plug given its name as a string.\n\n        This causes a 25% reduction in time taken for repeated\n        attribute queries. Though keep in mind that state is stored\n        in the `cmdx` object which currently does not survive rediscovery.\n        That is, if a node is created and later discovered through a call\n        to `encode`, then the original and discovered nodes carry one\n        state each.\n\n        Additional challenges include storing the same plug for both\n        long and short name of said attribute, which is currently not\n        the case.\n\n        Arguments:\n            name (str): Name of plug to find\n            cached (bool, optional): Return cached plug, or\n                throw an exception. Default to False, which\n                means it will run Maya\'s findPlug() and cache\n                the result.\n            safe (bool, optional): Always find the plug through\n                Maya\'s API, defaults to False. This will not perform\n                any caching and is intended for use during debugging\n                to spot whether caching is causing trouble.\n\n        Example:\n            >>> node = createNode("transform")\n            >>> node.findPlug("translateX", cached=True)\n            Traceback (most recent call last):\n            ...\n            KeyError: "\'translateX\' not cached"\n            >>> plug1 = node.findPlug("translateX")\n            >>> isinstance(plug1, om.MPlug)\n            True\n            >>> plug1 is node.findPlug("translateX")\n            True\n            >>> plug1 is node.findPlug("translateX", cached=True)\n            True\n\n        '
    try:
        existing = self._state['plugs'][name]
        Stats.PlugReuseCount += 1
        return existing
    except KeyError:
        if cached:
            raise KeyError(("'%s' not cached" % name))
    plug = self._fn.findPlug(name, False)
    self._state['plugs'][name] = plug
    return plug