py_embed library
Classes
- PyBool
- PyConverter
- Converts Dart values to owned Python references.
- PyDict
- A Python dictionary. Keys and values are retained when inserted.
- PyDouble
- 每次构造都会创建独立的 Python 浮点对象,即使值相同也不共享引用计数。 新对象的引用计数为 1,调用方需要分别释放各自的引用。
- PyException
- PyFunction
- A Python callable backed by a synchronous Dart closure.
- PyInt
- CPython 会缓存小整数,相同的缓存值(例如 1)共享底层对象和引用计数。 这不代表所有整数都会共享;每次构造仍取得一个需要由调用方释放的引用。 引用计数的具体变化取决于 CPython 版本,不能假定每次构造都会加一。
- PyList
- PyModule
- PyObject
- PyObjectWrapper
- A Dart object that holds a Python object by composition.
- PyRef
- PyScope
- A synchronous scope created by using.
- PyString
- PyTuple
- tuple
Enums
- PyComparison
- Python rich comparison operation codes.
Extensions
- PyObjectAttributes on PyObject
- PyObjectCall on PyObject
- PyObjectConverter on PyObject
- PyObjectForward on PyObject
- PyObjectOperator on PyObject
- Object results own a new reference; release them with using or PyRef.discrement. Operands retain their existing references. Dart compound assignments use the ordinary operators. Use the inPlace methods explicitly for Python augmented assignment semantics.
- PyObjectWithContext on PyObject
Properties
- pyRuntime → _Runtime
-
final
Functions
-
abs(
PyObject object) → PyObject -
Python
abs(object), preserving custom Python return types. -
ascii(
PyObject object) → PyObject -
divmod(
PyObject a, PyObject b) → PyObject -
Python
divmod(a, b), preserving custom Python return types. -
isInstance(
PyObject object, PyObject classInfo) → bool -
Python
isinstance(object, classInfo), including tuples of types. -
len(
PyObject object) → int -
Python
len(object). Objects without a length raise TypeError. -
newType(
String name, List< PyObject> bases, Map<String, Object?> attributes) → PyObject -
Creates a class with
name,bases, andattributes. -
object(
) → PyObject -
Creates a Python
object()instance owning a new reference. -
pow(
PyObject base, PyObject exponent, [PyObject? modulus]) → PyObject -
Python
pow(base, exponent)orpow(base, exponent, modulus). -
repr(
PyObject object) → String -
Python
repr(object), copied into a Dart string. -
runString(
String code) → void - execute python code
-
str(
PyObject object) → PyObject -
superOf(
PyObject type, PyObject object) → PyObject -
Creates a Python
super(type, object)proxy owning a new reference. -
type(
PyObject object) → PyObject -
Returns the Python type of
object. -
using<
R> (R action(PyScope scope)) → R -
Runs
actionsynchronously and performs registered cleanup in reverse order.
Typedefs
- PyFunctionCallback = PyObject Function(PyTuple args, PyDict? kwargs)
- A synchronous callback receiving borrowed positional and keyword arguments.