call_py Interface

public interface call_py

Interface to call a Python objects (methods or other callables) Arguments (optional) have to be passed as tuple. Keyword arguments (optional) have to be passed as dict.



Module Procedures

private function call_py_attribute(return_value, obj, attr_name, args, kwargs) result(ierror)

Calling an object (method, function...) that is a member of another Python object (module,...).

Arguments

Type IntentOptional AttributesName
type(object), intent(out) :: return_value
class(object), intent(in) :: obj
character(kind=C_CHAR,len=*), intent(in) :: attr_name
class(tuple), intent(in), optional :: args
class(dict), intent(in), optional :: kwargs

Return Value integer(kind=C_INT)

private function call_py_object(return_value, obj_to_call, args, kwargs) result(ierror)

Calling a Python object (method, function...).

Arguments

Type IntentOptional AttributesName
type(object), intent(out) :: return_value
class(object), intent(in) :: obj_to_call
class(tuple), intent(in) :: args
class(dict), intent(in) :: kwargs

Return Value integer(kind=C_INT)

private function call_py_object_nokwargs(return_value, obj_to_call, args) result(ierror)

Python equivalent: return_value = obj_to_call(*args)

Arguments

Type IntentOptional AttributesName
type(object), intent(out) :: return_value
class(object), intent(in) :: obj_to_call
class(tuple), intent(in) :: args

Return Value integer(kind=C_INT)

private function call_py_object_noargs(return_value, obj_to_call) result(ierror)

Python equivalent: return_value = obj_to_call()

Arguments

Type IntentOptional AttributesName
type(object), intent(out) :: return_value
class(object), intent(in) :: obj_to_call

Return Value integer(kind=C_INT)

private function call_py_object_only_kwargs(return_value, obj_to_call, kwargs) result(ierror)

Python equivalent: return_value = obj_to_call(**kwargs)

Arguments

Type IntentOptional AttributesName
type(object), intent(out) :: return_value
class(object), intent(in) :: obj_to_call
class(dict), intent(in) :: kwargs

Return Value integer(kind=C_INT)