module Crython::Py2Cr

Overview

Module for converting Python collection objects to Crystal types

Defined in:

crython/py2cr/basic.cr
crython/py2cr/collections.cr

Class Method Summary

Class Method Detail

def self.is_none?(pyobject : PyObject) : Bool #

Check if a Python object is None


[View source]
def self.to_array(pyobject : PyObject, element_type : T.class) : Array(T) forall T #

Convert a Python list to a Crystal Array


[View source]
def self.to_bool(pyobject : PyObject) : Bool #

Convert a Python object to a Crystal Bool


[View source]
def self.to_float64(pyobject : PyObject) : Float64 #

Convert a Python object to a Crystal Float64


[View source]
def self.to_hash(pyobject : PyObject, key_type : K.class, value_type : V.class) : Hash(K, V) forall K, V #

Convert a Python dict to a Crystal Hash


[View source]
def self.to_int32(pyobject : PyObject) : Int32 #

Convert a Python object to a Crystal Int32


[View source]
def self.to_int64(pyobject : PyObject) : Int64 #

Convert a Python object to a Crystal Int64


[View source]
def self.to_string(pyobject : PyObject) : String #

Convert a Python object to a Crystal String


[View source]
def self.to_tuple(pyobject : PyObject, *element_types) : Tuple #

Convert a Python tuple to a Crystal Tuple


[View source]