package pyml

  1. Overview
  2. Docs

Interface for Python values of type Module.

val check : Object.t -> bool

check o returns true if o is a Python module.

val create : string -> Object.t

Wrapper for PyModule_New

val get_dict : Object.t -> Object.t

Wrapper for PyModule_GetDict

val get_filename : Object.t -> string
val get_name : Object.t -> string

Wrapper for PyModule_GetName

val get : Object.t -> string -> Object.t
val get_opt : Object.t -> string -> Object.t option
val get_function : Object.t -> string -> Object.t array -> Object.t

Py.Module.get_function m name is equivalent to Py.Callable.to_function (Py.Module.get m name).

val get_function_opt : Object.t -> string -> (Object.t array -> Object.t) option

Py.Module.get_function_opt is equivalent to Py.Module.get_function but returns None in case of failure.

val get_function_with_keywords : Object.t -> string -> Object.t array -> (string * Object.t) list -> Object.t

Py.Module.get_function_with_keywords m name is equivalent to Py.Callable.to_function_with_keywords (Py.Module.get m name).

val get_function_with_keywords_opt : Object.t -> string -> (Object.t array -> (string * Object.t) list -> Object.t) option

Py.Module.get_function_with_keywords_opt is equivalent to Py.Module.get_function_with_keywords but returns None in case of failure.

val set : Object.t -> string -> Object.t -> unit

Equivalent to Object.set_attr_string.

val set_function : Object.t -> string -> (Object.t array -> Object.t) -> unit

Py.Module.set_function m name f is equivalent to Py.Module.set m name (Py.Callable.of_function f).

val set_function_with_keywords : Object.t -> string -> (Object.t array -> Object.t -> Object.t) -> unit

Py.Module.set_function_with_keywords m name f is equivalent to Py.Module.set m name (Py.Callable.of_function_with_keywords f).

val remove : Object.t -> string -> unit

Equivalent to Object.del_attr_string.

val main : unit -> Object.t

Returns the __main__ module. We have Py.Module.main () = Py.Module.add_module "__main__".

val sys : unit -> Object.t

Returns the sys module. We have Py.Module.sys () = Py.Module.import_module "sys".

val builtins : unit -> Object.t

Returns the __builtins__ module. We have Py.Module.builtins () = Py.Module.find (Py.Module.main ()) "__builtins__".

val set_docstring : Object.t -> string -> unit
OCaml

Innovation. Community. Security.