From ef516055dcbec756c5db74a4ff77e262549caf66 Mon Sep 17 00:00:00 2001 From: zihang Date: Wed, 3 Dec 2025 14:42:14 +0800 Subject: [PATCH 1/2] fix: Replace deprecated @bytes.from_array with Bytes::from_array Co-authored-by: openhands --- cpython/pkg.generated.mbti | 620 ++++++++++++++++++------------------- cpython/utils.mbt | 2 +- dict.mbt | 4 +- pkg.generated.mbti | 240 +++++++------- set.mbt | 1 - time/pkg.generated.mbti | 22 +- tkinter/pkg.generated.mbti | 12 +- turtle/pkg.generated.mbti | 92 +++--- 8 files changed, 496 insertions(+), 497 deletions(-) diff --git a/cpython/pkg.generated.mbti b/cpython/pkg.generated.mbti index 290c4b8..2c64a2a 100644 --- a/cpython/pkg.generated.mbti +++ b/cpython/pkg.generated.mbti @@ -2,601 +2,601 @@ package "Kaida-Amethyst/python/cpython" // Values -fn __py_callable_check(PyObjectRef) -> Int +pub fn __py_callable_check(PyObjectRef) -> Int -fn __py_dict_contains(PyObjectRef, PyObjectRef) -> Int +pub fn __py_dict_contains(PyObjectRef, PyObjectRef) -> Int -fn _py_context_new_hamt_for_tests() -> PyObjectRef +pub fn _py_context_new_hamt_for_tests() -> PyObjectRef -fn print_pyobject(PyObjectRef) -> Unit +pub fn print_pyobject(PyObjectRef) -> Unit -fn py_bool_check(PyObjectRef) -> Bool +pub fn py_bool_check(PyObjectRef) -> Bool -fn py_bool_from_long(Int64) -> PyObjectRef +pub fn py_bool_from_long(Int64) -> PyObjectRef -fn py_call_iter_new(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn py_call_iter_new(PyObjectRef, PyObjectRef) -> PyObjectRef -fn py_callable_check(PyObjectRef) -> Bool +pub fn py_callable_check(PyObjectRef) -> Bool -fn py_cell_get(PyObjectRef) -> PyObjectRef +pub fn py_cell_get(PyObjectRef) -> PyObjectRef -fn py_cell_new(PyObjectRef) -> PyObjectRef +pub fn py_cell_new(PyObjectRef) -> PyObjectRef -fn py_cell_set(PyObjectRef, PyObjectRef) -> Int +pub fn py_cell_set(PyObjectRef, PyObjectRef) -> Int -fn py_class_method_new(PyObjectRef) -> PyObjectRef +pub fn py_class_method_new(PyObjectRef) -> PyObjectRef -fn py_code_addr2_line(PyCodeObjectRef, Int) -> Int +pub fn py_code_addr2_line(PyCodeObjectRef, Int) -> Int -fn py_code_new(Int, Int, Int, Int, Int, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, Int, PyObjectRef) -> PyCodeObjectRef +pub fn py_code_new(Int, Int, Int, Int, Int, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, Int, PyObjectRef) -> PyCodeObjectRef -fn py_code_new_empty(CStr, CStr, Int) -> PyCodeObjectRef +pub fn py_code_new_empty(CStr, CStr, Int) -> PyCodeObjectRef -fn py_code_new_with_pos_only_args(Int, Int, Int, Int, Int, Int, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, Int, PyObjectRef) -> PyCodeObjectRef +pub fn py_code_new_with_pos_only_args(Int, Int, Int, Int, Int, Int, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, Int, PyObjectRef) -> PyCodeObjectRef -fn py_codec_backslash_replace_errors(PyObjectRef) -> PyObjectRef +pub fn py_codec_backslash_replace_errors(PyObjectRef) -> PyObjectRef -fn py_codec_decode(PyObjectRef, CStr, CStr) -> PyObjectRef +pub fn py_codec_decode(PyObjectRef, CStr, CStr) -> PyObjectRef -fn py_codec_decoder(CStr) -> PyObjectRef +pub fn py_codec_decoder(CStr) -> PyObjectRef -fn py_codec_encode(PyObjectRef, CStr, CStr) -> PyObjectRef +pub fn py_codec_encode(PyObjectRef, CStr, CStr) -> PyObjectRef -fn py_codec_encoder(CStr) -> PyObjectRef +pub fn py_codec_encoder(CStr) -> PyObjectRef -fn py_codec_ignore_errors(PyObjectRef) -> PyObjectRef +pub fn py_codec_ignore_errors(PyObjectRef) -> PyObjectRef -fn py_codec_incremental_decoder(CStr, CStr) -> PyObjectRef +pub fn py_codec_incremental_decoder(CStr, CStr) -> PyObjectRef -fn py_codec_incremental_encoder(CStr, CStr) -> PyObjectRef +pub fn py_codec_incremental_encoder(CStr, CStr) -> PyObjectRef -fn py_codec_known_encoding(CStr) -> Int +pub fn py_codec_known_encoding(CStr) -> Int -fn py_codec_lookup_error(CStr) -> PyObjectRef +pub fn py_codec_lookup_error(CStr) -> PyObjectRef -fn py_codec_name_replace_errors(PyObjectRef) -> PyObjectRef +pub fn py_codec_name_replace_errors(PyObjectRef) -> PyObjectRef -fn py_codec_register(PyObjectRef) -> Int +pub fn py_codec_register(PyObjectRef) -> Int -fn py_codec_register_error(CStr, PyObjectRef) -> Int +pub fn py_codec_register_error(CStr, PyObjectRef) -> Int -fn py_codec_replace_errors(PyObjectRef) -> PyObjectRef +pub fn py_codec_replace_errors(PyObjectRef) -> PyObjectRef -fn py_codec_stream_reader(CStr, PyObjectRef, CStr) -> PyObjectRef +pub fn py_codec_stream_reader(CStr, PyObjectRef, CStr) -> PyObjectRef -fn py_codec_stream_writer(CStr, PyObjectRef, CStr) -> PyObjectRef +pub fn py_codec_stream_writer(CStr, PyObjectRef, CStr) -> PyObjectRef -fn py_codec_strict_errors(PyObjectRef) -> PyObjectRef +pub fn py_codec_strict_errors(PyObjectRef) -> PyObjectRef -fn py_codec_xml_char_ref_replace_errors(PyObjectRef) -> PyObjectRef +pub fn py_codec_xml_char_ref_replace_errors(PyObjectRef) -> PyObjectRef -fn py_complex_from_doubles(Double, Double) -> PyObjectRef +pub fn py_complex_from_doubles(Double, Double) -> PyObjectRef -fn py_complex_imag_as_double(PyObjectRef) -> Double +pub fn py_complex_imag_as_double(PyObjectRef) -> Double -fn py_complex_real_as_double(PyObjectRef) -> Double +pub fn py_complex_real_as_double(PyObjectRef) -> Double -fn py_context_clear_free_list() -> Int +pub fn py_context_clear_free_list() -> Int -fn py_context_copy(PyObjectRef) -> PyObjectRef +pub fn py_context_copy(PyObjectRef) -> PyObjectRef -fn py_context_copy_current() -> PyObjectRef +pub fn py_context_copy_current() -> PyObjectRef -fn py_context_enter(PyObjectRef) -> Int +pub fn py_context_enter(PyObjectRef) -> Int -fn py_context_exit(PyObjectRef) -> Int +pub fn py_context_exit(PyObjectRef) -> Int -fn py_context_new() -> PyObjectRef +pub fn py_context_new() -> PyObjectRef -fn py_context_var_get(PyObjectRef, PyObjectRef, ArrayPyObjectRef) -> Int +pub fn py_context_var_get(PyObjectRef, PyObjectRef, ArrayPyObjectRef) -> Int -fn py_context_var_new(CStr, PyObjectRef) -> PyObjectRef +pub fn py_context_var_new(CStr, PyObjectRef) -> PyObjectRef -fn py_context_var_reset(PyObjectRef, PyObjectRef) -> Int +pub fn py_context_var_reset(PyObjectRef, PyObjectRef) -> Int -fn py_context_var_set(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn py_context_var_set(PyObjectRef, PyObjectRef) -> PyObjectRef -fn py_decref(PyObjectRef) -> Unit +pub fn py_decref(PyObjectRef) -> Unit -fn py_dict_check(PyObjectRef) -> Bool +pub fn py_dict_check(PyObjectRef) -> Bool -fn py_dict_clear(PyObjectRef) -> Unit +pub fn py_dict_clear(PyObjectRef) -> Unit -fn py_dict_contains(PyObjectRef, PyObjectRef) -> Bool +pub fn py_dict_contains(PyObjectRef, PyObjectRef) -> Bool -fn py_dict_copy(PyObjectRef) -> PyObjectRef +pub fn py_dict_copy(PyObjectRef) -> PyObjectRef -fn py_dict_del_item(PyObjectRef, PyObjectRef) -> Int +pub fn py_dict_del_item(PyObjectRef, PyObjectRef) -> Int -fn py_dict_del_item_string(PyObjectRef, String) -> Int +pub fn py_dict_del_item_string(PyObjectRef, String) -> Int -fn py_dict_get_item(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn py_dict_get_item(PyObjectRef, PyObjectRef) -> PyObjectRef -fn py_dict_get_item_string(PyObjectRef, String) -> PyObjectRef +pub fn py_dict_get_item_string(PyObjectRef, String) -> PyObjectRef -fn py_dict_items(PyObjectRef) -> PyObjectRef +pub fn py_dict_items(PyObjectRef) -> PyObjectRef -fn py_dict_keys(PyObjectRef) -> PyObjectRef +pub fn py_dict_keys(PyObjectRef) -> PyObjectRef -fn py_dict_merge(PyObjectRef, PyObjectRef, Int) -> Int +pub fn py_dict_merge(PyObjectRef, PyObjectRef, Int) -> Int -fn py_dict_merge_from_seq2(PyObjectRef, PyObjectRef, Int) -> Int +pub fn py_dict_merge_from_seq2(PyObjectRef, PyObjectRef, Int) -> Int -fn py_dict_new() -> PyObjectRef +pub fn py_dict_new() -> PyObjectRef -fn py_dict_set_item(PyObjectRef, PyObjectRef, PyObjectRef) -> Int +pub fn py_dict_set_item(PyObjectRef, PyObjectRef, PyObjectRef) -> Int -fn py_dict_set_item_string(PyObjectRef, String, PyObjectRef) -> Int +pub fn py_dict_set_item_string(PyObjectRef, String, PyObjectRef) -> Int -fn py_dict_size(PyObjectRef) -> UInt64 +pub fn py_dict_size(PyObjectRef) -> UInt64 -fn py_dict_update(PyObjectRef, PyObjectRef) -> Int +pub fn py_dict_update(PyObjectRef, PyObjectRef) -> Int -fn py_dict_values(PyObjectRef) -> PyObjectRef +pub fn py_dict_values(PyObjectRef) -> PyObjectRef -fn py_err_clear() -> Unit +pub fn py_err_clear() -> Unit -fn py_err_occurred() -> PyObjectRef +pub fn py_err_occurred() -> PyObjectRef -fn py_err_print() -> Unit +pub fn py_err_print() -> Unit -fn py_eval_acquire_thread(PyThreadStateRef) -> Unit +pub fn py_eval_acquire_thread(PyThreadStateRef) -> Unit -fn py_eval_call_object_with_keywords(PyObjectRef, PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn py_eval_call_object_with_keywords(PyObjectRef, PyObjectRef, PyObjectRef) -> PyObjectRef -fn py_eval_eval_code(PyObjectRef, PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn py_eval_eval_code(PyObjectRef, PyObjectRef, PyObjectRef) -> PyObjectRef -fn py_eval_get_builtins() -> PyObjectRef +pub fn py_eval_get_builtins() -> PyObjectRef -fn py_eval_get_func_desc(PyObjectRef) -> CStr +pub fn py_eval_get_func_desc(PyObjectRef) -> CStr -fn py_eval_get_func_name(PyObjectRef) -> CStr +pub fn py_eval_get_func_name(PyObjectRef) -> CStr -fn py_eval_get_globals() -> PyObjectRef +pub fn py_eval_get_globals() -> PyObjectRef -fn py_eval_get_locals() -> PyObjectRef +pub fn py_eval_get_locals() -> PyObjectRef -fn py_eval_init_threads() -> Unit +pub fn py_eval_init_threads() -> Unit -fn py_eval_release_thread(PyThreadStateRef) -> Unit +pub fn py_eval_release_thread(PyThreadStateRef) -> Unit -fn py_eval_restore_thread(PyThreadStateRef) -> Unit +pub fn py_eval_restore_thread(PyThreadStateRef) -> Unit -fn py_eval_save_thread() -> PyThreadStateRef +pub fn py_eval_save_thread() -> PyThreadStateRef -fn py_eval_threads_initialized() -> Int +pub fn py_eval_threads_initialized() -> Int -fn py_file_from_fd(Int, CStr, CStr, Int, CStr, CStr, CStr, Int) -> PyObjectRef +pub fn py_file_from_fd(Int, CStr, CStr, Int, CStr, CStr, CStr, Int) -> PyObjectRef -fn py_file_get_line(PyObjectRef, Int) -> PyObjectRef +pub fn py_file_get_line(PyObjectRef, Int) -> PyObjectRef -fn py_file_new_std_printer(Int) -> PyObjectRef +pub fn py_file_new_std_printer(Int) -> PyObjectRef -fn py_file_open_code(CStr) -> PyObjectRef +pub fn py_file_open_code(CStr) -> PyObjectRef -fn py_file_open_code_object(PyObjectRef) -> PyObjectRef +pub fn py_file_open_code_object(PyObjectRef) -> PyObjectRef -fn py_file_write_object(PyObjectRef, PyObjectRef, Int) -> Int +pub fn py_file_write_object(PyObjectRef, PyObjectRef, Int) -> Int -fn py_file_write_string(CStr, PyObjectRef) -> Int +pub fn py_file_write_string(CStr, PyObjectRef) -> Int -fn py_finalize() -> Unit +pub fn py_finalize() -> Unit -fn py_float_as_double(PyObjectRef) -> Double +pub fn py_float_as_double(PyObjectRef) -> Double -fn py_float_check(PyObjectRef) -> Bool +pub fn py_float_check(PyObjectRef) -> Bool -fn py_float_from_double(Double) -> PyObjectRef +pub fn py_float_from_double(Double) -> PyObjectRef -fn py_float_from_string(PyObjectRef) -> PyObjectRef +pub fn py_float_from_string(PyObjectRef) -> PyObjectRef -fn py_float_get_info() -> PyObjectRef +pub fn py_float_get_info() -> PyObjectRef -fn py_float_get_max() -> Double +pub fn py_float_get_max() -> Double -fn py_float_get_min() -> Double +pub fn py_float_get_min() -> Double -fn py_frozen_set_new(PyObjectRef) -> PyObjectRef +pub fn py_frozen_set_new(PyObjectRef) -> PyObjectRef -fn py_function_check(PyObjectRef) -> Bool +pub fn py_function_check(PyObjectRef) -> Bool -fn py_function_get_annotations(PyObjectRef) -> PyObjectRef +pub fn py_function_get_annotations(PyObjectRef) -> PyObjectRef -fn py_function_get_closure(PyObjectRef) -> PyObjectRef +pub fn py_function_get_closure(PyObjectRef) -> PyObjectRef -fn py_function_get_code(PyObjectRef) -> PyObjectRef +pub fn py_function_get_code(PyObjectRef) -> PyObjectRef -fn py_function_get_defaults(PyObjectRef) -> PyObjectRef +pub fn py_function_get_defaults(PyObjectRef) -> PyObjectRef -fn py_function_get_globals(PyObjectRef) -> PyObjectRef +pub fn py_function_get_globals(PyObjectRef) -> PyObjectRef -fn py_function_get_kw_defaults(PyObjectRef) -> PyObjectRef +pub fn py_function_get_kw_defaults(PyObjectRef) -> PyObjectRef -fn py_function_get_module(PyObjectRef) -> PyObjectRef +pub fn py_function_get_module(PyObjectRef) -> PyObjectRef -fn py_function_new(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn py_function_new(PyObjectRef, PyObjectRef) -> PyObjectRef -fn py_function_new_with_qual_name(PyObjectRef, PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn py_function_new_with_qual_name(PyObjectRef, PyObjectRef, PyObjectRef) -> PyObjectRef -fn py_function_set_annotations(PyObjectRef, PyObjectRef) -> Int +pub fn py_function_set_annotations(PyObjectRef, PyObjectRef) -> Int -fn py_function_set_closure(PyObjectRef, PyObjectRef) -> Int +pub fn py_function_set_closure(PyObjectRef, PyObjectRef) -> Int -fn py_function_set_defaults(PyObjectRef, PyObjectRef) -> Int +pub fn py_function_set_defaults(PyObjectRef, PyObjectRef) -> Int -fn py_function_set_kw_defaults(PyObjectRef, PyObjectRef) -> Int +pub fn py_function_set_kw_defaults(PyObjectRef, PyObjectRef) -> Int -fn py_get_recursion_limit() -> Int +pub fn py_get_recursion_limit() -> Int -fn py_import_add_module(CStr) -> PyObjectRef +pub fn py_import_add_module(CStr) -> PyObjectRef -fn py_import_add_module_object(PyObjectRef) -> PyObjectRef +pub fn py_import_add_module_object(PyObjectRef) -> PyObjectRef -fn py_import_cleanup() -> Unit +pub fn py_import_cleanup() -> Unit -fn py_import_exec_code_module(CStr, PyObjectRef) -> PyObjectRef +pub fn py_import_exec_code_module(CStr, PyObjectRef) -> PyObjectRef -fn py_import_exec_code_module_ex(CStr, PyObjectRef, CStr) -> PyObjectRef +pub fn py_import_exec_code_module_ex(CStr, PyObjectRef, CStr) -> PyObjectRef -fn py_import_exec_code_module_object(PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn py_import_exec_code_module_object(PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef) -> PyObjectRef -fn py_import_exec_code_module_with_pathnames(CStr, PyObjectRef, CStr, CStr) -> PyObjectRef +pub fn py_import_exec_code_module_with_pathnames(CStr, PyObjectRef, CStr, CStr) -> PyObjectRef -fn py_import_get_importer(PyObjectRef) -> PyObjectRef +pub fn py_import_get_importer(PyObjectRef) -> PyObjectRef -fn py_import_get_magic_number() -> Int +pub fn py_import_get_magic_number() -> Int -fn py_import_get_magic_tag() -> CStr +pub fn py_import_get_magic_tag() -> CStr -fn py_import_get_module(PyObjectRef) -> PyObjectRef +pub fn py_import_get_module(PyObjectRef) -> PyObjectRef -fn py_import_get_module_dict() -> PyObjectRef +pub fn py_import_get_module_dict() -> PyObjectRef -fn py_import_import(PyObjectRef) -> PyObjectRef +pub fn py_import_import(PyObjectRef) -> PyObjectRef -fn py_import_import_frozen_module(CStr) -> Int +pub fn py_import_import_frozen_module(CStr) -> Int -fn py_import_import_frozen_module_object(PyObjectRef) -> Int +pub fn py_import_import_frozen_module_object(PyObjectRef) -> Int -fn py_import_import_module(String) -> PyObjectRef +pub fn py_import_import_module(String) -> PyObjectRef -fn py_import_import_module_level(CStr, PyObjectRef, PyObjectRef, PyObjectRef, Int) -> PyObjectRef +pub fn py_import_import_module_level(CStr, PyObjectRef, PyObjectRef, PyObjectRef, Int) -> PyObjectRef -fn py_import_import_module_level_object(PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, Int) -> PyObjectRef +pub fn py_import_import_module_level_object(PyObjectRef, PyObjectRef, PyObjectRef, PyObjectRef, Int) -> PyObjectRef -fn py_import_import_module_no_block(CStr) -> PyObjectRef +pub fn py_import_import_module_no_block(CStr) -> PyObjectRef -fn py_import_reload_module(PyObjectRef) -> PyObjectRef +pub fn py_import_reload_module(PyObjectRef) -> PyObjectRef -fn py_incref(PyObjectRef) -> Unit +pub fn py_incref(PyObjectRef) -> Unit -fn py_init() -> Unit +pub fn py_init() -> Unit -fn py_instance_method_function(PyObjectRef) -> PyObjectRef +pub fn py_instance_method_function(PyObjectRef) -> PyObjectRef -fn py_instance_method_new(PyObjectRef) -> PyObjectRef +pub fn py_instance_method_new(PyObjectRef) -> PyObjectRef -fn py_int_check(PyObjectRef) -> Bool +pub fn py_int_check(PyObjectRef) -> Bool -fn py_is_initialized() -> Bool +pub fn py_is_initialized() -> Bool -fn py_list_append(PyObjectRef, PyObjectRef) -> Int +pub fn py_list_append(PyObjectRef, PyObjectRef) -> Int -fn py_list_as_tuple(PyObjectRef) -> PyObjectRef +pub fn py_list_as_tuple(PyObjectRef) -> PyObjectRef -fn py_list_check(PyObjectRef) -> Bool +pub fn py_list_check(PyObjectRef) -> Bool -fn py_list_get_item(PyObjectRef, Int64) -> PyObjectRef +pub fn py_list_get_item(PyObjectRef, Int64) -> PyObjectRef -fn py_list_get_slice(PyObjectRef, Int64, Int64) -> PyObjectRef +pub fn py_list_get_slice(PyObjectRef, Int64, Int64) -> PyObjectRef -fn py_list_insert(PyObjectRef, Int64, PyObjectRef) -> Int +pub fn py_list_insert(PyObjectRef, Int64, PyObjectRef) -> Int -fn py_list_new(Int64) -> PyObjectRef +pub fn py_list_new(Int64) -> PyObjectRef -fn py_list_reverse(PyObjectRef) -> Int +pub fn py_list_reverse(PyObjectRef) -> Int -fn py_list_set_item(PyObjectRef, Int64, PyObjectRef) -> Int +pub fn py_list_set_item(PyObjectRef, Int64, PyObjectRef) -> Int -fn py_list_set_slice(PyObjectRef, Int64, Int64, PyObjectRef) -> Int +pub fn py_list_set_slice(PyObjectRef, Int64, Int64, PyObjectRef) -> Int -fn py_list_size(PyObjectRef) -> Int64 +pub fn py_list_size(PyObjectRef) -> Int64 -fn py_list_sort(PyObjectRef) -> Int +pub fn py_list_sort(PyObjectRef) -> Int -fn py_long_as_double(PyObjectRef) -> Double +pub fn py_long_as_double(PyObjectRef) -> Double -fn py_long_as_long(PyObjectRef) -> Int64 +pub fn py_long_as_long(PyObjectRef) -> Int64 -fn py_long_from_long(Int64) -> PyObjectRef +pub fn py_long_from_long(Int64) -> PyObjectRef -fn py_make_pending_calls() -> Int +pub fn py_make_pending_calls() -> Int -fn py_method_clear_free_list() -> Int +pub fn py_method_clear_free_list() -> Int -fn py_method_function(PyObjectRef) -> PyObjectRef +pub fn py_method_function(PyObjectRef) -> PyObjectRef -fn py_method_new(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn py_method_new(PyObjectRef, PyObjectRef) -> PyObjectRef -fn py_method_self(PyObjectRef) -> PyObjectRef +pub fn py_method_self(PyObjectRef) -> PyObjectRef -fn py_module_check(PyObjectRef) -> Bool +pub fn py_module_check(PyObjectRef) -> Bool -fn py_module_get_dict(PyObjectRef) -> PyObjectRef +pub fn py_module_get_dict(PyObjectRef) -> PyObjectRef -fn py_module_get_filename_object(PyObjectRef) -> PyObjectRef +pub fn py_module_get_filename_object(PyObjectRef) -> PyObjectRef -fn py_module_get_name(PyObjectRef) -> CStr +pub fn py_module_get_name(PyObjectRef) -> CStr -fn py_module_get_name_object(PyObjectRef) -> PyObjectRef +pub fn py_module_get_name_object(PyObjectRef) -> PyObjectRef -fn py_module_new(CStr) -> PyObjectRef +pub fn py_module_new(CStr) -> PyObjectRef -fn py_module_new_object(PyObjectRef) -> PyObjectRef +pub fn py_module_new_object(PyObjectRef) -> PyObjectRef -fn py_none_check(PyObjectRef) -> Bool +pub fn py_none_check(PyObjectRef) -> Bool -fn py_object_as_file_descriptor(PyObjectRef) -> Int +pub fn py_object_as_file_descriptor(PyObjectRef) -> Int -fn py_object_ascii(PyObjectRef) -> PyObjectRef +pub fn py_object_ascii(PyObjectRef) -> PyObjectRef -fn py_object_bytes(PyObjectRef) -> PyObjectRef +pub fn py_object_bytes(PyObjectRef) -> PyObjectRef -fn py_object_call(PyObjectRef, PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn py_object_call(PyObjectRef, PyObjectRef, PyObjectRef) -> PyObjectRef -fn py_object_call_object(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn py_object_call_object(PyObjectRef, PyObjectRef) -> PyObjectRef -fn py_object_clear_weak_refs(PyObjectRef) -> Unit +pub fn py_object_clear_weak_refs(PyObjectRef) -> Unit -fn py_object_del_item(PyObjectRef, PyObjectRef) -> Int +pub fn py_object_del_item(PyObjectRef, PyObjectRef) -> Int -fn py_object_del_item_string(PyObjectRef, CStr) -> Int +pub fn py_object_del_item_string(PyObjectRef, CStr) -> Int -fn py_object_dir(PyObjectRef) -> PyObjectRef +pub fn py_object_dir(PyObjectRef) -> PyObjectRef -fn py_object_generic_get_attr(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn py_object_generic_get_attr(PyObjectRef, PyObjectRef) -> PyObjectRef -fn py_object_generic_set_attr(PyObjectRef, PyObjectRef, PyObjectRef) -> Int +pub fn py_object_generic_set_attr(PyObjectRef, PyObjectRef, PyObjectRef) -> Int -fn py_object_get_attr(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn py_object_get_attr(PyObjectRef, PyObjectRef) -> PyObjectRef -fn py_object_get_attr_string(PyObjectRef, String) -> PyObjectRef +pub fn py_object_get_attr_string(PyObjectRef, String) -> PyObjectRef -fn py_object_get_item(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn py_object_get_item(PyObjectRef, PyObjectRef) -> PyObjectRef -fn py_object_get_iter(PyObjectRef) -> PyObjectRef +pub fn py_object_get_iter(PyObjectRef) -> PyObjectRef -fn py_object_has_attr(PyObjectRef, PyObjectRef) -> Int +pub fn py_object_has_attr(PyObjectRef, PyObjectRef) -> Int -fn py_object_has_attr_string(PyObjectRef, String) -> Int +pub fn py_object_has_attr_string(PyObjectRef, String) -> Int -fn py_object_is_instance(PyObjectRef, PyObjectRef) -> Int +pub fn py_object_is_instance(PyObjectRef, PyObjectRef) -> Int -fn py_object_is_subclass(PyObjectRef, PyObjectRef) -> Int +pub fn py_object_is_subclass(PyObjectRef, PyObjectRef) -> Int -fn py_object_is_true(PyObjectRef) -> Bool +pub fn py_object_is_true(PyObjectRef) -> Bool -fn py_object_moonbit_repr(PyObjectRef) -> String +pub fn py_object_moonbit_repr(PyObjectRef) -> String -fn py_object_moonbit_str(PyObjectRef) -> String +pub fn py_object_moonbit_str(PyObjectRef) -> String -fn py_object_not(PyObjectRef) -> Int +pub fn py_object_not(PyObjectRef) -> Int -fn py_object_repr(PyObjectRef) -> PyObjectRef +pub fn py_object_repr(PyObjectRef) -> PyObjectRef -fn py_object_rich_compare(PyObjectRef, PyObjectRef, Int) -> PyObjectRef +pub fn py_object_rich_compare(PyObjectRef, PyObjectRef, Int) -> PyObjectRef -fn py_object_rich_compare_bool(PyObjectRef, PyObjectRef, Int) -> Int +pub fn py_object_rich_compare_bool(PyObjectRef, PyObjectRef, Int) -> Int -fn py_object_self_iter(PyObjectRef) -> PyObjectRef +pub fn py_object_self_iter(PyObjectRef) -> PyObjectRef -fn py_object_set_attr(PyObjectRef, PyObjectRef, PyObjectRef) -> Int +pub fn py_object_set_attr(PyObjectRef, PyObjectRef, PyObjectRef) -> Int -fn py_object_set_attr_string(PyObjectRef, String, PyObjectRef) -> Int +pub fn py_object_set_attr_string(PyObjectRef, String, PyObjectRef) -> Int -fn py_object_set_item(PyObjectRef, PyObjectRef, PyObjectRef) -> Int +pub fn py_object_set_item(PyObjectRef, PyObjectRef, PyObjectRef) -> Int -fn py_object_size(PyObjectRef) -> UInt64 +pub fn py_object_size(PyObjectRef) -> UInt64 -fn py_object_str(PyObjectRef) -> PyObjectRef +pub fn py_object_str(PyObjectRef) -> PyObjectRef -fn py_object_type(PyObjectRef) -> PyObjectRef +pub fn py_object_type(PyObjectRef) -> PyObjectRef -fn py_odict_del_item(PyObjectRef, PyObjectRef) -> Int +pub fn py_odict_del_item(PyObjectRef, PyObjectRef) -> Int -fn py_odict_new() -> PyObjectRef +pub fn py_odict_new() -> PyObjectRef -fn py_odict_set_item(PyObjectRef, PyObjectRef, PyObjectRef) -> Int +pub fn py_odict_set_item(PyObjectRef, PyObjectRef, PyObjectRef) -> Int -fn py_repr_enter(PyObjectRef) -> Int +pub fn py_repr_enter(PyObjectRef) -> Int -fn py_repr_leave(PyObjectRef) -> Unit +pub fn py_repr_leave(PyObjectRef) -> Unit -fn py_seq_iter_new(PyObjectRef) -> PyObjectRef +pub fn py_seq_iter_new(PyObjectRef) -> PyObjectRef -fn py_set_add(PyObjectRef, PyObjectRef) -> Int +pub fn py_set_add(PyObjectRef, PyObjectRef) -> Int -fn py_set_check(PyObjectRef) -> Bool +pub fn py_set_check(PyObjectRef) -> Bool -fn py_set_clear(PyObjectRef) -> Int +pub fn py_set_clear(PyObjectRef) -> Int -fn py_set_contains(PyObjectRef, PyObjectRef) -> Int +pub fn py_set_contains(PyObjectRef, PyObjectRef) -> Int -fn py_set_discard(PyObjectRef, PyObjectRef) -> Int +pub fn py_set_discard(PyObjectRef, PyObjectRef) -> Int -fn py_set_new(PyObjectRef) -> PyObjectRef +pub fn py_set_new(PyObjectRef) -> PyObjectRef -fn py_set_pop(PyObjectRef) -> PyObjectRef +pub fn py_set_pop(PyObjectRef) -> PyObjectRef -fn py_set_recursion_limit(Int) -> Unit +pub fn py_set_recursion_limit(Int) -> Unit -fn py_set_size(PyObjectRef) -> Int64 +pub fn py_set_size(PyObjectRef) -> Int64 -fn py_static_method_new(PyObjectRef) -> PyObjectRef +pub fn py_static_method_new(PyObjectRef) -> PyObjectRef -fn py_string_check(PyObjectRef) -> Bool +pub fn py_string_check(PyObjectRef) -> Bool -fn py_tuple_check(PyObjectRef) -> Bool +pub fn py_tuple_check(PyObjectRef) -> Bool -fn py_type(PyObjectRef) -> PyTypeObjectRef +pub fn py_type(PyObjectRef) -> PyTypeObjectRef -fn py_type_name(PyTypeObjectRef) -> String +pub fn py_type_name(PyTypeObjectRef) -> String -fn py_unicode_as_moonbit_string(PyObjectRef) -> String +pub fn py_unicode_as_moonbit_string(PyObjectRef) -> String -fn py_unicode_as_utf16_string(PyObjectRef) -> PyObjectRef +pub fn py_unicode_as_utf16_string(PyObjectRef) -> PyObjectRef -fn py_unicode_as_utf8(PyObjectRef) -> String +pub fn py_unicode_as_utf8(PyObjectRef) -> String -fn py_unicode_from_moonbit_string(String) -> PyObjectRef +pub fn py_unicode_from_moonbit_string(String) -> PyObjectRef -fn py_unicode_from_string(String) -> PyObjectRef +pub fn py_unicode_from_string(String) -> PyObjectRef -fn py_unicode_from_string_and_size(CStr, UInt64) -> PyObjectRef +pub fn py_unicode_from_string_and_size(CStr, UInt64) -> PyObjectRef -fn py_unicode_from_unicode(CWStr, UInt64) -> PyObjectRef +pub fn py_unicode_from_unicode(CWStr, UInt64) -> PyObjectRef -fn pyindex_check(PyObjectRef) -> Int +pub fn pyindex_check(PyObjectRef) -> Int -fn pyiter_check(PyObjectRef) -> Int +pub fn pyiter_check(PyObjectRef) -> Int -fn pyiter_next(PyObjectRef) -> PyObjectRef +pub fn pyiter_next(PyObjectRef) -> PyObjectRef -fn pymapping_check(PyObjectRef) -> Int +pub fn pymapping_check(PyObjectRef) -> Int -fn pymapping_get_item_string(PyObjectRef, CStr) -> PyObjectRef +pub fn pymapping_get_item_string(PyObjectRef, CStr) -> PyObjectRef -fn pymapping_has_key(PyObjectRef, PyObjectRef) -> Int +pub fn pymapping_has_key(PyObjectRef, PyObjectRef) -> Int -fn pymapping_has_key_string(PyObjectRef, CStr) -> Int +pub fn pymapping_has_key_string(PyObjectRef, CStr) -> Int -fn pymapping_items(PyObjectRef) -> PyObjectRef +pub fn pymapping_items(PyObjectRef) -> PyObjectRef -fn pymapping_keys(PyObjectRef) -> PyObjectRef +pub fn pymapping_keys(PyObjectRef) -> PyObjectRef -fn pymapping_set_item_string(PyObjectRef, CStr, PyObjectRef) -> Int +pub fn pymapping_set_item_string(PyObjectRef, CStr, PyObjectRef) -> Int -fn pymapping_size(PyObjectRef) -> Int +pub fn pymapping_size(PyObjectRef) -> Int -fn pymapping_values(PyObjectRef) -> PyObjectRef +pub fn pymapping_values(PyObjectRef) -> PyObjectRef -fn pynumber_absolute(PyObjectRef) -> PyObjectRef +pub fn pynumber_absolute(PyObjectRef) -> PyObjectRef -fn pynumber_add(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_add(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_and(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_and(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_as_ssize_t(PyObjectRef, PyObjectRef) -> Int +pub fn pynumber_as_ssize_t(PyObjectRef, PyObjectRef) -> Int -fn pynumber_check(PyObjectRef) -> Int +pub fn pynumber_check(PyObjectRef) -> Int -fn pynumber_divmod(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_divmod(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_float(PyObjectRef) -> PyObjectRef +pub fn pynumber_float(PyObjectRef) -> PyObjectRef -fn pynumber_floor_divide(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_floor_divide(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_index(PyObjectRef) -> PyObjectRef +pub fn pynumber_index(PyObjectRef) -> PyObjectRef -fn pynumber_inplace_add(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_inplace_add(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_inplace_and(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_inplace_and(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_inplace_floor_divide(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_inplace_floor_divide(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_inplace_lshift(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_inplace_lshift(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_inplace_multiply(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_inplace_multiply(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_inplace_or(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_inplace_or(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_inplace_power(PyObjectRef, PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_inplace_power(PyObjectRef, PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_inplace_remainder(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_inplace_remainder(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_inplace_rshift(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_inplace_rshift(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_inplace_subtract(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_inplace_subtract(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_inplace_true_divide(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_inplace_true_divide(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_inplace_xor(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_inplace_xor(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_invert(PyObjectRef) -> PyObjectRef +pub fn pynumber_invert(PyObjectRef) -> PyObjectRef -fn pynumber_long(PyObjectRef) -> PyObjectRef +pub fn pynumber_long(PyObjectRef) -> PyObjectRef -fn pynumber_lshift(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_lshift(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_multiply(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_multiply(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_negative(PyObjectRef) -> PyObjectRef +pub fn pynumber_negative(PyObjectRef) -> PyObjectRef -fn pynumber_or(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_or(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_positive(PyObjectRef) -> PyObjectRef +pub fn pynumber_positive(PyObjectRef) -> PyObjectRef -fn pynumber_power(PyObjectRef, PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_power(PyObjectRef, PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_remainder(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_remainder(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_rshift(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_rshift(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_subtract(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_subtract(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_to_base(PyObjectRef, Int) -> PyObjectRef +pub fn pynumber_to_base(PyObjectRef, Int) -> PyObjectRef -fn pynumber_true_divide(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_true_divide(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pynumber_xor(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pynumber_xor(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pyobkect_format(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pyobkect_format(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pysequence_check(PyObjectRef) -> Int +pub fn pysequence_check(PyObjectRef) -> Int -fn pysequence_concat(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pysequence_concat(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pysequence_contains(PyObjectRef, PyObjectRef) -> Int +pub fn pysequence_contains(PyObjectRef, PyObjectRef) -> Int -fn pysequence_count(PyObjectRef, PyObjectRef) -> Int +pub fn pysequence_count(PyObjectRef, PyObjectRef) -> Int -fn pysequence_del_item(PyObjectRef, UInt64) -> Int +pub fn pysequence_del_item(PyObjectRef, UInt64) -> Int -fn pysequence_del_slice(PyObjectRef, UInt64, UInt64) -> Int +pub fn pysequence_del_slice(PyObjectRef, UInt64, UInt64) -> Int -fn pysequence_fast(PyObjectRef, CStr) -> PyObjectRef +pub fn pysequence_fast(PyObjectRef, CStr) -> PyObjectRef -fn pysequence_get_item(PyObjectRef, UInt64) -> PyObjectRef +pub fn pysequence_get_item(PyObjectRef, UInt64) -> PyObjectRef -fn pysequence_get_slice(PyObjectRef, UInt64, UInt64) -> PyObjectRef +pub fn pysequence_get_slice(PyObjectRef, UInt64, UInt64) -> PyObjectRef -fn pysequence_index(PyObjectRef, PyObjectRef) -> Int +pub fn pysequence_index(PyObjectRef, PyObjectRef) -> Int -fn pysequence_inplace_concat(PyObjectRef, PyObjectRef) -> PyObjectRef +pub fn pysequence_inplace_concat(PyObjectRef, PyObjectRef) -> PyObjectRef -fn pysequence_inplace_repeat(PyObjectRef, Int) -> PyObjectRef +pub fn pysequence_inplace_repeat(PyObjectRef, Int) -> PyObjectRef -fn pysequence_list(PyObjectRef) -> PyObjectRef +pub fn pysequence_list(PyObjectRef) -> PyObjectRef -fn pysequence_repeat(PyObjectRef, Int) -> PyObjectRef +pub fn pysequence_repeat(PyObjectRef, Int) -> PyObjectRef -fn pysequence_set_item(PyObjectRef, UInt64, PyObjectRef) -> Int +pub fn pysequence_set_item(PyObjectRef, UInt64, PyObjectRef) -> Int -fn pysequence_set_slice(PyObjectRef, UInt64, UInt64, PyObjectRef) -> Int +pub fn pysequence_set_slice(PyObjectRef, UInt64, UInt64, PyObjectRef) -> Int -fn pysequence_size(PyObjectRef) -> Int +pub fn pysequence_size(PyObjectRef) -> Int -fn pysequence_tuple(PyObjectRef) -> PyObjectRef +pub fn pysequence_tuple(PyObjectRef) -> PyObjectRef -fn pytuple_get_item(PyObjectRef, UInt64) -> PyObjectRef +pub fn pytuple_get_item(PyObjectRef, UInt64) -> PyObjectRef -fn pytuple_get_slice(PyObjectRef, UInt64, UInt64) -> PyObjectRef +pub fn pytuple_get_slice(PyObjectRef, UInt64, UInt64) -> PyObjectRef -fn pytuple_new(UInt64) -> PyObjectRef +pub fn pytuple_new(UInt64) -> PyObjectRef -fn pytuple_set_item(PyObjectRef, UInt64, PyObjectRef) -> Int +pub fn pytuple_set_item(PyObjectRef, UInt64, PyObjectRef) -> Int -fn pytuple_size(PyObjectRef) -> UInt64 +pub fn pytuple_size(PyObjectRef) -> UInt64 // Errors @@ -610,18 +610,18 @@ type CWStr type PyCodeObjectRef type PyObjectRef -fn PyObjectRef::dump(Self) -> Unit -fn PyObjectRef::is_bool(Self) -> Bool -fn PyObjectRef::is_callable(Self) -> Bool -fn PyObjectRef::is_dict(Self) -> Bool -fn PyObjectRef::is_float(Self) -> Bool -fn PyObjectRef::is_function(Self) -> Bool -fn PyObjectRef::is_int(Self) -> Bool -fn PyObjectRef::is_list(Self) -> Bool -fn PyObjectRef::is_module(Self) -> Bool -fn PyObjectRef::is_null(Self) -> Bool -fn PyObjectRef::is_set(Self) -> Bool -fn PyObjectRef::is_string(Self) -> Bool +pub fn PyObjectRef::dump(Self) -> Unit +pub fn PyObjectRef::is_bool(Self) -> Bool +pub fn PyObjectRef::is_callable(Self) -> Bool +pub fn PyObjectRef::is_dict(Self) -> Bool +pub fn PyObjectRef::is_float(Self) -> Bool +pub fn PyObjectRef::is_function(Self) -> Bool +pub fn PyObjectRef::is_int(Self) -> Bool +pub fn PyObjectRef::is_list(Self) -> Bool +pub fn PyObjectRef::is_module(Self) -> Bool +pub fn PyObjectRef::is_null(Self) -> Bool +pub fn PyObjectRef::is_set(Self) -> Bool +pub fn PyObjectRef::is_string(Self) -> Bool type PyThreadStateRef diff --git a/cpython/utils.mbt b/cpython/utils.mbt index a5873a1..95797b9 100644 --- a/cpython/utils.mbt +++ b/cpython/utils.mbt @@ -21,5 +21,5 @@ priv trait ToCStr { impl ToCStr for String with to_cstr(self) { let s = @encoding/utf8.encode(self).to_array().filter(fn(c) { c != 0 }) s.push(0) - s |> @bytes.from_array + s |> Bytes::from_array } diff --git a/dict.mbt b/dict.mbt index b4f437e..ab12575 100644 --- a/dict.mbt +++ b/dict.mbt @@ -151,7 +151,7 @@ pub fn PyDict::op_get(self : PyDict, key : String) -> PyObjectEnum { /// ..set("one", PyInteger::from(1)) /// ..set("two", PyFloat::from(2.0)) /// ..set("three", PyBool::from(true)); -/// +/// /// inspect(dict, content="{\'one\': 1, \'two\': 2.0, \'three\': True}") /// ``` /// @@ -225,7 +225,7 @@ pub fn[K : IsPyObject, V : IsPyObject] PyDict::setByObj( /// dict["one"] = PyInteger::from(1); /// dict["two"] = PyFloat::from(2.0); /// dict["three"] = PyBool::from(true); -/// +/// /// inspect(dict, content="{\'one\': 1, \'two\': 2.0, \'three\': True}") /// ``` /// diff --git a/pkg.generated.mbti b/pkg.generated.mbti index 9f42e20..ed8e0e3 100644 --- a/pkg.generated.mbti +++ b/pkg.generated.mbti @@ -6,145 +6,145 @@ import( ) // Values -fn init_py() -> Unit +pub fn init_py() -> Unit -fn pyimport(String, print_err? : Bool) -> PyModule? +pub fn pyimport(String, print_err? : Bool) -> PyModule? -fn strip_quot(String) -> String +pub fn strip_quot(String) -> String // Errors pub suberror PyRuntimeError { - TypeMisMatchError + TypeMismatchError IndexOutOfBoundsError KeyIsUnHashableError InVokeError } -impl Show for PyRuntimeError +pub impl Show for PyRuntimeError // Types and methods pub struct PyBool { // private fields } -fn PyBool::create(PyObject) -> Self raise PyRuntimeError -fn PyBool::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError -fn PyBool::dump(Self) -> Unit -fn PyBool::from(Bool) -> Self -fn PyBool::is_false(Self) -> Bool -fn PyBool::is_true(Self) -> Bool -fn PyBool::not(Self) -> Self -fn PyBool::to_bool(Self) -> Bool -impl IsPyObject for PyBool -impl Show for PyBool +pub fn PyBool::create(PyObject) -> Self raise PyRuntimeError +pub fn PyBool::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError +pub fn PyBool::dump(Self) -> Unit +pub fn PyBool::from(Bool) -> Self +pub fn PyBool::is_false(Self) -> Bool +pub fn PyBool::is_true(Self) -> Bool +pub fn PyBool::not(Self) -> Self +pub fn PyBool::to_bool(Self) -> Bool +pub impl IsPyObject for PyBool +pub impl Show for PyBool pub struct PyCallable { // private fields } -fn PyCallable::create(PyObject) -> Self raise PyRuntimeError -fn PyCallable::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError -fn PyCallable::dump(Self) -> Unit -fn PyCallable::invoke(Self, args? : PyTuple, kwargs? : PyDict, print_err? : Bool) -> PyObjectEnum? raise PyRuntimeError -impl IsPyObject for PyCallable -impl Show for PyCallable +pub fn PyCallable::create(PyObject) -> Self raise PyRuntimeError +pub fn PyCallable::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError +pub fn PyCallable::dump(Self) -> Unit +pub fn PyCallable::invoke(Self, args? : PyTuple, kwargs? : PyDict, print_err? : Bool) -> PyObjectEnum? raise PyRuntimeError +pub impl IsPyObject for PyCallable +pub impl Show for PyCallable pub struct PyDict { // private fields } -fn PyDict::contains(Self, String) -> Bool -fn PyDict::containsObj(Self, PyObject) -> Bool -fn PyDict::create(PyObject) -> Self raise PyRuntimeError -fn PyDict::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError -fn PyDict::drop(Self) -> Unit -fn PyDict::dump(Self) -> Unit -fn PyDict::get(Self, String) -> PyObjectEnum? -fn PyDict::getByObj(Self, PyObject) -> PyObjectEnum? -fn PyDict::items(Self) -> PyList -fn PyDict::keys(Self) -> PyList -fn PyDict::len(Self) -> Int -fn PyDict::new() -> Self -fn PyDict::op_get(Self, String) -> PyObjectEnum -fn[V : IsPyObject] PyDict::op_set(Self, String, V) -> Unit -fn[V : IsPyObject] PyDict::set(Self, String, V) -> Unit -fn[K : IsPyObject, V : IsPyObject] PyDict::setByObj(Self, K, V) -> Unit raise PyRuntimeError -fn PyDict::values(Self) -> PyList -impl IsPyObject for PyDict -impl Show for PyDict +pub fn PyDict::contains(Self, String) -> Bool +pub fn PyDict::containsObj(Self, PyObject) -> Bool +pub fn PyDict::create(PyObject) -> Self raise PyRuntimeError +pub fn PyDict::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError +pub fn PyDict::drop(Self) -> Unit +pub fn PyDict::dump(Self) -> Unit +pub fn PyDict::get(Self, String) -> PyObjectEnum? +pub fn PyDict::getByObj(Self, PyObject) -> PyObjectEnum? +pub fn PyDict::items(Self) -> PyList +pub fn PyDict::keys(Self) -> PyList +pub fn PyDict::len(Self) -> Int +pub fn PyDict::new() -> Self +pub fn PyDict::op_get(Self, String) -> PyObjectEnum +pub fn[V : IsPyObject] PyDict::op_set(Self, String, V) -> Unit +pub fn[V : IsPyObject] PyDict::set(Self, String, V) -> Unit +pub fn[K : IsPyObject, V : IsPyObject] PyDict::setByObj(Self, K, V) -> Unit raise PyRuntimeError +pub fn PyDict::values(Self) -> PyList +pub impl IsPyObject for PyDict +pub impl Show for PyDict pub struct PyFloat { // private fields } -fn PyFloat::create(PyObject) -> Self raise PyRuntimeError -fn PyFloat::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError -fn PyFloat::drop(Self) -> Unit -fn PyFloat::dump(Self) -> Unit -fn PyFloat::from(Double) -> Self -fn PyFloat::to_double(Self) -> Double -impl IsPyObject for PyFloat -impl Show for PyFloat +pub fn PyFloat::create(PyObject) -> Self raise PyRuntimeError +pub fn PyFloat::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError +pub fn PyFloat::drop(Self) -> Unit +pub fn PyFloat::dump(Self) -> Unit +pub fn PyFloat::from(Double) -> Self +pub fn PyFloat::to_double(Self) -> Double +pub impl IsPyObject for PyFloat +pub impl Show for PyFloat pub struct PyInteger { // private fields } -fn PyInteger::create(PyObject) -> Self raise PyRuntimeError -fn PyInteger::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError -fn PyInteger::create_unchecked(PyObject) -> Self -fn PyInteger::drop(Self) -> Unit -fn PyInteger::dump(Self) -> Unit -fn PyInteger::from(Int64) -> Self -fn PyInteger::to_double(Self) -> Double -fn PyInteger::to_int64(Self) -> Int64 -impl IsPyObject for PyInteger -impl Show for PyInteger +pub fn PyInteger::create(PyObject) -> Self raise PyRuntimeError +pub fn PyInteger::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError +pub fn PyInteger::create_unchecked(PyObject) -> Self +pub fn PyInteger::drop(Self) -> Unit +pub fn PyInteger::dump(Self) -> Unit +pub fn PyInteger::from(Int64) -> Self +pub fn PyInteger::to_double(Self) -> Double +pub fn PyInteger::to_int64(Self) -> Int64 +pub impl IsPyObject for PyInteger +pub impl Show for PyInteger pub struct PyList { // private fields } -fn[T : IsPyObject] PyList::append(Self, T) -> Unit -fn PyList::create(PyObject) -> Self raise PyRuntimeError -fn PyList::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError -fn PyList::drop(Self) -> Unit -fn PyList::dump(Self) -> Unit -fn[T : IsPyObject] PyList::from(Array[T]) -> Self -fn PyList::get(Self, Int) -> PyObjectEnum? -fn PyList::len(Self) -> Int -fn PyList::new() -> Self -fn PyList::op_get(Self, Int) -> PyObjectEnum -fn[T : IsPyObject] PyList::op_set(Self, Int, T) -> Unit -fn[T : IsPyObject] PyList::set(Self, Int, T) -> Unit raise PyRuntimeError -impl IsPyObject for PyList -impl Show for PyList +pub fn[T : IsPyObject] PyList::append(Self, T) -> Unit +pub fn PyList::create(PyObject) -> Self raise PyRuntimeError +pub fn PyList::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError +pub fn PyList::drop(Self) -> Unit +pub fn PyList::dump(Self) -> Unit +pub fn[T : IsPyObject] PyList::from(Array[T]) -> Self +pub fn PyList::get(Self, Int) -> PyObjectEnum? +pub fn PyList::len(Self) -> Int +pub fn PyList::new() -> Self +pub fn PyList::op_get(Self, Int) -> PyObjectEnum +pub fn[T : IsPyObject] PyList::op_set(Self, Int, T) -> Unit +pub fn[T : IsPyObject] PyList::set(Self, Int, T) -> Unit raise PyRuntimeError +pub impl IsPyObject for PyList +pub impl Show for PyList pub struct PyModule { // private fields } -fn PyModule::create(PyObject) -> Self raise PyRuntimeError -fn PyModule::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError -fn PyModule::dump(Self) -> Unit -fn PyModule::get_attr(Self, String, print_err? : Bool) -> PyObjectEnum? -fn PyModule::get_name(Self) -> String -impl IsPyObject for PyModule -impl Show for PyModule +pub fn PyModule::create(PyObject) -> Self raise PyRuntimeError +pub fn PyModule::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError +pub fn PyModule::dump(Self) -> Unit +pub fn PyModule::get_attr(Self, String, print_err? : Bool) -> PyObjectEnum? +pub fn PyModule::get_name(Self) -> String +pub impl IsPyObject for PyModule +pub impl Show for PyModule pub struct PyObject { // private fields } -fn PyObject::create(@cpython.PyObjectRef) -> Self -fn PyObject::drop(Self) -> Unit -fn PyObject::dump(Self) -> Unit -fn PyObject::get_attr(Self, String, print_err? : Bool) -> PyObjectEnum? -fn PyObject::is_bool(Self) -> Bool -fn PyObject::is_callable(Self) -> Bool -fn PyObject::is_dict(Self) -> Bool -fn PyObject::is_float(Self) -> Bool -fn PyObject::is_int(Self) -> Bool -fn PyObject::is_list(Self) -> Bool -fn PyObject::is_module(Self) -> Bool -fn PyObject::is_null(Self) -> Bool -fn PyObject::is_string(Self) -> Bool -fn PyObject::is_tuple(Self) -> Bool -fn PyObject::type_name(Self) -> String -fn PyObject::type_of(Self) -> PyType -impl IsPyObject for PyObject -impl Show for PyObject +pub fn PyObject::create(@cpython.PyObjectRef) -> Self +pub fn PyObject::drop(Self) -> Unit +pub fn PyObject::dump(Self) -> Unit +pub fn PyObject::get_attr(Self, String, print_err? : Bool) -> PyObjectEnum? +pub fn PyObject::is_bool(Self) -> Bool +pub fn PyObject::is_callable(Self) -> Bool +pub fn PyObject::is_dict(Self) -> Bool +pub fn PyObject::is_float(Self) -> Bool +pub fn PyObject::is_int(Self) -> Bool +pub fn PyObject::is_list(Self) -> Bool +pub fn PyObject::is_module(Self) -> Bool +pub fn PyObject::is_null(Self) -> Bool +pub fn PyObject::is_string(Self) -> Bool +pub fn PyObject::is_tuple(Self) -> Bool +pub fn PyObject::type_name(Self) -> String +pub fn PyObject::type_of(Self) -> PyType +pub impl IsPyObject for PyObject +pub impl Show for PyObject pub(all) enum PyObjectEnum { PyInteger(PyInteger) @@ -158,37 +158,37 @@ pub(all) enum PyObjectEnum { PyCallable(PyCallable) PyClass(PyObject) } -fn PyObjectEnum::create(PyObject) -> Self -fn PyObjectEnum::create_by_ref(@cpython.PyObjectRef) -> Self -fn PyObjectEnum::dump(Self) -> Unit -impl Show for PyObjectEnum +pub fn PyObjectEnum::create(PyObject) -> Self +pub fn PyObjectEnum::create_by_ref(@cpython.PyObjectRef) -> Self +pub fn PyObjectEnum::dump(Self) -> Unit +pub impl Show for PyObjectEnum pub struct PyString { // private fields } -fn PyString::create(PyObject) -> Self raise PyRuntimeError -fn PyString::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError -fn PyString::drop(Self) -> Unit -fn PyString::dump(Self) -> Unit -fn PyString::from(String) -> Self -impl IsPyObject for PyString -impl Show for PyString +pub fn PyString::create(PyObject) -> Self raise PyRuntimeError +pub fn PyString::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError +pub fn PyString::drop(Self) -> Unit +pub fn PyString::dump(Self) -> Unit +pub fn PyString::from(String) -> Self +pub impl IsPyObject for PyString +pub impl Show for PyString pub struct PyTuple { // private fields } -fn PyTuple::create(PyObject) -> Self raise PyRuntimeError -fn PyTuple::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError -fn PyTuple::drop(Self) -> Unit -fn PyTuple::dump(Self) -> Unit -fn PyTuple::get(Self, Int) -> PyObjectEnum? -fn PyTuple::len(Self) -> UInt64 -fn PyTuple::new(UInt64) -> Self -fn PyTuple::op_get(Self, Int) -> PyObjectEnum -fn[T : IsPyObject] PyTuple::op_set(Self, Int, T) -> Unit -fn[T : IsPyObject] PyTuple::set(Self, Int, T) -> Unit -impl IsPyObject for PyTuple -impl Show for PyTuple +pub fn PyTuple::create(PyObject) -> Self raise PyRuntimeError +pub fn PyTuple::create_by_ref(@cpython.PyObjectRef) -> Self raise PyRuntimeError +pub fn PyTuple::drop(Self) -> Unit +pub fn PyTuple::dump(Self) -> Unit +pub fn PyTuple::get(Self, Int) -> PyObjectEnum? +pub fn PyTuple::len(Self) -> UInt64 +pub fn PyTuple::new(UInt64) -> Self +pub fn PyTuple::op_get(Self, Int) -> PyObjectEnum +pub fn[T : IsPyObject] PyTuple::op_set(Self, Int, T) -> Unit +pub fn[T : IsPyObject] PyTuple::set(Self, Int, T) -> Unit +pub impl IsPyObject for PyTuple +pub impl Show for PyTuple pub enum PyType { PyInteger diff --git a/set.mbt b/set.mbt index fa84495..4e36a8a 100644 --- a/set.mbt +++ b/set.mbt @@ -11,4 +11,3 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - diff --git a/time/pkg.generated.mbti b/time/pkg.generated.mbti index 3655ba2..1edae0a 100644 --- a/time/pkg.generated.mbti +++ b/time/pkg.generated.mbti @@ -2,31 +2,31 @@ package "Kaida-Amethyst/python/time" // Values -fn ctime(Double?) -> String +pub fn ctime(Double?) -> String -fn monotonic() -> Double +pub fn monotonic() -> Double -fn monotonic_ns() -> Int64 +pub fn monotonic_ns() -> Int64 -fn perf_counter() -> Double +pub fn perf_counter() -> Double -fn perf_counter_ns() -> Int64 +pub fn perf_counter_ns() -> Int64 -fn process_time() -> Double +pub fn process_time() -> Double -fn process_time_ns() -> Int64 +pub fn process_time_ns() -> Int64 -fn sleep(Double) -> Unit +pub fn sleep(Double) -> Unit -fn time() -> Double +pub fn time() -> Double -fn time_ns() -> Int64 +pub fn time_ns() -> Int64 // Errors pub suberror TurtleError { LoadTimeModuleError } -impl Show for TurtleError +pub impl Show for TurtleError // Types and methods pub struct TimeModule { diff --git a/tkinter/pkg.generated.mbti b/tkinter/pkg.generated.mbti index 3ca13ff..d71c059 100644 --- a/tkinter/pkg.generated.mbti +++ b/tkinter/pkg.generated.mbti @@ -7,14 +7,14 @@ package "Kaida-Amethyst/python/tkinter" pub suberror TkinterError { LoadTkinterError } -impl Show for TkinterError +pub impl Show for TkinterError // Types and methods pub struct Label { // private fields } -fn Label::new(Window, String) -> Self -fn Label::pack(Self) -> Unit +pub fn Label::new(Window, String) -> Self +pub fn Label::pack(Self) -> Unit pub struct Tkinter { // private fields @@ -23,9 +23,9 @@ pub struct Tkinter { pub struct Window { // private fields } -fn Window::mainloop(Self) -> Unit -fn Window::new() -> Self -fn Window::set_title(Self, String) -> Unit +pub fn Window::mainloop(Self) -> Unit +pub fn Window::new() -> Self +pub fn Window::set_title(Self, String) -> Unit // Type aliases diff --git a/turtle/pkg.generated.mbti b/turtle/pkg.generated.mbti index c5211c4..657c94b 100644 --- a/turtle/pkg.generated.mbti +++ b/turtle/pkg.generated.mbti @@ -6,13 +6,13 @@ import( ) // Values -fn bgcolor(Color) -> Unit +pub fn bgcolor(Color) -> Unit // Errors pub suberror TurtleError { LoadTurtleError } -impl Show for TurtleError +pub impl Show for TurtleError // Types and methods pub(all) enum Color { @@ -35,58 +35,58 @@ pub(all) enum Color { Indigo Violet } -fn Color::to_pystr(Self) -> @python.PyString -impl Show for Color +pub fn Color::to_pystr(Self) -> @python.PyString +pub impl Show for Color pub struct Pen { methods : Map[String, @python.PyCallable] // private fields } -fn Pen::backward(Self, Double) -> Unit -fn Pen::begin_fill(Self) -> Unit -fn Pen::circle(Self, Double, extent? : Double?, steps? : Int?) -> Unit -fn Pen::clear(Self) -> Unit -fn Pen::clearstamp(Self, Int) -> Unit -fn Pen::clearstamps(Self, n? : Int?) -> Unit -fn Pen::color(Self, Color) -> Unit -fn Pen::dot(Self, Double, Color) -> Unit -fn Pen::end_fill(Self) -> Unit -fn Pen::fillcolor(Self, Color) -> Unit -fn Pen::forward(Self, Double) -> Unit -fn Pen::goto(Self, Double, Double) -> Unit -fn Pen::heading(Self) -> Double -fn Pen::hide(Self) -> Unit -fn Pen::home(Self) -> Unit -fn Pen::isdown(Self) -> Bool -fn Pen::isvisible(Self) -> Bool -fn Pen::left(Self, Double) -> Unit -fn Pen::new() -> Self -fn Pen::pencolor(Self, Color) -> Unit -fn Pen::pendown(Self) -> Unit -fn Pen::pensize(Self, Double) -> Unit -fn Pen::penup(Self) -> Unit -fn Pen::position(Self) -> (Double, Double) -fn Pen::radians(Self) -> Double -fn Pen::reset(Self) -> Unit -fn Pen::right(Self, Double) -> Unit -fn Pen::shape(Self, Shape) -> Unit -fn Pen::shapesize(Self, stretch_width? : Double?, stretch_len? : Double?, outline? : Int?) -> Unit -fn Pen::show(Self) -> Unit -fn Pen::speed(Self, Speed) -> Unit -fn Pen::stamp(Self) -> Int -fn Pen::width(Self, Double) -> Unit -fn Pen::xcor(Self) -> Double -fn Pen::ycor(Self) -> Double +pub fn Pen::backward(Self, Double) -> Unit +pub fn Pen::begin_fill(Self) -> Unit +pub fn Pen::circle(Self, Double, extent? : Double?, steps? : Int?) -> Unit +pub fn Pen::clear(Self) -> Unit +pub fn Pen::clearstamp(Self, Int) -> Unit +pub fn Pen::clearstamps(Self, n? : Int?) -> Unit +pub fn Pen::color(Self, Color) -> Unit +pub fn Pen::dot(Self, Double, Color) -> Unit +pub fn Pen::end_fill(Self) -> Unit +pub fn Pen::fillcolor(Self, Color) -> Unit +pub fn Pen::forward(Self, Double) -> Unit +pub fn Pen::goto(Self, Double, Double) -> Unit +pub fn Pen::heading(Self) -> Double +pub fn Pen::hide(Self) -> Unit +pub fn Pen::home(Self) -> Unit +pub fn Pen::isdown(Self) -> Bool +pub fn Pen::isvisible(Self) -> Bool +pub fn Pen::left(Self, Double) -> Unit +pub fn Pen::new() -> Self +pub fn Pen::pencolor(Self, Color) -> Unit +pub fn Pen::pendown(Self) -> Unit +pub fn Pen::pensize(Self, Double) -> Unit +pub fn Pen::penup(Self) -> Unit +pub fn Pen::position(Self) -> (Double, Double) +pub fn Pen::radians(Self) -> Double +pub fn Pen::reset(Self) -> Unit +pub fn Pen::right(Self, Double) -> Unit +pub fn Pen::shape(Self, Shape) -> Unit +pub fn Pen::shapesize(Self, stretch_width? : Double?, stretch_len? : Double?, outline? : Int?) -> Unit +pub fn Pen::show(Self) -> Unit +pub fn Pen::speed(Self, Speed) -> Unit +pub fn Pen::stamp(Self) -> Int +pub fn Pen::width(Self, Double) -> Unit +pub fn Pen::xcor(Self) -> Double +pub fn Pen::ycor(Self) -> Double pub struct Screen { // private fields } -fn Screen::bgcolor(Self, Color) -> Unit -fn Screen::new() -> Self -fn Screen::setup(Self, Double, Double) -> Unit -fn Screen::title(Self, String) -> Unit -fn Screen::tracer(Self, Int) -> Unit -fn Screen::update(Self) -> Unit +pub fn Screen::bgcolor(Self, Color) -> Unit +pub fn Screen::new() -> Self +pub fn Screen::setup(Self, Double, Double) -> Unit +pub fn Screen::title(Self, String) -> Unit +pub fn Screen::tracer(Self, Int) -> Unit +pub fn Screen::update(Self) -> Unit pub(all) enum Shape { Arrow @@ -96,7 +96,7 @@ pub(all) enum Shape { Triangle Classic } -impl Show for Shape +pub impl Show for Shape pub(all) enum Speed { Fastest From 4f230957e31a353dc62c77f85b6e2c030c6c2c55 Mon Sep 17 00:00:00 2001 From: zihang Date: Wed, 10 Dec 2025 10:06:21 +0800 Subject: [PATCH 2/2] fix: Complete guard statement in PyTuple::set The guard statement was missing the else clause, which is required in MoonBit. Added panic() as the error handler to match the behavior of op_set which also panics on invalid index. Co-authored-by: openhands --- tuple.mbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tuple.mbt b/tuple.mbt index 278f61c..4ee962a 100644 --- a/tuple.mbt +++ b/tuple.mbt @@ -172,7 +172,7 @@ pub fn[T : IsPyObject] PyTuple::set( idx : Int, item : T, ) -> Unit { - guard idx >= 0 && idx.to_uint64() < self.len() + guard idx >= 0 && idx.to_uint64() < self.len() else { panic() } let _ = @cpython.pytuple_set_item( self.obj_ref(), idx.to_uint64(),