fitzzftw.patch.legacy_311.FtwMethFuncWrap

class FtwMethFuncWrap[source]

Bases: object

A metadata wrapper for callables (functions and methods).

This class inspects a given callable to determine its nature (function vs. method) and extracts its signature and qualified name. It provides a consistent string representation that is particularly useful for generating error messages or documentation.

Attributes:

_len (int): Internal flag indicating if the wrapper is empty (0) or populated (1). _signature (Signature): The inspect.Signature object of the callable. _name (str): The qualified name (__qualname__) of the callable. _is_methode (bool): True if the callable is identified as a method. _is_function (bool): True if the callable is identified as a pure function.

Public Data Attributes:

is_methode

True if the wrapped object is a method (ro).

is_function

True if the wrapped object is a function (ro).

is_empty

True if no callable was provided during initialization (ro).

name

The qualified name of the callable (ro).

Public Methods:

__init__([meth_func])

Initializes the wrapper and introspects the provided callable.

__len__()

Returns 1 if a callable is wrapped, 0 otherwise.

__str__()

Returns a formatted string of the callable including its name and signature.


__init__(meth_func=None)[source]

Initializes the wrapper and introspects the provided callable.

The inspector handles edge cases where methods might be identified as functions by checking for dots in the qualified name.

Parameters:

meth_func (Callable | None) – The function or method to wrap.

property is_empty: bool

True if no callable was provided during initialization (ro).

property is_function: bool

True if the wrapped object is a function (ro).

property is_methode: bool

True if the wrapped object is a method (ro).

property name: str

The qualified name of the callable (ro).