line_profiler.profiler_mixin module¶
- line_profiler.profiler_mixin.is_c_level_callable(func)[source]¶
- Returns:
Whether a callable is defined at the C-level (and is thus non-profilable).
- Return type:
func_is_c_level (bool)
- class line_profiler.profiler_mixin.ByCountProfilerMixin[source]¶
Bases:
objectMixin class for profiler methods built around the
enable_by_count()anddisable_by_count()methods, rather than theenable()anddisable()methods.Used by
line_profiler.line_profiler.LineProfilerandkernprof.ContextualProfile.- wrap_callable(func)[source]¶
Decorate a function to start the profiler on function entry and stop it on function exit.
- classmethod get_underlying_functions(func)[source]¶
Get the underlying function objects of a callable or an adjacent object.
- Returns:
funcs (list[Callable])
- wrap_classmethod(func)¶
Wrap a
classmethod()orstaticmethod()to profile it.
- wrap_staticmethod(func)¶
Wrap a
classmethod()orstaticmethod()to profile it.
- wrap_partial(func)¶
Wrap a
functools.partial()orfunctools.partialmethodto profile it.
- wrap_partialmethod(func)¶
Wrap a
functools.partial()orfunctools.partialmethodto profile it.
- wrap_cached_property(func)[source]¶
Wrap a
functools.cached_property()to profile it.
- wrap_class(func)[source]¶
Wrap a class by wrapping all locally-defined callables and callable wrappers.
- Returns:
The class passed in, with its locally-defined callables and wrappers wrapped.
- Return type:
- Warns:
UserWarning – If any of the locally-defined callables and wrappers cannot be replaced with the appropriate wrapper returned from
wrap_callable().