parameters: (obj)
return_statement: return decorate(obj)
docstring: A decorator that enables tracing the function that it decorates.
      If you decorate with 'TraceFunction' the function will be traced in the
      global collector.
docstring_summary: A decorator that enables tracing the function that it decorates.
      If you decorate with 'TraceFunction' the function will be traced in the
      global collector.
docstring_tokens: A decorator that enables tracing the function that it decorates . If you decorate with TraceFunction the function will be traced in the global collector .
function: def TraceFunction(obj):
      """A decorator that enables tracing the function that it decorates.
      If you decorate with 'TraceFunction' the function will be traced in the
      global collector."""
      
      collector = Collector()
      
      def decorate(func):
          import inspect
  
          if inspect.ismethod(func):
              callableTypeLabel = 'method'
              classLabel = func.__self__.__class__.__name__+'.'
          else:
              callableTypeLabel = 'func'
              classLabel = ''
  
          module = inspect.getmodule(func)
          if module is not None:
              moduleLabel = module.__name__+'.'
          else:
              moduleLabel = ''
  
          label = 'Python {0}: {1}{2}{3}'.format(
              callableTypeLabel,
              moduleLabel,
              classLabel,
              func.__name__)
          def invoke(*args, **kwargs):
              with TraceScope(label):
                  return func(*args, **kwargs)
  
          invoke.__name__ = func.__name__
          # Make sure wrapper function gets attributes of wrapped function.
          import functools
          return functools.update_wrapper(invoke, func)
  
      return decorate(obj)
function_tokens: def TraceFunction ( obj ) : collector = Collector ( ) def decorate ( func ) : import inspect if inspect . ismethod ( func ) : callableTypeLabel = 'method' classLabel = func . __self__ . __class__ . __name__ + '.' else : callableTypeLabel = 'func' classLabel = '' module = inspect . getmodule ( func ) if module is not None : moduleLabel = module . __name__ + '.' else : moduleLabel = '' label = 'Python {0}: {1}{2}{3}' . format ( callableTypeLabel , moduleLabel , classLabel , func . __name__ ) def invoke ( * args , * * kwargs ) : with TraceScope ( label ) : return func ( * args , * * kwargs ) invoke . __name__ = func . __name__ # Make sure wrapper function gets attributes of wrapped function. import functools return functools . update_wrapper ( invoke , func ) return decorate ( obj )