Wrapper for Python class SignatureMeta.
Summary
Functions
Clear the caches (for debugging or testing).
Clear the registry (for debugging or testing).
Python method SignatureMeta._collect_bases_data.
Detect custom types from the caller's frame based on the signature string.
Debug helper to print the ABC registry.
Python method SignatureMeta._get_fields_with_type.
Python method SignatureMeta._validate_fields.
Return a type's method resolution order.
Initialize self. See help(type(self)) for accurate signature.
Register a virtual subclass of an ABC.
Types
Functions
@spec _abc_caches_clear( SnakeBridge.Ref.t(), keyword() ) :: {:ok, term()} | {:error, Snakepit.Error.t()}
Clear the caches (for debugging or testing).
Returns
term()
@spec _abc_registry_clear( SnakeBridge.Ref.t(), keyword() ) :: {:ok, term()} | {:error, Snakepit.Error.t()}
Clear the registry (for debugging or testing).
Returns
term()
@spec _collect_bases_data(SnakeBridge.Ref.t(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
Python method SignatureMeta._collect_bases_data.
Parameters
bases(term())
Returns
term()
@spec _detect_custom_types_from_caller(SnakeBridge.Ref.t(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
Detect custom types from the caller's frame based on the signature string.
Note: This method relies on Python's frame introspection which has some limitations:
- May not work in all Python implementations (e.g., compiled with optimizations)
- Looks up a limited number of frames in the call stack
- Cannot find types that are imported but not in the caller's namespace
For more reliable custom type resolution, explicitly provide types using the
custom_types parameter when creating a Signature.
Parameters
signature_str(term())
Returns
term()
@spec _dump_registry(SnakeBridge.Ref.t(), [term()], keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
Debug helper to print the ABC registry.
Parameters
file(term() default: None)
Returns
term()
@spec _get_fields_with_type(SnakeBridge.Ref.t(), term(), keyword()) :: {:ok, %{optional(String.t()) => term()}} | {:error, Snakepit.Error.t()}
Python method SignatureMeta._get_fields_with_type.
Parameters
field_type(term())
Returns
%{optional(String.t()) => term()}
@spec _validate_fields( SnakeBridge.Ref.t(), keyword() ) :: {:ok, term()} | {:error, Snakepit.Error.t()}
Python method SignatureMeta._validate_fields.
Returns
term()
@spec fields(SnakeBridge.Ref.t()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
@spec input_fields(SnakeBridge.Ref.t()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
@spec instructions(SnakeBridge.Ref.t()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
@spec mro( SnakeBridge.Ref.t(), keyword() ) :: {:ok, term()} | {:error, Snakepit.Error.t()}
Return a type's method resolution order.
Returns
term()
@spec new( [term()], keyword() ) :: {:ok, SnakeBridge.Ref.t()} | {:error, Snakepit.Error.t()}
Initialize self. See help(type(self)) for accurate signature.
Parameters
args(term())kwargs(term())
@spec output_fields(SnakeBridge.Ref.t()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
@spec register(SnakeBridge.Ref.t(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()}
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
Parameters
subclass(term())
Returns
term()
@spec signature(SnakeBridge.Ref.t()) :: {:ok, term()} | {:error, Snakepit.Error.t()}