R/RcppExports.R

Defines functions readline py_allow_threads_impl py_iterate py_iter_next as_iterator py_slice py_capsule py_id py_has_method py_bool_impl py_len_impl py_list_length r_convert_date r_convert_dataframe py_convert_pandas_df py_convert_pandas_series py_eval_impl py_run_file_impl py_run_string_impl py_list_submodules py_module_proxy_import py_module_import py_tuple_length py_tuple py_dict_get_keys_as_str py_dict_get_keys py_dict_length py_dict_set_item py_dict_get_item py_dict_impl py_call_impl py_ref_to_r py_ref_to_r_with_convert py_get_attr_types py_del_item py_set_item py_get_item py_del_attr py_set_attr py_get_attr py_has_attr py_new_ref py_set_convert py_get_convert py_list_attributes_impl py_numpy_available_impl py_is_function py_print py_repr py_str_impl py_compare_impl py_is_none py_finalize py_initialize py_clear_error main_process_python_info py_activate_virtualenv install_interrupt_handlers r_to_py_impl py_get_formals py_to_r_cpp is_py_object py_is_callable py_none_impl conditionMessage_from_py_exception py_flush_output py_validate_xptr py_is_null_xptr was_python_initialized_by_reticulate is_python3 write_stderr write_stdout

Documented in as_iterator is_py_object py_del_attr py_del_item py_get_attr py_get_item py_has_attr py_id py_is_null_xptr py_repr py_set_attr py_set_item py_validate_xptr

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

write_stdout <- function(text) {
    .Call(`_reticulate_write_stdout`, text)
}

write_stderr <- function(text) {
    .Call(`_reticulate_write_stderr`, text)
}

is_python3 <- function() {
    .Call(`_reticulate_is_python3`)
}

was_python_initialized_by_reticulate <- function() {
    .Call(`_reticulate_was_python_initialized_by_reticulate`)
}

#' Check if a Python object is a null externalptr
#'
#' @param x Python object
#'
#' @return Logical indicating whether the object is a null externalptr
#'
#' @details When Python objects are serialized within a persisted R
#'  environment (e.g. .RData file) they are deserialized into null
#'  externalptr objects (since the Python session they were originally
#'  connected to no longer exists). This function allows you to safely
#'  check whether whether a Python object is a null externalptr.
#'
#'  The `py_validate` function is a convenience function which calls
#'  `py_is_null_xptr` and throws an error in the case that the xptr
#'  is `NULL`.
#'
#' @export
py_is_null_xptr <- function(x) {
    .Call(`_reticulate_py_is_null_xptr`, x)
}

#' @rdname py_is_null_xptr
#' @export
py_validate_xptr <- function(x) {
    invisible(.Call(`_reticulate_py_validate_xptr`, x))
}

py_flush_output <- function() {
    .Call(`_reticulate_py_flush_output`)
}

conditionMessage_from_py_exception <- function(exc) {
    .Call(`_reticulate_conditionMessage_from_py_exception`, exc)
}

py_none_impl <- function() {
    .Call(`_reticulate_py_none_impl`)
}

py_is_callable <- function(x) {
    .Call(`_reticulate_py_is_callable`, x)
}

#' Check if x is a Python object
#'
#' Checks if `x` is a Python object, more efficiently
#' than `inherits(x, "python.builtin.object")`.
#'
#' @param x An \R or Python.
#'
#' @return \code{TRUE} or \code{FALSE}.
#' @export
#' @keywords internal
is_py_object <- function(x) {
    .Call(`_reticulate_is_py_object`, x)
}

py_to_r_cpp <- function(x) {
    .Call(`_reticulate_py_to_r_cpp`, x)
}

py_get_formals <- function(callable) {
    .Call(`_reticulate_py_get_formals`, callable)
}

r_to_py_impl <- function(object, convert) {
    .Call(`_reticulate_r_to_py_impl`, object, convert)
}

install_interrupt_handlers <- function() {
    invisible(.Call(`_reticulate_install_interrupt_handlers`))
}

py_activate_virtualenv <- function(script) {
    invisible(.Call(`_reticulate_py_activate_virtualenv`, script))
}

main_process_python_info <- function() {
    .Call(`_reticulate_main_process_python_info`)
}

py_clear_error <- function() {
    invisible(.Call(`_reticulate_py_clear_error`))
}

py_initialize <- function(python, libpython, pythonhome, virtualenv_activate, python3, interactive, numpy_load_error) {
    invisible(.Call(`_reticulate_py_initialize`, python, libpython, pythonhome, virtualenv_activate, python3, interactive, numpy_load_error))
}

py_finalize <- function() {
    invisible(.Call(`_reticulate_py_finalize`))
}

py_is_none <- function(x) {
    .Call(`_reticulate_py_is_none`, x)
}

py_compare_impl <- function(a, b, op) {
    .Call(`_reticulate_py_compare_impl`, a, b, op)
}

py_str_impl <- function(x) {
    .Call(`_reticulate_py_str_impl`, x)
}

#' @export
#' @rdname py_str
py_repr <- function(object) {
    .Call(`_reticulate_py_repr`, object)
}

py_print <- function(x) {
    invisible(.Call(`_reticulate_py_print`, x))
}

py_is_function <- function(x) {
    .Call(`_reticulate_py_is_function`, x)
}

py_numpy_available_impl <- function() {
    .Call(`_reticulate_py_numpy_available_impl`)
}

py_list_attributes_impl <- function(x) {
    .Call(`_reticulate_py_list_attributes_impl`, x)
}

py_get_convert <- function(x) {
    .Call(`_reticulate_py_get_convert`, x)
}

py_set_convert <- function(x, value) {
    .Call(`_reticulate_py_set_convert`, x, value)
}

py_new_ref <- function(x, convert) {
    .Call(`_reticulate_py_new_ref`, x, convert)
}

#' Check if a Python object has an attribute
#'
#' Check whether a Python object \code{x} has an attribute
#' \code{name}.
#'
#' @param x A python object.
#' @param name The attribute to be accessed.
#'
#' @return \code{TRUE} if the object has the attribute \code{name}, and
#'   \code{FALSE} otherwise.
#' @export
py_has_attr <- function(x, name) {
    .Call(`_reticulate_py_has_attr`, x, name)
}

#' Get an attribute of a Python object
#'
#' @param x Python object
#' @param name Attribute name
#' @param silent \code{TRUE} to return \code{NULL} if the attribute
#'  doesn't exist (default is \code{FALSE} which will raise an error)
#'
#' @return Attribute of Python object
#' @export
py_get_attr <- function(x, name, silent = FALSE) {
    .Call(`_reticulate_py_get_attr`, x, name, silent)
}

#' Set an attribute of a Python object
#'
#' @param x Python object
#' @param name Attribute name
#' @param value Attribute value
#'
#' @export
py_set_attr <- function(x, name, value) {
    invisible(.Call(`_reticulate_py_set_attr`, x, name, value))
}

#' Delete an attribute of a Python object
#'
#' @param x A Python object.
#' @param name The attribute name.
#'
#' @export
py_del_attr <- function(x, name) {
    invisible(.Call(`_reticulate_py_del_attr`, x, name))
}

#' @rdname py_get_item
#' @export
py_get_item <- function(x, key, silent = FALSE) {
    .Call(`_reticulate_py_get_item`, x, key, silent)
}

#' @rdname py_get_item
#' @export
py_set_item <- function(x, key, value) {
    invisible(.Call(`_reticulate_py_set_item`, x, key, value))
}

#' @rdname py_get_item
#' @export
py_del_item <- function(x, key) {
    invisible(.Call(`_reticulate_py_del_item`, x, key))
}

py_get_attr_types <- function(x, attrs, resolve_properties = FALSE) {
    .Call(`_reticulate_py_get_attr_types`, x, attrs, resolve_properties)
}

py_ref_to_r_with_convert <- function(x, convert) {
    .Call(`_reticulate_py_ref_to_r_with_convert`, x, convert)
}

py_ref_to_r <- function(x) {
    .Call(`_reticulate_py_ref_to_r`, x)
}

py_call_impl <- function(x, args = NULL, keywords = NULL) {
    .Call(`_reticulate_py_call_impl`, x, args, keywords)
}

py_dict_impl <- function(keys, items, convert) {
    .Call(`_reticulate_py_dict_impl`, keys, items, convert)
}

py_dict_get_item <- function(dict, key) {
    .Call(`_reticulate_py_dict_get_item`, dict, key)
}

py_dict_set_item <- function(dict, key, val) {
    invisible(.Call(`_reticulate_py_dict_set_item`, dict, key, val))
}

py_dict_length <- function(dict) {
    .Call(`_reticulate_py_dict_length`, dict)
}

py_dict_get_keys <- function(dict) {
    .Call(`_reticulate_py_dict_get_keys`, dict)
}

py_dict_get_keys_as_str <- function(dict) {
    .Call(`_reticulate_py_dict_get_keys_as_str`, dict)
}

py_tuple <- function(items, convert) {
    .Call(`_reticulate_py_tuple`, items, convert)
}

py_tuple_length <- function(tuple) {
    .Call(`_reticulate_py_tuple_length`, tuple)
}

py_module_import <- function(module, convert) {
    .Call(`_reticulate_py_module_import`, module, convert)
}

py_module_proxy_import <- function(proxy) {
    invisible(.Call(`_reticulate_py_module_proxy_import`, proxy))
}

py_list_submodules <- function(module) {
    .Call(`_reticulate_py_list_submodules`, module)
}

py_run_string_impl <- function(code, local = FALSE, convert = TRUE) {
    .Call(`_reticulate_py_run_string_impl`, code, local, convert)
}

py_run_file_impl <- function(file, local = FALSE, convert = TRUE) {
    .Call(`_reticulate_py_run_file_impl`, file, local, convert)
}

py_eval_impl <- function(code, convert = TRUE) {
    .Call(`_reticulate_py_eval_impl`, code, convert)
}

py_convert_pandas_series <- function(series) {
    .Call(`_reticulate_py_convert_pandas_series`, series)
}

py_convert_pandas_df <- function(df) {
    .Call(`_reticulate_py_convert_pandas_df`, df)
}

r_convert_dataframe <- function(dataframe, convert) {
    .Call(`_reticulate_r_convert_dataframe`, dataframe, convert)
}

r_convert_date <- function(dates, convert) {
    .Call(`_reticulate_r_convert_date`, dates, convert)
}

py_list_length <- function(x) {
    .Call(`_reticulate_py_list_length`, x)
}

py_len_impl <- function(x, defaultValue = NULL) {
    .Call(`_reticulate_py_len_impl`, x, defaultValue)
}

py_bool_impl <- function(x, silent = FALSE) {
    .Call(`_reticulate_py_bool_impl`, x, silent)
}

py_has_method <- function(object, name) {
    .Call(`_reticulate_py_has_method`, object, name)
}

#' Unique identifer for Python object
#'
#' Get a globally unique identifier for a Python object.
#'
#' @note In the current implementation of CPython this is the
#'  memory address of the object.
#'
#' @param object Python object
#'
#' @return Unique identifer (as string) or `NULL`
#'
#' @export
py_id <- function(object) {
    .Call(`_reticulate_py_id`, object)
}

py_capsule <- function(x) {
    .Call(`_reticulate_py_capsule`, x)
}

py_slice <- function(start = NULL, stop = NULL, step = NULL) {
    .Call(`_reticulate_py_slice`, start, stop, step)
}

#' @rdname iterate
#' @export
as_iterator <- function(x) {
    .Call(`_reticulate_as_iterator`, x)
}

py_iter_next <- function(iterator, completed) {
    .Call(`_reticulate_py_iter_next`, iterator, completed)
}

py_iterate <- function(x, f, simplify = TRUE) {
    .Call(`_reticulate_py_iterate`, x, f, simplify)
}

py_allow_threads_impl <- function(allow = TRUE) {
    .Call(`_reticulate_py_allow_threads_impl`, allow)
}

readline <- function(prompt) {
    .Call(`_reticulate_readline`, prompt)
}

Try the reticulate package in your browser

Any scripts or data that you put into this service are public.

reticulate documentation built on Sept. 11, 2024, 8:31 p.m.