def __call__(self, func):
    '''
    tag instance is being used as a decorator.
    wrap func to make a copy of this tag
    '''
    # remove decorator from its context so it doesn't
    # get added in where it was defined
    if self._ctx:
      self._ctx.used.add(self)

    @wraps(func)
    def f(*args, **kwargs):
      tag = copy.deepcopy(self)
      tag._add_to_ctx()
      with tag:
        return func(*args, **kwargs) or tag
    return f
def __call__ ( self , func ) : if self . _ctx : self . _ctx . used . add ( self ) @ wraps ( func ) def f ( * args , ** kwargs ) : tag = copy . deepcopy ( self ) tag . _add_to_ctx ( ) with tag : return func ( * args , ** kwargs ) or tag return f
tag instance is being used as a decorator.
    wrap func to make a copy of this tag