Dynamic dispatch for calling methods on Python objects without generated code.
Use this module when:
- Python returns an object of a class you did not generate bindings for
- You need to call methods dynamically at runtime
- You want a no-codegen escape hatch for refs
Summary
Functions
Calls a method on a Python object reference.
Gets an attribute from a Python object reference.
Checks if a value is a valid Python reference.
Sets an attribute on a Python object reference.
Types
@type opts() :: keyword()
@type ref() :: SnakeBridge.Ref.t() | map()
Functions
@spec call(ref(), atom() | String.t(), list(), opts()) :: {:ok, term()} | {:error, SnakeBridge.Runtime.error_reason()}
Calls a method on a Python object reference.
@spec get_attr(ref(), atom() | String.t(), opts()) :: {:ok, term()} | {:error, SnakeBridge.Runtime.error_reason()}
Gets an attribute from a Python object reference.
Checks if a value is a valid Python reference.
@spec set_attr(ref(), atom() | String.t(), term(), opts()) :: {:ok, term()} | {:error, SnakeBridge.Runtime.error_reason()}
Sets an attribute on a Python object reference.