pytilities.aop.commands — Pytilities 1.2.0 documentation

### Navigation

- index
- modules |
- next |
- previous |
- Pytilities 1.2.0 documentation »
- API documentation »
- pytilities »
- pytilities.aop »

# pytilities.aop.commands

class `pytilities.aop.commands.` `advised_attribute`

  Yielding will return the name of the advised attribute, and its dict value

  Returns: (name, dict_value)

  Do not use this to call the actual function, you should use proceed for that.

class `pytilities.aop.commands.` `advised_instance`

  Yielding this, will return the instance to which the advice was applied.

  Note that if the advised is a static/class method, this will return the class that has that method.

class `pytilities.aop.commands.` `arguments`

  Yielding arguments, will return (args, kwargs).

  Args is a tuple and kwargs a frozendict.

  Note: even though get, set, delete advice would never have kwargs; it is always provided. This allows you to share the same bit of advice among multiple types of advice, and also be able to use the self param (the first arg to args, for any type of advice)

class `pytilities.aop.commands.` `proceed`(kwargs, *args)

  Call advised attribute with given args when yielded.

  Don’t forget to include a self argument, if needed.

  Its return is sent back to the advice.

class `pytilities.aop.commands.` `return_`(retval)

  Return last return value

  If yield return_ is used, the return of the last yield proceed is used. If given an argument, that is used as return value.

class `pytilities.aop.commands.` `suppress_aspect`

  Yielding this allows suppressing the current aspect temporarily

  The yield returns a context manager. While entered, it will suppress the current aspect for the current object (as returned by yield obj). Once the context is exited, the aspect is unsuppressed.

  While suppressed, an aspect’s advice does no longer affect the object for which it is suppressed. (it’s the same as disabling an aspect with the difference that suppressing, unsuppressing won’t affect your aspect’s enabled state)

### Navigation

- index
- modules |
- next |
- previous |
- Pytilities 1.2.0 documentation »
- API documentation »
- pytilities »
- pytilities.aop »