Skip to content

Patch Decorator

patch(obj)

Decorator to add new or override existing methods and attributes of an object. By default, it'll patch all attributes and functions to the object (generally class) except magic attributes and functions (attributes starting and ending with double-underscores like __patch__).

  • Use attribute __no_patch__ to list all attributes and function names you don't want to patch.
  • Use attribute __patch__ to list the only attributes and function names you want to patch.
  • Don't specify anything to patch all
Back to top