fitzzftw.patch.legacy_311

legacy_311

Legacy Introspection Support for Python 3.11.

This module provides specialized tools to extract function signatures from Protocols and Callables where the standard inspect module fails in Python versions < 3.12 (specifically on Debian 12 LTS environments).

Note:

For Python 3.12/13, use current_312_313. For Python 3.14+, use future_314_ge.

Classes

FtwMethFuncWrap

A metadata wrapper for callables (functions and methods).

FtwProtocolWrap

A metadata wrapper for Python Protocol classes.

Functions

sig2str(meth)

Generates a human-readable signature string from a callable's annotations.

sig2str(meth)[source]

Generates a human-readable signature string from a callable’s annotations.

Unlike inspect.signature, this function directly accesses __annotations__ to avoid TypeError and ValueError often encountered when inspecting runtime_checkable Protocols in Python 3.11.

Parameters:

meth (Callable) – The method or function to inspect.

Returns:

A formatted signature string, e.g., “(self, a: int, b: list[str] | None)-> str”. Returns “(<not available>)” if introspection fails.

Return type:

str