# 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, python_major_version, python_minor_version, interactive, numpy_load_error) {
    invisible(.Call(`_reticulate_py_initialize`, python, libpython, pythonhome, virtualenv_activate, python_major_version, python_minor_version, 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 identifier 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 identifier (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)
}
