Context

@authorityspoke.factors.new_context_helper(func)

Search Factor for generic Factors to use in new context.

Decorators for memoizing generic Factors. Used when changing an abstract Rule from one concrete context to another.

If a list has been passed in rather than a dict, uses the input as a series of Factors to replace the generic_factors from the calling object.

Also, if changes contains a replacement for the calling object, the decorator returns the replacement and never calls the decorated function.

Parameters
  • factor – a Factor that is having its generic Factors replaced to change context (for instance, to change to the context of a different case involving parties represented by different Entity objects).

  • changes – indicates which generic Factors within factor should be replaced and what they should be replaced with.

  • context_opinion – a second object with generic factors that need to be searched when trying to resolve what a string in the changes parameter refers to.

Returns

a new Factor object in the new context.