From f82e55d1b58385b74945711ca4c7bcb43b9c6b5f Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Tue, 12 Sep 2023 17:12:32 +0200 Subject: [PATCH 01/18] Detect and inject _ext.py mixin --- crates/re_types_builder/src/codegen/common.rs | 9 ++++ crates/re_types_builder/src/codegen/python.rs | 47 ++++++++++++++++--- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/crates/re_types_builder/src/codegen/common.rs b/crates/re_types_builder/src/codegen/common.rs index c85fc7331d04..daac40856ec8 100644 --- a/crates/re_types_builder/src/codegen/common.rs +++ b/crates/re_types_builder/src/codegen/common.rs @@ -83,6 +83,15 @@ pub fn remove_old_files_from_folder(folder_path: Utf8PathBuf, filepaths: &BTreeS continue; } + if let Some(stem) = filepath.as_str().strip_suffix("_ext.py") { + let generated_path = Utf8PathBuf::try_from(format!("{stem}.py")).unwrap(); + assert!( + generated_path.exists(), + "Found orphaned {filepath} with no matching {generated_path}" + ); + continue; + } + if let Some(stem) = filepath.as_str().strip_suffix("_ext.cpp") { let generated_hpp_path = Utf8PathBuf::try_from(format!("{stem}.hpp")).unwrap(); assert!( diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index 682a6dd3fcd0..0eb1f8a57202 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -124,6 +124,10 @@ impl CodeGenerator for PythonCodeGenerator { } } +struct ObjExt { + name: String, +} + impl PythonCodeGenerator { fn generate_folder( &self, @@ -133,6 +137,8 @@ impl PythonCodeGenerator { files_to_write: &mut BTreeMap, ) { let kind_path = self.pkg_path.join(object_kind.plural_snake_case()); + + // TODO(jleibs): This can go away once all overrides ported to extensions let overrides = load_overrides(&kind_path); // (module_name, [object_name]) @@ -142,6 +148,8 @@ impl PythonCodeGenerator { let ordered_objects = objects.ordered_objects(object_kind.into()); for &obj in &ordered_objects { let filepath = kind_path.join(format!("{}.py", obj.snake_case_name())); + let ext_path = kind_path.join(format!("{}_ext.py", obj.snake_case_name())); + let mut obj_ext: Option = None; let names = match obj.kind { ObjectKind::Datatype | ObjectKind::Component => { @@ -218,6 +226,20 @@ impl PythonCodeGenerator { 0, ); + if ext_path.exists() { + let mut ext_name = obj.name.clone(); + ext_name.push_str("Ext"); + code.push_unindented_text( + format!( + "from .{} import {}Ext", + ext_path.file_stem().unwrap(), + obj.name + ), + 1, + ); + obj_ext = Some(ObjExt { name: ext_name }); + } + // Import all overrides. Overrides always start with `type_name_` and ends with `_override`. let override_names: Vec<_> = overrides .iter() @@ -259,9 +281,9 @@ impl PythonCodeGenerator { ); let obj_code = if obj.is_struct() { - code_for_struct(arrow_registry, &overrides, objects, obj) + code_for_struct(arrow_registry, obj_ext, &overrides, objects, obj) } else { - code_for_union(arrow_registry, &overrides, objects, obj) + code_for_union(arrow_registry, obj_ext, &overrides, objects, obj) }; code.push_text(&obj_code, 1, 0); @@ -353,6 +375,7 @@ fn lib_source_code(archetype_names: &[String]) -> String { fn code_for_struct( arrow_registry: &ArrowRegistry, + obj_ext: Option, overrides: &HashSet, objects: &Objects, obj: &Object, @@ -406,9 +429,20 @@ fn code_for_struct( (String::new(), String::new()) }; - let superclass = match *kind { - ObjectKind::Archetype => "(Archetype)", - ObjectKind::Component | ObjectKind::Datatype => "", + let mut superclasses = vec![]; + + if *kind == ObjectKind::Archetype { + superclasses.push("Archetype"); + } + + if let Some(obj_ext) = &obj_ext { + superclasses.push(obj_ext.name.as_str()); + } + + let superclass_decl = if superclasses.len() > 0 { + format!("({})", superclasses.join(",")) + } else { + "".to_owned() }; let define_args = if *kind == ObjectKind::Archetype { @@ -430,7 +464,7 @@ fn code_for_struct( format!( r#" @define{define_args} - class {name}{superclass}: + class {name}{superclass_decl}: "# ), 0, @@ -554,6 +588,7 @@ fn code_for_struct( fn code_for_union( arrow_registry: &ArrowRegistry, + obj_ext: Option, overrides: &HashSet, objects: &Objects, obj: &Object, From 48d3683b4f8db2a90ba035f247e3f627b099885c Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Tue, 12 Sep 2023 17:36:28 +0200 Subject: [PATCH 02/18] Detect the relevant overrides from the extension class --- crates/re_types_builder/src/codegen/python.rs | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index 0eb1f8a57202..d56e957fa35a 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -125,7 +125,8 @@ impl CodeGenerator for PythonCodeGenerator { } struct ObjExt { - name: String, + ext_name: String, + overrides: Vec, } impl PythonCodeGenerator { @@ -229,15 +230,37 @@ impl PythonCodeGenerator { if ext_path.exists() { let mut ext_name = obj.name.clone(); ext_name.push_str("Ext"); + + let contents = std::fs::read_to_string(&ext_path) + .with_context(|| format!("couldn't load overrides module at {ext_path:?}")) + .unwrap(); + + // Extract potential overrides + // TODO(jleibs): Maybe pull in regex here + let overrides: Vec<_> = contents + .lines() + .map(|l| l.trim()) + .filter(|l| l.starts_with("def")) + .map(|l| l.trim_start_matches("def")) + .filter_map(|l| l.split('(').next()) + .filter(|l| l.ends_with("_override") || *l == "__init__") + .map(|l| l.to_owned()) + .collect(); + + obj_ext = Some(ObjExt { + ext_name, + overrides, + }); + code.push_unindented_text( format!( - "from .{} import {}Ext", + "from .{} import {}Ext # Members: {}", ext_path.file_stem().unwrap(), - obj.name + obj.name, + obj_ext.as_ref().unwrap().overrides.join(", ") ), 1, ); - obj_ext = Some(ObjExt { name: ext_name }); } // Import all overrides. Overrides always start with `type_name_` and ends with `_override`. @@ -436,7 +459,7 @@ fn code_for_struct( } if let Some(obj_ext) = &obj_ext { - superclasses.push(obj_ext.name.as_str()); + superclasses.push(obj_ext.ext_name.as_str()); } let superclass_decl = if superclasses.len() > 0 { From 4b2d6f8357b0d928f6623cc513a525553598489e Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Tue, 12 Sep 2023 18:03:28 +0200 Subject: [PATCH 03/18] Inject new-style converters --- crates/re_types_builder/src/codegen/python.rs | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index d56e957fa35a..67c14847cdb4 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -241,7 +241,7 @@ impl PythonCodeGenerator { .lines() .map(|l| l.trim()) .filter(|l| l.starts_with("def")) - .map(|l| l.trim_start_matches("def")) + .map(|l| l.trim_start_matches("def").trim()) .filter_map(|l| l.split('(').next()) .filter(|l| l.ends_with("_override") || *l == "__init__") .map(|l| l.to_owned()) @@ -304,9 +304,9 @@ impl PythonCodeGenerator { ); let obj_code = if obj.is_struct() { - code_for_struct(arrow_registry, obj_ext, &overrides, objects, obj) + code_for_struct(arrow_registry, obj_ext.as_ref(), &overrides, objects, obj) } else { - code_for_union(arrow_registry, obj_ext, &overrides, objects, obj) + code_for_union(arrow_registry, obj_ext.as_ref(), &overrides, objects, obj) }; code.push_text(&obj_code, 1, 0); @@ -398,7 +398,7 @@ fn lib_source_code(archetype_names: &[String]) -> String { fn code_for_struct( arrow_registry: &ArrowRegistry, - obj_ext: Option, + obj_ext: Option<&ObjExt>, overrides: &HashSet, objects: &Objects, obj: &Object, @@ -423,13 +423,23 @@ fn code_for_struct( let (default_converter, converter_function) = quote_field_converter_from_field(obj, objects, field); - let converter_override_name = format!( + let old_converter_override_name = format!( "{}__{}__field_converter_override", obj.snake_case_name(), field.name ); - let converter = if overrides.contains(&converter_override_name) { - format!("converter={converter_override_name}") + + let converter_override_name = format!("{}__field_converter_override", field.name); + + let converter = if obj_ext.map_or(false, |obj_ext| { + obj_ext.overrides.contains(&converter_override_name) + }) { + format!( + "converter={}.{converter_override_name}", + obj_ext.unwrap().ext_name + ) + } else if overrides.contains(&old_converter_override_name) { + format!("converter={old_converter_override_name}") } else if *kind == ObjectKind::Archetype { // Archetypes default to using `from_similar` from the Component let (typ_unwrapped, _) = quote_field_type_from_field(objects, field, true); @@ -611,7 +621,7 @@ fn code_for_struct( fn code_for_union( arrow_registry: &ArrowRegistry, - obj_ext: Option, + obj_ext: Option<&ObjExt>, overrides: &HashSet, objects: &Objects, obj: &Object, From c9624fc9b43c6b2509a31278dfa429e4954c0ec6 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Tue, 12 Sep 2023 18:50:50 +0200 Subject: [PATCH 04/18] Support for native_to_pa_array override --- crates/re_types_builder/src/codegen/python.rs | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index 67c14847cdb4..6e7c84cd2719 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -601,7 +601,7 @@ fn code_for_struct( ); } else { code.push_text( - quote_arrow_support_from_obj(arrow_registry, overrides, obj), + quote_arrow_support_from_obj(arrow_registry, obj_ext, overrides, obj), 1, 0, ); @@ -609,7 +609,7 @@ fn code_for_struct( } ObjectKind::Datatype => { code.push_text( - quote_arrow_support_from_obj(arrow_registry, overrides, obj), + quote_arrow_support_from_obj(arrow_registry, obj_ext, overrides, obj), 1, 0, ); @@ -727,7 +727,7 @@ fn code_for_union( } ObjectKind::Datatype => { code.push_text( - quote_arrow_support_from_obj(arrow_registry, overrides, obj), + quote_arrow_support_from_obj(arrow_registry, obj_ext, overrides, obj), 1, 0, ); @@ -1259,6 +1259,7 @@ fn quote_arrow_support_from_delegating_component(obj: &Object, dtype_obj: &Objec /// delegate to the Datatype's arrow support. fn quote_arrow_support_from_obj( arrow_registry: &ArrowRegistry, + obj_ext: Option<&ObjExt>, overrides: &HashSet, obj: &Object, ) -> String { @@ -1285,12 +1286,18 @@ fn quote_arrow_support_from_obj( .try_get_attr::(ATTR_RERUN_LEGACY_FQNAME) .unwrap_or_else(|| fqname.clone()); - let override_name = format!("{}__native_to_pa_array_override", obj.snake_case_name()); - let override_ = if overrides.contains(&override_name) { - format!("return {override_name}(data, data_type)") + let old_override_name = format!("{}__native_to_pa_array_override", obj.snake_case_name()); + let override_name = "native_to_pa_array_override".to_owned(); + let override_ = if obj_ext.map_or(false, |obj_ext| obj_ext.overrides.contains(&override_name)) { + format!( + "return {}.{override_name}(data, data_type)", + obj_ext.unwrap().ext_name + ) + } else if overrides.contains(&old_override_name) { + format!("return {old_override_name}(data, data_type)") } else { let override_file_path = format!( - "rerun_py/rerun_sdk/rerun/_rerun2/{}/_overrides/{}.py", + "rerun_py/rerun_sdk/rerun/_rerun2/{}/{}_ext.py", obj.kind.plural_snake_case(), obj.snake_case_name() ); From c4164dc1d7925e85b1d6c21d3f585b641a38211d Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Tue, 12 Sep 2023 21:24:46 +0200 Subject: [PATCH 05/18] Support for __init__ / __array__ and assorted cleanup --- crates/re_types_builder/src/codegen/python.rs | 309 +++++++++++++----- 1 file changed, 221 insertions(+), 88 deletions(-) diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index 6e7c84cd2719..5d8a0830f9dc 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -16,6 +16,27 @@ use crate::{ Type, ATTR_PYTHON_ALIASES, ATTR_PYTHON_ARRAY_ALIASES, ATTR_RERUN_LEGACY_FQNAME, }; +/// The standard python init method. +const INIT_METHOD: &str = "__init__"; + +/// The standard numpy interface for converting to an array type +const ARRAY_METHOD: &str = "__array__"; + +/// The method used to convert a native type into a pyarrow array +const NATIVE_TO_PA_ARRAY_METHOD: &str = "native_to_pa_array_override"; + +/// The common suffix for method used to convert fields to their canonical representation.jjj +/// +/// If an extension class has a method named after the field with this suffix, it will be passed +/// as the converter argument to the `attrs` field constructor. +/// +/// For example, `ColorExt` has a method `rgba__field_converter_override`. This results in +/// the rgba field being created as: +/// ``` +/// rgba: int = field(converter=ColorExt.rgba__field_converter_override) +/// ``` +const FIELD_CONVERTER_SUFFIX: &str = "__field_converter_override"; + // --- /// Python-specific helpers for [`Object`]. @@ -124,9 +145,87 @@ impl CodeGenerator for PythonCodeGenerator { } } -struct ObjExt { - ext_name: String, - overrides: Vec, +struct ObjectExt { + /// Whether or not the `ObjectExtension` was found + found: bool, + + /// The name of the file where the `ObjectExtension` is implemented + file_name: String, + + /// The name of the module where `ObjectExtension` is implemented + module_name: String, + + /// The name of this `ObjectExtension` + name: String, + + /// The discovered overrides + field_converter_overrides: Vec, + + /// Whether the ObjectExt contains __init__() + has_init: bool, + + /// Whether the ObjectExt contains __array__() + has_array: bool, + + /// Whether the ObjectExt contains __native_to_pa_array__() + has_native_to_pa_array: bool, +} + +impl ObjectExt { + fn new(base_path: &Utf8Path, obj: &Object) -> ObjectExt { + let file_name = format!("{}_ext.py", obj.snake_case_name()); + let path = base_path.join(file_name.clone()); + let module_name = path.file_stem().unwrap().to_owned(); + let mut name = obj.name.clone(); + name.push_str("Ext"); + + if path.exists() { + let contents = std::fs::read_to_string(&path) + .with_context(|| format!("couldn't load overrides module at {path:?}")) + .unwrap(); + + // Extract all methods + // TODO(jleibs): Maybe pull in regex here + let methods: Vec<_> = contents + .lines() + .map(|l| l.trim()) + .filter(|l| l.starts_with("def")) + .map(|l| l.trim_start_matches("def").trim()) + .filter_map(|l| l.split('(').next()) + .collect(); + + let has_init = methods.contains(&INIT_METHOD); + let has_array = methods.contains(&ARRAY_METHOD); + let has_native_to_pa_array = methods.contains(&NATIVE_TO_PA_ARRAY_METHOD); + let field_converter_overrides = methods + .into_iter() + .filter(|l| l.ends_with(FIELD_CONVERTER_SUFFIX)) + .map(|l| l.to_owned()) + .collect(); + + ObjectExt { + found: true, + file_name, + module_name, + name, + field_converter_overrides, + has_init, + has_array, + has_native_to_pa_array, + } + } else { + ObjectExt { + found: false, + file_name, + module_name, + name, + field_converter_overrides: vec![], + has_init: false, + has_array: false, + has_native_to_pa_array: false, + } + } + } } impl PythonCodeGenerator { @@ -149,8 +248,8 @@ impl PythonCodeGenerator { let ordered_objects = objects.ordered_objects(object_kind.into()); for &obj in &ordered_objects { let filepath = kind_path.join(format!("{}.py", obj.snake_case_name())); - let ext_path = kind_path.join(format!("{}_ext.py", obj.snake_case_name())); - let mut obj_ext: Option = None; + + let obj_ext = ObjectExt::new(&kind_path, obj); let names = match obj.kind { ObjectKind::Datatype | ObjectKind::Component => { @@ -227,42 +326,14 @@ impl PythonCodeGenerator { 0, ); - if ext_path.exists() { - let mut ext_name = obj.name.clone(); - ext_name.push_str("Ext"); - - let contents = std::fs::read_to_string(&ext_path) - .with_context(|| format!("couldn't load overrides module at {ext_path:?}")) - .unwrap(); - - // Extract potential overrides - // TODO(jleibs): Maybe pull in regex here - let overrides: Vec<_> = contents - .lines() - .map(|l| l.trim()) - .filter(|l| l.starts_with("def")) - .map(|l| l.trim_start_matches("def").trim()) - .filter_map(|l| l.split('(').next()) - .filter(|l| l.ends_with("_override") || *l == "__init__") - .map(|l| l.to_owned()) - .collect(); - - obj_ext = Some(ObjExt { - ext_name, - overrides, - }); - + if obj_ext.found { code.push_unindented_text( - format!( - "from .{} import {}Ext # Members: {}", - ext_path.file_stem().unwrap(), - obj.name, - obj_ext.as_ref().unwrap().overrides.join(", ") - ), + format!("from .{} import {}", obj_ext.module_name, obj_ext.name,), 1, ); } + // TODO(jleibs): This can go away once all overrides ported to extensions // Import all overrides. Overrides always start with `type_name_` and ends with `_override`. let override_names: Vec<_> = overrides .iter() @@ -271,6 +342,7 @@ impl PythonCodeGenerator { .map(|o| o.as_str()) .collect::>(); + // TODO(jleibs): This can go away once all overrides ported to extensions // TODO(ab): remove this noqa—useful for checking what overrides are extracted if !override_names.is_empty() { code.push_unindented_text( @@ -304,9 +376,9 @@ impl PythonCodeGenerator { ); let obj_code = if obj.is_struct() { - code_for_struct(arrow_registry, obj_ext.as_ref(), &overrides, objects, obj) + code_for_struct(arrow_registry, &obj_ext, &overrides, objects, obj) } else { - code_for_union(arrow_registry, obj_ext.as_ref(), &overrides, objects, obj) + code_for_union(arrow_registry, &obj_ext, &overrides, objects, obj) }; code.push_text(&obj_code, 1, 0); @@ -398,7 +470,7 @@ fn lib_source_code(archetype_names: &[String]) -> String { fn code_for_struct( arrow_registry: &ArrowRegistry, - obj_ext: Option<&ObjExt>, + obj_ext: &ObjectExt, overrides: &HashSet, objects: &Objects, obj: &Object, @@ -429,15 +501,13 @@ fn code_for_struct( field.name ); - let converter_override_name = format!("{}__field_converter_override", field.name); + let converter_override_name = format!("{}{FIELD_CONVERTER_SUFFIX}", field.name); - let converter = if obj_ext.map_or(false, |obj_ext| { - obj_ext.overrides.contains(&converter_override_name) - }) { - format!( - "converter={}.{converter_override_name}", - obj_ext.unwrap().ext_name - ) + let converter = if obj_ext + .field_converter_overrides + .contains(&converter_override_name) + { + format!("converter={}.{converter_override_name}", obj_ext.name) } else if overrides.contains(&old_converter_override_name) { format!("converter={old_converter_override_name}") } else if *kind == ObjectKind::Archetype { @@ -455,11 +525,11 @@ fn code_for_struct( } // init override handling - let init_override_name = format!("{}__init_override", obj.snake_case_name()); - let (init_define_arg, init_func) = if overrides.contains(&init_override_name) { - ("init=False".to_owned(), init_override_name.clone()) + let old_init_override_name = format!("{}__init_override", obj.snake_case_name()); + let init_define_arg = if obj_ext.has_init || overrides.contains(&old_init_override_name) { + "init=False".to_owned() } else { - (String::new(), String::new()) + String::new() }; let mut superclasses = vec![]; @@ -468,14 +538,14 @@ fn code_for_struct( superclasses.push("Archetype"); } - if let Some(obj_ext) = &obj_ext { - superclasses.push(obj_ext.ext_name.as_str()); + if obj_ext.found { + superclasses.push(obj_ext.name.as_str()); } - let superclass_decl = if superclasses.len() > 0 { + let superclass_decl = if !superclasses.is_empty() { format!("({})", superclasses.join(",")) } else { - "".to_owned() + String::new() }; let define_args = if *kind == ObjectKind::Archetype { @@ -505,15 +575,32 @@ fn code_for_struct( code.push_text(quote_doc_from_docs(docs), 0, 4); - if init_func.is_empty() { - code.push_text(format!("# You can define your own __init__ function by defining a function called {init_override_name:?}"), 2, 4); - } else { + if obj_ext.has_init { + code.push_text( + format!("# __init__ can be found in {}", obj_ext.file_name), + 2, + 4, + ); + } else if overrides.contains(&old_init_override_name) { code.push_text( "def __init__(self, *args, **kwargs): #type: ignore[no-untyped-def]", 1, 4, ); - code.push_text(format!("{init_func}(self, *args, **kwargs)"), 2, 8); + code.push_text( + format!("{old_init_override_name}(self, *args, **kwargs)"), + 2, + 8, + ); + } else { + code.push_text( + format!( + "# You can define your own __init__ function as a member of {} in {}", + obj_ext.name, obj_ext.file_name + ), + 2, + 4, + ); } // NOTE: We need to add required fields first, and then optional ones, otherwise mypy @@ -580,7 +667,11 @@ fn code_for_struct( code.push_text("__repr__ = Archetype.__repr__", 1, 4); } - code.push_text(quote_array_method_from_obj(overrides, objects, obj), 1, 4); + code.push_text( + quote_array_method_from_obj(obj_ext, overrides, objects, obj), + 1, + 4, + ); code.push_text(quote_native_types_method_from_obj(objects, obj), 1, 4); if *kind != ObjectKind::Archetype { @@ -621,7 +712,7 @@ fn code_for_struct( fn code_for_union( arrow_registry: &ArrowRegistry, - obj_ext: Option<&ObjExt>, + obj_ext: &ObjectExt, overrides: &HashSet, objects: &Objects, obj: &Object, @@ -640,11 +731,27 @@ fn code_for_union( let mut code = String::new(); // init override handling - let init_override_name = format!("{}__init_override", obj.snake_case_name()); - let (define_args, init_func) = if overrides.contains(&init_override_name) { - ("(init=False)".to_owned(), init_override_name.clone()) + let old_init_override_name = format!("{}__init_override", obj.snake_case_name()); + let define_args = if obj_ext.has_init || overrides.contains(&old_init_override_name) { + "(init=False)".to_owned() } else { - (String::new(), String::new()) + String::new() + }; + + let mut superclasses = vec![]; + + if *kind == ObjectKind::Archetype { + superclasses.push("Archetype"); + } + + if obj_ext.found { + superclasses.push(obj_ext.name.as_str()); + } + + let superclass_decl = if !superclasses.is_empty() { + format!("({})", superclasses.join(",")) + } else { + String::new() }; code.push_unindented_text( @@ -652,7 +759,7 @@ fn code_for_union( r#" @define{define_args} - class {name}: + class {name}{superclass_decl}: "# ), 0, @@ -660,15 +767,32 @@ fn code_for_union( code.push_text(quote_doc_from_docs(docs), 0, 4); - if init_func.is_empty() { - code.push_text(format!("# You can define your own __init__ function by defining a function called {init_override_name:?}"), 2, 4); - } else { + if obj_ext.has_init { + code.push_text( + format!("# __init__ can be found in {}", obj_ext.file_name), + 2, + 4, + ); + } else if overrides.contains(&old_init_override_name) { code.push_text( "def __init__(self, *args, **kwargs): #type: ignore[no-untyped-def]", 1, 4, ); - code.push_text(format!("{init_func}(self, *args, **kwargs)"), 2, 8); + code.push_text( + format!("{old_init_override_name}(self, *args, **kwargs)"), + 2, + 8, + ); + } else { + code.push_text( + format!( + "# You can define your own __init__ function as a member of {} in {}", + obj_ext.name, obj_ext.file_name + ), + 2, + 4, + ); } let field_types = fields @@ -691,9 +815,17 @@ fn code_for_union( }; // components and datatypes have converters only if manually provided - let converter_override_name = format!("{}__inner_converter_override", obj.snake_case_name()); - let converter = if overrides.contains(&converter_override_name) { - format!("converter={converter_override_name}") + let old_converter_override_name = + format!("{}__inner_converter_override", obj.snake_case_name()); + let converter_override_name = "inner_converter_override".to_owned(); + + let converter = if obj_ext + .field_converter_overrides + .contains(&converter_override_name) + { + format!("converter={}.{converter_override_name}", obj_ext.name) + } else if overrides.contains(&old_converter_override_name) { + format!("converter={old_converter_override_name}") } else if !default_converter.is_empty() { format!("converter={default_converter}") } else { @@ -802,6 +934,7 @@ fn quote_doc_from_fields(objects: &Objects, fields: &Vec) -> String /// /// Only applies to datatypes and components. fn quote_array_method_from_obj( + obj_ext: &ObjectExt, overrides: &HashSet, objects: &Objects, obj: &Object, @@ -810,12 +943,14 @@ fn quote_array_method_from_obj( let typ = quote_field_type_from_field(objects, &obj.fields[0], false).0; // allow overriding the __array__ function - let override_name = format!("{}__as_array_override", obj.snake_case_name()); - if overrides.contains(&override_name) { + let old_override_name = format!("{}__as_array_override", obj.snake_case_name()); + if obj_ext.has_array { + return format!("# __array__ can be found in {}", obj_ext.file_name); + } else if overrides.contains(&old_override_name) { return unindent::unindent(&format!( " def __array__(self, dtype: npt.DTypeLike=None) -> npt.NDArray[Any]: - return {override_name}(self, dtype=dtype) + return {old_override_name}(self, dtype=dtype) " )); } @@ -834,9 +969,10 @@ fn quote_array_method_from_obj( unindent::unindent(&format!( " def __array__(self, dtype: npt.DTypeLike=None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named {override_name:?} + # You can define your own __array__ function as a member of {} in {} return np.asarray(self.{field_name}, dtype=dtype) ", + obj_ext.name, obj_ext.file_name )) } @@ -1259,7 +1395,7 @@ fn quote_arrow_support_from_delegating_component(obj: &Object, dtype_obj: &Objec /// delegate to the Datatype's arrow support. fn quote_arrow_support_from_obj( arrow_registry: &ArrowRegistry, - obj_ext: Option<&ObjExt>, + obj_ext: &ObjectExt, overrides: &HashSet, obj: &Object, ) -> String { @@ -1287,21 +1423,18 @@ fn quote_arrow_support_from_obj( .unwrap_or_else(|| fqname.clone()); let old_override_name = format!("{}__native_to_pa_array_override", obj.snake_case_name()); - let override_name = "native_to_pa_array_override".to_owned(); - let override_ = if obj_ext.map_or(false, |obj_ext| obj_ext.overrides.contains(&override_name)) { + let override_ = if obj_ext.has_native_to_pa_array { format!( - "return {}.{override_name}(data, data_type)", - obj_ext.unwrap().ext_name + "return {}.{NATIVE_TO_PA_ARRAY_METHOD}(data, data_type)", + obj_ext.name ) } else if overrides.contains(&old_override_name) { format!("return {old_override_name}(data, data_type)") } else { - let override_file_path = format!( - "rerun_py/rerun_sdk/rerun/_rerun2/{}/{}_ext.py", - obj.kind.plural_snake_case(), - obj.snake_case_name() - ); - format!("raise NotImplementedError # You need to implement {override_name:?} in {override_file_path}") + format!( + "raise NotImplementedError # You need to implement {NATIVE_TO_PA_ARRAY_METHOD} in {}", + obj_ext.file_name + ) }; unindent::unindent(&format!( From 936beb1c3f4eda3ab09be38f4b5d273419db50bc Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Tue, 12 Sep 2023 21:48:56 +0200 Subject: [PATCH 06/18] Mypy being stupid --- crates/re_types_builder/src/codegen/python.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index 5d8a0830f9dc..1ffe9b332537 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -648,11 +648,12 @@ fn code_for_struct( }; let converter = &field_converters[&field.fqname]; + // Note: mypy gets confused using staticmethods for field-converters let typ = if !*is_nullable { - format!("{typ} = field({metadata}{converter})") + format!("{typ} = field({metadata}{converter}) # type: ignore[misc]") } else { format!( - "{typ} | None = field({metadata}default=None{}{converter})", + "{typ} | None = field({metadata}default=None{}{converter}) # type: ignore[misc]", if converter.is_empty() { "" } else { ", " }, ) }; @@ -832,7 +833,12 @@ fn code_for_union( String::new() }; - code.push_text(format!("inner: {inner_type} = field({converter})"), 1, 4); + // Note: mypy gets confused using staticmethods for field-converters + code.push_text( + format!("inner: {inner_type} = field({converter}) # type: ignore[misc]"), + 1, + 4, + ); code.push_text(quote_doc_from_fields(objects, fields), 0, 4); // if there are duplicate types, we need to add a `kind` field to disambiguate the union From 011347aa9cbbeb42e13656321ac791b75fb6296e Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Tue, 12 Sep 2023 21:49:18 +0200 Subject: [PATCH 07/18] Update docs --- rerun_py/ARCHITECTURE.md | 51 ++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/rerun_py/ARCHITECTURE.md b/rerun_py/ARCHITECTURE.md index 017b5cb8e317..c521ddfdf606 100644 --- a/rerun_py/ARCHITECTURE.md +++ b/rerun_py/ARCHITECTURE.md @@ -76,32 +76,57 @@ Datatypes primary concern is modelling well-defined data structures, including a Contrary to archetypes and components, datatypes occasionally represent complex data structures, such as `Transform3D`, made of nested structs and unions. The latter, lacking an obvious counterpart in Python, calls for a specific treatment (see below for details). -## Overrides +## Extensions Though a fully automatic generation of an SDK conforming to our stated goals of ease-of-use and Pythonic API is asymptotically feasible, the effort required is disproportionate. The code generator thus offers a number of hooks allowing parts of the SDK to be hand-coded to handle edge cases and fine-tune the user-facing API. This section covers the available hooks. -#### Native object init method (`objectname_init()`) +### The TypeExt class -This hook expose `attrs` ability to provide custom `__init__()` class method. The override implementation may typically make use of the `__attrs_init__()` function, which `attrs` [generates](https://www.attrs.org/en/stable/init.html#custom-init) in lieu of its default `__init__()` implementation. +During codegen, each class looks for a file: `class_ext.py` in the same directory where the class +will be generated. For example `datatypes/color_ext.py` is the extension file for the `Color` datatype, +which can be found in `datatypes/color.py`. -Init method overrides are typically used when the default constructor provided by `attrs` doesn't provide a satisfactory API. See `datatypes/_overrides/angle.py` for an example. +In this file you must define a class called `Ext` that will be added as a mixin to the generated class. -#### Native object field converter (`objectname_fieldname_converter()`) +#### Native object init method (`__init__()`) -This hook enable native objects to accept flexible input for their fields while normalising their content to a well-defined type. As this is a key enabler of a Pythonic user-facing API, most fields should have a converter set. The code generator attempts to provide meaningful default converter whenever possible +By default, the generated class uses `attrs` to generate an `__init__()` method that accepts keyword arguments for each field. -See `components/_overrides/color.py` for an example. +However, if your extension class includes its own `__init__()` method, the generated class will be created with +`@define(init=False)` so that `__init__` will instead be called on the extension class. -#### Native object Numpy conversion method (`objectname_as_array()`) +The override implementation may make use of the `__attrs_init__()` function, which `attrs` +[generates](https://www.attrs.org/en/stable/init.html#custom-init) to call through to the generated `__init__()` method +that would otherwise have been generated. -This hook is used to provide an `__array__()` function to a native object, which in turn allows Numpy to automatically ingest instances of that class in a controlled way. This can in turn facilitate the implementation of the PyArrow array conversion overrides. See `datatypes/_overrides/point2d.py` for an example. +Init method overrides are typically used when the default constructor provided by `attrs` doesn't provide a satisfactory API. See `datatypes/angle_ext.py` for an example. -#### PyArrow array conversion method (`objectname_native_to_pa_array`) +#### Native object field converter (`fieldname__field_converter_override()`) -This hook is the primary means of providing serialisation to Arrow data, which is required for any non-delegating component or datatypes used by delegating components. +This hook enables native objects to accept flexible input for their fields while normalizing their content to a +well-defined type. As this is a key enabler of a Pythonic user-facing API, most fields should have a converter set. The +code generator attempts to provide meaningful default converter whenever possible +The extension can define a custom converter for any field by implementing a `staticmethod` on the extension class. +The function must match the pattern `__field_converter_override`. This will be added as the `converter` +argument to the corresponding field definition. + +See `components/color_ext.py` for an example. + +#### Native object Numpy conversion method (`__array__()`) + +If an object can be natively converted to a numpy array it should implement the `__array__()` method, which in turn +allows Numpy to automatically ingest instances of that class in a controlled way. + +By default, this will be generated automatically for types which only contain a single field which is a numpy array. However, +other types can still implement this method on the extension class directly, in which case the default implementation will +be skipped. + +#### PyArrow array conversion method (`native_to_pa_array_override()`) + +This hook is the primary means of providing serialization to Arrow data, which is required for any non-delegating component or datatypes used by delegating components. ## Design notes on code generation @@ -121,9 +146,9 @@ TODO(ab): Implementing a Pythonic API for a component or datatype sometime require a subtle interplay between various hand-coded overrides and auto-generated methods. The `Color` component is a good illustration: -- The `color_rgba_converter()` converter flexibly normalises user input into a `int` RGBA storage. +- The `rgba__field_converter_override()` converter flexibly normalises user input into a `int` RGBA storage. - The auto-generated `__int__()` method facilitates the conversion of a `Color` instance into a `int`, which is recognised by Numpy array creation functions. -- The `color_native_to_pa_array()` exploits these capabilities of the `Color` native object to simplify its implementation (even though, in most cases, the user code wills skip using actual `Color` instances). +- The `native_to_pa_array()` exploits these capabilities of the `Color` native object to simplify its implementation (even though, in most cases, the user code wills skip using actual `Color` instances). ### Converter must be functions From 099fa273ef527d81ea553eede67e7bc26994b4cd Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Tue, 12 Sep 2023 21:50:18 +0200 Subject: [PATCH 08/18] Migrate color and angle to new style --- .../_rerun2/datatypes/_overrides/__init__.py | 2 - .../_rerun2/datatypes/_overrides/angle.py | 15 --- .../_rerun2/datatypes/_overrides/color.py | 94 ------------------ .../rerun/_rerun2/datatypes/angle_ext.py | 13 +++ .../rerun/_rerun2/datatypes/color_ext.py | 97 +++++++++++++++++++ 5 files changed, 110 insertions(+), 111 deletions(-) delete mode 100644 rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/angle.py delete mode 100644 rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/color.py create mode 100644 rerun_py/rerun_sdk/rerun/_rerun2/datatypes/angle_ext.py create mode 100644 rerun_py/rerun_sdk/rerun/_rerun2/datatypes/color_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/__init__.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/__init__.py index 6816a573a3f3..ab325c332531 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/__init__.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/__init__.py @@ -1,6 +1,5 @@ from __future__ import annotations -from .angle import angle__init_override from .annotation_context import ( annotation_info__native_to_pa_array_override, class_description__info__field_converter_override, @@ -12,7 +11,6 @@ keypoint_pair__native_to_pa_array_override, ) from .class_id import class_id__native_to_pa_array_override -from .color import color__native_to_pa_array_override, color__rgba__field_converter_override from .keypoint_id import keypoint_id__native_to_pa_array_override from .matnxn import mat3x3__coeffs__field_converter_override, mat4x4__coeffs__field_converter_override from .quaternion import quaternion__init_override diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/angle.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/angle.py deleted file mode 100644 index e3c9821ee61a..000000000000 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/angle.py +++ /dev/null @@ -1,15 +0,0 @@ -from __future__ import annotations - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from .. import Angle - - -def angle__init_override(self: Angle, rad: float | None = None, deg: float | None = None) -> None: - if rad is not None: - self.__attrs_init__(inner=rad, kind="radians") # pyright: ignore[reportGeneralTypeIssues] - elif deg is not None: - self.__attrs_init__(inner=deg, kind="degrees") # pyright: ignore[reportGeneralTypeIssues] - else: - raise ValueError("Either `rad` or `deg` must be provided.") diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/color.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/color.py deleted file mode 100644 index 41906ba85917..000000000000 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/color.py +++ /dev/null @@ -1,94 +0,0 @@ -""" -Overrides for `Color` datatype. - -Possible input for `Color`: -- Sequence[int]: interpreted as rgb or rgba values in 0-255 range -- numpy array: interpreted as rgb or rgba values, range depending on dtype -- anything else (int or convertible to int): interpreted as a 32-bit packed rgba value - -Possible inputs for `ColorArray.from_similar()`: -- a single `Color` instance -- a sequence of `Color` instances -- Nx3 or Nx4 numpy array, range depending on dtype -""" - -from __future__ import annotations - -from typing import TYPE_CHECKING, Sequence, Union, cast - -import numpy as np -import numpy.typing as npt -import pyarrow as pa - -from rerun.color_conversion import u8_array_to_rgba - -if TYPE_CHECKING: - from .. import ColorArrayLike, ColorLike - - -def _numpy_array_to_u32(data: npt.NDArray[np.uint8 | np.float32 | np.float64]) -> npt.NDArray[np.uint32]: - if data.size == 0: - return np.array([], dtype=np.uint32) - - if data.dtype.type in [np.float32, np.float64]: - array = u8_array_to_rgba(np.asarray(np.round(np.asarray(data) * 255.0), np.uint8)) - elif data.dtype.type == np.uint32: - array = np.asarray(data, dtype=np.uint32).flatten() - else: - array = u8_array_to_rgba(np.asarray(data, dtype=np.uint8)) - return array - - -def color__rgba__field_converter_override(data: ColorLike) -> int: - from .. import Color - - if isinstance(data, Color): - return data.rgba - if isinstance(data, np.ndarray): - return int(_numpy_array_to_u32(data.reshape((1, -1)))[0]) - elif isinstance(data, Sequence): - data = np.array(data).reshape((1, -1)) - if data.shape[1] not in (3, 4): - raise ValueError(f"expected sequence of length of 3 or 4, received {data.shape[1]}") - return int(_numpy_array_to_u32(data)[0]) - else: - return int(data) - - -def color__native_to_pa_array_override(data: ColorArrayLike, data_type: pa.DataType) -> pa.Array: - from .. import Color - - if isinstance(data, (Color, int)): - data = [data] - - if isinstance(data, np.ndarray): - if data.dtype == np.uint32: - # these are already packed values - array = data.flatten() - else: - # these are component values - if len(data.shape) == 1: - if data.size > 4: - # multiple RGBA colors - data = data.reshape((-1, 4)) - else: - # a single color - data = data.reshape((1, -1)) - array = _numpy_array_to_u32(cast(npt.NDArray[Union[np.uint8, np.float32, np.float64]], data)) - else: - data_list = list(data) - - # does that array d - try: - # try to build a single color with that - # if we cannot, data must represent an array of colors - data_list = [Color(data_list)] # type: ignore[arg-type] - except (IndexError, ValueError): - pass - - # Handle heterogeneous sequence of Color-like object, such as Color instances, ints, sub-sequence, etc. - # Note how this is simplified by the flexible implementation of `Color`, thanks to its converter function and - # the auto-generated `__int__()` method. - array = np.array([Color(datum) for datum in data_list], np.uint32) - - return pa.array(array, type=data_type) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/angle_ext.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/angle_ext.py new file mode 100644 index 000000000000..f008cbc41a87 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/angle_ext.py @@ -0,0 +1,13 @@ +from __future__ import annotations + +from typing import Any + + +class AngleExt: + def __init__(self: Any, rad: float | None = None, deg: float | None = None) -> None: + if rad is not None: + self.__attrs_init__(inner=rad, kind="radians") # pyright: ignore[reportGeneralTypeIssues] + elif deg is not None: + self.__attrs_init__(inner=deg, kind="degrees") # pyright: ignore[reportGeneralTypeIssues] + else: + raise ValueError("Either `rad` or `deg` must be provided.") diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/color_ext.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/color_ext.py new file mode 100644 index 000000000000..a453059f4891 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/color_ext.py @@ -0,0 +1,97 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Sequence, Union, cast + +import numpy as np +import numpy.typing as npt +import pyarrow as pa + +from rerun.color_conversion import u8_array_to_rgba + +if TYPE_CHECKING: + from . import ColorArrayLike, ColorLike + + +def _numpy_array_to_u32(data: npt.NDArray[np.uint8 | np.float32 | np.float64]) -> npt.NDArray[np.uint32]: + if data.size == 0: + return np.array([], dtype=np.uint32) + + if data.dtype.type in [np.float32, np.float64]: + array = u8_array_to_rgba(np.asarray(np.round(np.asarray(data) * 255.0), np.uint8)) + elif data.dtype.type == np.uint32: + array = np.asarray(data, dtype=np.uint32).flatten() + else: + array = u8_array_to_rgba(np.asarray(data, dtype=np.uint8)) + return array + + +class ColorExt: + """ + Extension for the `Color` datatype. + + Possible input for `Color`: + - Sequence[int]: interpreted as rgb or rgba values in 0-255 range + - numpy array: interpreted as rgb or rgba values, range depending on dtype + - anything else (int or convertible to int): interpreted as a 32-bit packed rgba value + + Possible inputs for `ColorArray.from_similar()`: + - a single `Color` instance + - a sequence of `Color` instances + - Nx3 or Nx4 numpy array, range depending on dtype + """ + + @staticmethod + def rgba__field_converter_override(data: ColorLike) -> int: + print("foo") + from . import Color + + if isinstance(data, Color): + return data.rgba + if isinstance(data, np.ndarray): + return int(_numpy_array_to_u32(data.reshape((1, -1)))[0]) + elif isinstance(data, Sequence): + data = np.array(data).reshape((1, -1)) + if data.shape[1] not in (3, 4): + raise ValueError(f"expected sequence of length of 3 or 4, received {data.shape[1]}") + return int(_numpy_array_to_u32(data)[0]) + else: + return int(data) + + @staticmethod + def native_to_pa_array_override(data: ColorArrayLike, data_type: pa.DataType) -> pa.Array: + from . import Color + + if isinstance(data, (Color, int)): + data = [data] + + if isinstance(data, np.ndarray): + if data.dtype == np.uint32: + # these are already packed values + array = data.flatten() + else: + # these are component values + if len(data.shape) == 1: + if data.size > 4: + # multiple RGBA colors + data = data.reshape((-1, 4)) + else: + # a single color + data = data.reshape((1, -1)) + array = _numpy_array_to_u32(cast(npt.NDArray[Union[np.uint8, np.float32, np.float64]], data)) + else: + data_list = list(data) + + # does that array d + try: + # try to build a single color with that + # if we cannot, data must represent an array of colors + data_list = [Color(data_list)] # type: ignore[arg-type] + except (IndexError, ValueError): + pass + + # Handle heterogeneous sequence of Color-like object, such as Color instances, ints, sub-sequence, etc. + # Note how this is simplified by the flexible implementation of `Color`, thanks to its converter function and + # the auto-generated `__int__()` method. + array = np.array([Color(datum) for datum in data_list], np.uint32) + + return pa.array(array, type=data_type) From d9949afd55f5ae56570e3dfca6185d37aa419b72 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Tue, 12 Sep 2023 21:53:17 +0200 Subject: [PATCH 09/18] codegen --- crates/re_types/source_hash.txt | 2 +- .../rerun/_rerun2/archetypes/affix_fuzzer1.py | 150 +++++++++--------- .../_rerun2/archetypes/annotation_context.py | 4 +- .../rerun/_rerun2/archetypes/arrows3d.py | 16 +- .../rerun/_rerun2/archetypes/boxes2d.py | 18 +-- .../rerun/_rerun2/archetypes/depth_image.py | 8 +- .../_rerun2/archetypes/disconnected_space.py | 4 +- .../rerun/_rerun2/archetypes/image.py | 6 +- .../rerun/_rerun2/archetypes/line_strips2d.py | 16 +- .../rerun/_rerun2/archetypes/line_strips3d.py | 14 +- .../rerun/_rerun2/archetypes/points2d.py | 18 +-- .../rerun/_rerun2/archetypes/points3d.py | 16 +- .../_rerun2/archetypes/segmentation_image.py | 6 +- .../rerun/_rerun2/archetypes/tensor.py | 4 +- .../rerun/_rerun2/archetypes/text_document.py | 4 +- .../rerun/_rerun2/archetypes/text_log.py | 8 +- .../rerun/_rerun2/archetypes/transform3d.py | 4 +- .../_rerun2/components/affix_fuzzer10.py | 6 +- .../_rerun2/components/affix_fuzzer11.py | 8 +- .../_rerun2/components/affix_fuzzer12.py | 6 +- .../_rerun2/components/affix_fuzzer13.py | 6 +- .../_rerun2/components/affix_fuzzer16.py | 6 +- .../_rerun2/components/affix_fuzzer17.py | 6 +- .../_rerun2/components/affix_fuzzer18.py | 6 +- .../rerun/_rerun2/components/affix_fuzzer7.py | 6 +- .../rerun/_rerun2/components/affix_fuzzer8.py | 8 +- .../rerun/_rerun2/components/affix_fuzzer9.py | 6 +- .../_rerun2/components/annotation_context.py | 6 +- .../rerun/_rerun2/components/depth_meter.py | 6 +- .../_rerun2/components/disconnected_space.py | 4 +- .../rerun/_rerun2/components/draw_order.py | 6 +- .../rerun/_rerun2/components/instance_key.py | 6 +- .../rerun/_rerun2/components/line_strip2d.py | 4 +- .../rerun/_rerun2/components/line_strip3d.py | 4 +- .../rerun/_rerun2/components/radius.py | 6 +- .../rerun/_rerun2/datatypes/affix_fuzzer1.py | 24 ++- .../rerun/_rerun2/datatypes/affix_fuzzer2.py | 8 +- .../rerun/_rerun2/datatypes/affix_fuzzer20.py | 8 +- .../rerun/_rerun2/datatypes/affix_fuzzer3.py | 6 +- .../rerun/_rerun2/datatypes/affix_fuzzer4.py | 6 +- .../rerun/_rerun2/datatypes/affix_fuzzer5.py | 8 +- .../rerun/_rerun2/datatypes/angle.py | 11 +- .../_rerun2/datatypes/annotation_info.py | 12 +- .../_rerun2/datatypes/class_description.py | 10 +- .../datatypes/class_description_map_elem.py | 8 +- .../rerun/_rerun2/datatypes/class_id.py | 6 +- .../rerun/_rerun2/datatypes/color.py | 12 +- .../_rerun2/datatypes/flattened_scalar.py | 8 +- .../rerun/_rerun2/datatypes/float32.py | 8 +- .../rerun/_rerun2/datatypes/keypoint_id.py | 6 +- .../rerun/_rerun2/datatypes/keypoint_pair.py | 6 +- .../rerun/_rerun2/datatypes/mat3x3.py | 8 +- .../rerun/_rerun2/datatypes/mat4x4.py | 8 +- .../_rerun2/datatypes/primitive_component.py | 8 +- .../rerun/_rerun2/datatypes/quaternion.py | 6 +- .../rerun/_rerun2/datatypes/rotation3d.py | 6 +- .../_rerun2/datatypes/rotation_axis_angle.py | 8 +- .../rerun/_rerun2/datatypes/scale3d.py | 6 +- .../_rerun2/datatypes/string_component.py | 6 +- .../rerun/_rerun2/datatypes/tensor_buffer.py | 16 +- .../rerun/_rerun2/datatypes/tensor_data.py | 4 +- .../_rerun2/datatypes/tensor_dimension.py | 8 +- .../rerun/_rerun2/datatypes/transform3d.py | 4 +- .../datatypes/translation_and_mat3x3.py | 12 +- .../datatypes/translation_rotation_scale3d.py | 16 +- .../rerun_sdk/rerun/_rerun2/datatypes/utf8.py | 4 +- .../rerun/_rerun2/datatypes/vec2d.py | 6 +- .../rerun/_rerun2/datatypes/vec3d.py | 6 +- .../rerun/_rerun2/datatypes/vec4d.py | 6 +- 69 files changed, 327 insertions(+), 362 deletions(-) diff --git a/crates/re_types/source_hash.txt b/crates/re_types/source_hash.txt index 236f54a1ad6d..960245236e19 100644 --- a/crates/re_types/source_hash.txt +++ b/crates/re_types/source_hash.txt @@ -1,4 +1,4 @@ # This is a sha256 hash for all direct and indirect dependencies of this crate's build script. # It can be safely removed at anytime to force the build script to run again. # Check out build.rs to see how it's computed. -22461923ffef9bf0406a923e85da1651701a76a0d5ed8df700481658aa5f659d +ff7b8cdfe54da0cd3ea9a28ec29912164de760a6cc1b26e6b7fdf2f70257ff87 diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/affix_fuzzer1.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/affix_fuzzer1.py index 9eddb0c090bb..1d63233d00b7 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/affix_fuzzer1.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/affix_fuzzer1.py @@ -16,339 +16,339 @@ @define(str=False, repr=False) class AffixFuzzer1(Archetype): - # You can define your own __init__ function by defining a function called "affix_fuzzer1__init_override" + # You can define your own __init__ function as a member of AffixFuzzer1Ext in affix_fuzzer1_ext.py fuzz1001: components.AffixFuzzer1Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer1Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1002: components.AffixFuzzer2Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer2Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1003: components.AffixFuzzer3Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer3Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1004: components.AffixFuzzer4Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer4Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1005: components.AffixFuzzer5Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer5Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1006: components.AffixFuzzer6Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer6Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1007: components.AffixFuzzer7Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer7Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1008: components.AffixFuzzer8Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer8Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1009: components.AffixFuzzer9Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer9Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1010: components.AffixFuzzer10Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer10Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1011: components.AffixFuzzer11Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer11Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1012: components.AffixFuzzer12Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer12Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1013: components.AffixFuzzer13Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer13Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1014: components.AffixFuzzer14Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer14Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1015: components.AffixFuzzer15Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer15Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1016: components.AffixFuzzer16Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer16Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1017: components.AffixFuzzer17Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer17Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1018: components.AffixFuzzer18Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer18Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1019: components.AffixFuzzer19Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer19Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1020: components.AffixFuzzer20Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer20Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1101: components.AffixFuzzer1Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer1Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1102: components.AffixFuzzer2Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer2Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1103: components.AffixFuzzer3Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer3Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1104: components.AffixFuzzer4Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer4Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1105: components.AffixFuzzer5Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer5Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1106: components.AffixFuzzer6Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer6Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1107: components.AffixFuzzer7Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer7Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1108: components.AffixFuzzer8Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer8Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1109: components.AffixFuzzer9Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer9Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1110: components.AffixFuzzer10Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer10Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1111: components.AffixFuzzer11Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer11Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1112: components.AffixFuzzer12Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer12Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1113: components.AffixFuzzer13Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer13Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1114: components.AffixFuzzer14Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer14Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1115: components.AffixFuzzer15Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer15Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1116: components.AffixFuzzer16Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer16Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1117: components.AffixFuzzer17Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer17Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz1118: components.AffixFuzzer18Array = field( metadata={"component": "primary"}, converter=components.AffixFuzzer18Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2001: components.AffixFuzzer1Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer1Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2002: components.AffixFuzzer2Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer2Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2003: components.AffixFuzzer3Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer3Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2004: components.AffixFuzzer4Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer4Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2005: components.AffixFuzzer5Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer5Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2006: components.AffixFuzzer6Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer6Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2007: components.AffixFuzzer7Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer7Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2008: components.AffixFuzzer8Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer8Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2009: components.AffixFuzzer9Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer9Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2010: components.AffixFuzzer10Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer10Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2011: components.AffixFuzzer11Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer11Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2012: components.AffixFuzzer12Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer12Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2013: components.AffixFuzzer13Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer13Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2014: components.AffixFuzzer14Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer14Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2015: components.AffixFuzzer15Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer15Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2016: components.AffixFuzzer16Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer16Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2017: components.AffixFuzzer17Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer17Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2018: components.AffixFuzzer18Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer18Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2101: components.AffixFuzzer1Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer1Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2102: components.AffixFuzzer2Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer2Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2103: components.AffixFuzzer3Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer3Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2104: components.AffixFuzzer4Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer4Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2105: components.AffixFuzzer5Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer5Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2106: components.AffixFuzzer6Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer6Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2107: components.AffixFuzzer7Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer7Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2108: components.AffixFuzzer8Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer8Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2109: components.AffixFuzzer9Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer9Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2110: components.AffixFuzzer10Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer10Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2111: components.AffixFuzzer11Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer11Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2112: components.AffixFuzzer12Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer12Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2113: components.AffixFuzzer13Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer13Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2114: components.AffixFuzzer14Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer14Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2115: components.AffixFuzzer15Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer15Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2116: components.AffixFuzzer16Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer16Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2117: components.AffixFuzzer17Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer17Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] fuzz2118: components.AffixFuzzer18Array | None = field( metadata={"component": "secondary"}, default=None, converter=components.AffixFuzzer18Array.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] __str__ = Archetype.__str__ __repr__ = Archetype.__repr__ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/annotation_context.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/annotation_context.py index 6f9c56a2a6c0..eff1945a7b91 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/annotation_context.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/annotation_context.py @@ -45,11 +45,11 @@ class AnnotationContext(Archetype): ``` """ - # You can define your own __init__ function by defining a function called "annotation_context__init_override" + # You can define your own __init__ function as a member of AnnotationContextExt in annotation_context_ext.py context: components.AnnotationContextArray = field( metadata={"component": "primary"}, converter=components.AnnotationContextArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] __str__ = Archetype.__str__ __repr__ = Archetype.__repr__ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/arrows3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/arrows3d.py index 48ba6c3ee3be..c545bf9b2e1d 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/arrows3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/arrows3d.py @@ -39,12 +39,12 @@ class Arrows3D(Archetype): ``` """ - # You can define your own __init__ function by defining a function called "arrows3d__init_override" + # You can define your own __init__ function as a member of Arrows3DExt in arrows3d_ext.py vectors: components.Vector3DArray = field( metadata={"component": "primary"}, converter=components.Vector3DArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ All the vectors for each arrow in the batch. """ @@ -53,7 +53,7 @@ class Arrows3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.Origin3DArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ All the origin points for each arrow in the batch. """ @@ -62,7 +62,7 @@ class Arrows3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.RadiusArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional radii for the arrows. @@ -74,7 +74,7 @@ class Arrows3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.ColorArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional colors for the points. """ @@ -83,7 +83,7 @@ class Arrows3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.TextArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional text labels for the arrows. """ @@ -92,7 +92,7 @@ class Arrows3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.ClassIdArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional class Ids for the points. @@ -103,7 +103,7 @@ class Arrows3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.InstanceKeyArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Unique identifiers for each individual point in the batch. """ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/boxes2d.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/boxes2d.py index 46d2ac9a1810..3aaf3aedb3f5 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/boxes2d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/boxes2d.py @@ -36,12 +36,12 @@ class Boxes2D(Archetype): ``` """ - # You can define your own __init__ function by defining a function called "boxes2d__init_override" + # You can define your own __init__ function as a member of Boxes2DExt in boxes2d_ext.py half_sizes: components.HalfSizes2DArray = field( metadata={"component": "primary"}, converter=components.HalfSizes2DArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ All half-extents that make up the batch of boxes. """ @@ -50,7 +50,7 @@ class Boxes2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.Origin2DArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional center positions of the boxes. """ @@ -59,7 +59,7 @@ class Boxes2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.RadiusArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional radii for the lines that make up the boxes. """ @@ -68,7 +68,7 @@ class Boxes2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.ColorArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional colors for the boxes. """ @@ -77,7 +77,7 @@ class Boxes2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.TextArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional text labels for the boxes. """ @@ -86,7 +86,7 @@ class Boxes2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.DrawOrderArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ An optional floating point value that specifies the 2D drawing order. Objects with higher values are drawn on top of those with lower values. @@ -98,7 +98,7 @@ class Boxes2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.ClassIdArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional `ClassId`s for the boxes. @@ -109,7 +109,7 @@ class Boxes2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.InstanceKeyArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Unique identifiers for each individual boxes in the batch. """ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/depth_image.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/depth_image.py index 3fcade16e13c..eafa5f39ef71 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/depth_image.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/depth_image.py @@ -43,11 +43,11 @@ class DepthImage(Archetype): ``` """ - # You can define your own __init__ function by defining a function called "depth_image__init_override" + # You can define your own __init__ function as a member of DepthImageExt in depth_image_ext.py data: components.TensorDataArray = field( metadata={"component": "primary"}, converter=depth_image__data__field_converter_override - ) + ) # type: ignore[misc] """ The depth-image data. Should always be a rank-2 tensor. """ @@ -56,7 +56,7 @@ class DepthImage(Archetype): metadata={"component": "secondary"}, default=None, converter=components.DepthMeterArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ An optional floating point value that specifies how long a meter is in the native depth units. @@ -68,7 +68,7 @@ class DepthImage(Archetype): metadata={"component": "secondary"}, default=None, converter=components.DrawOrderArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ An optional floating point value that specifies the 2D drawing order. Objects with higher values are drawn on top of those with lower values. diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/disconnected_space.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/disconnected_space.py index a137a7ce0800..a4f1eed42e38 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/disconnected_space.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/disconnected_space.py @@ -42,11 +42,11 @@ class DisconnectedSpace(Archetype): ``` """ - # You can define your own __init__ function by defining a function called "disconnected_space__init_override" + # You can define your own __init__ function as a member of DisconnectedSpaceExt in disconnected_space_ext.py disconnected_space: components.DisconnectedSpaceArray = field( metadata={"component": "primary"}, converter=components.DisconnectedSpaceArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] __str__ = Archetype.__str__ __repr__ = Archetype.__repr__ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/image.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/image.py index 1664330d316f..786e48203e32 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/image.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/image.py @@ -47,11 +47,11 @@ class Image(Archetype): ``` """ - # You can define your own __init__ function by defining a function called "image__init_override" + # You can define your own __init__ function as a member of ImageExt in image_ext.py data: components.TensorDataArray = field( metadata={"component": "primary"}, converter=image__data__field_converter_override - ) + ) # type: ignore[misc] """ The image data. Should always be a rank-2 or rank-3 tensor. """ @@ -60,7 +60,7 @@ class Image(Archetype): metadata={"component": "secondary"}, default=None, converter=components.DrawOrderArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ An optional floating point value that specifies the 2D drawing order. Objects with higher values are drawn on top of those with lower values. diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/line_strips2d.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/line_strips2d.py index f69fb0c8d3ac..19fde3d16e0b 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/line_strips2d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/line_strips2d.py @@ -63,12 +63,12 @@ class LineStrips2D(Archetype): ``` """ - # You can define your own __init__ function by defining a function called "line_strips2d__init_override" + # You can define your own __init__ function as a member of LineStrips2DExt in line_strips2d_ext.py strips: components.LineStrip2DArray = field( metadata={"component": "primary"}, converter=components.LineStrip2DArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ All the actual 2D line strips that make up the batch. """ @@ -77,7 +77,7 @@ class LineStrips2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.RadiusArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional radii for the line strips. """ @@ -86,7 +86,7 @@ class LineStrips2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.ColorArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional colors for the line strips. """ @@ -95,7 +95,7 @@ class LineStrips2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.TextArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional text labels for the line strips. """ @@ -104,7 +104,7 @@ class LineStrips2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.DrawOrderArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ An optional floating point value that specifies the 2D drawing order of each line strip. Objects with higher values are drawn on top of those with lower values. @@ -114,7 +114,7 @@ class LineStrips2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.ClassIdArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional `ClassId`s for the lines. @@ -125,7 +125,7 @@ class LineStrips2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.InstanceKeyArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Unique identifiers for each individual line strip in the batch. """ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/line_strips3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/line_strips3d.py index 34db8179f652..64d30cc9c9cb 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/line_strips3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/line_strips3d.py @@ -81,12 +81,12 @@ class LineStrips3D(Archetype): ``` """ - # You can define your own __init__ function by defining a function called "line_strips3d__init_override" + # You can define your own __init__ function as a member of LineStrips3DExt in line_strips3d_ext.py strips: components.LineStrip3DArray = field( metadata={"component": "primary"}, converter=components.LineStrip3DArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ All the actual 3D line strips that make up the batch. """ @@ -95,7 +95,7 @@ class LineStrips3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.RadiusArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional radii for the line strips. """ @@ -104,7 +104,7 @@ class LineStrips3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.ColorArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional colors for the line strips. """ @@ -113,7 +113,7 @@ class LineStrips3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.TextArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional text labels for the line strips. """ @@ -122,7 +122,7 @@ class LineStrips3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.ClassIdArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional `ClassId`s for the lines. @@ -133,7 +133,7 @@ class LineStrips3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.InstanceKeyArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Unique identifiers for each individual line strip in the batch. """ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/points2d.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/points2d.py index 35ce36177858..158293de23af 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/points2d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/points2d.py @@ -34,12 +34,12 @@ class Points2D(Archetype): ``` """ - # You can define your own __init__ function by defining a function called "points2d__init_override" + # You can define your own __init__ function as a member of Points2DExt in points2d_ext.py points: components.Point2DArray = field( metadata={"component": "primary"}, converter=components.Point2DArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ All the actual 2D points that make up the point cloud. """ @@ -48,7 +48,7 @@ class Points2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.RadiusArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional radii for the points, effectively turning them into circles. """ @@ -57,7 +57,7 @@ class Points2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.ColorArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional colors for the points. @@ -69,7 +69,7 @@ class Points2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.TextArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional text labels for the points. """ @@ -78,7 +78,7 @@ class Points2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.DrawOrderArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ An optional floating point value that specifies the 2D drawing order. Objects with higher values are drawn on top of those with lower values. @@ -88,7 +88,7 @@ class Points2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.ClassIdArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional class Ids for the points. @@ -99,7 +99,7 @@ class Points2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.KeypointIdArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional keypoint IDs for the points, identifying them within a class. @@ -115,7 +115,7 @@ class Points2D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.InstanceKeyArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Unique identifiers for each individual point in the batch. """ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/points3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/points3d.py index e1ae13fa1eb0..c75ef039e4de 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/points3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/points3d.py @@ -31,12 +31,12 @@ class Points3D(Archetype): ``` """ - # You can define your own __init__ function by defining a function called "points3d__init_override" + # You can define your own __init__ function as a member of Points3DExt in points3d_ext.py points: components.Point3DArray = field( metadata={"component": "primary"}, converter=components.Point3DArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ All the actual 3D points that make up the point cloud. """ @@ -45,7 +45,7 @@ class Points3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.RadiusArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional radii for the points, effectively turning them into circles. """ @@ -54,7 +54,7 @@ class Points3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.ColorArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional colors for the points. @@ -66,7 +66,7 @@ class Points3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.TextArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional text labels for the points. """ @@ -75,7 +75,7 @@ class Points3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.ClassIdArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional class Ids for the points. @@ -86,7 +86,7 @@ class Points3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.KeypointIdArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Optional keypoint IDs for the points, identifying them within a class. @@ -102,7 +102,7 @@ class Points3D(Archetype): metadata={"component": "secondary"}, default=None, converter=components.InstanceKeyArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ Unique identifiers for each individual point in the batch. """ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/segmentation_image.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/segmentation_image.py index 012bc95155ed..9a2cc495d3ac 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/segmentation_image.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/segmentation_image.py @@ -49,11 +49,11 @@ class SegmentationImage(Archetype): ``` """ - # You can define your own __init__ function by defining a function called "segmentation_image__init_override" + # You can define your own __init__ function as a member of SegmentationImageExt in segmentation_image_ext.py data: components.TensorDataArray = field( metadata={"component": "primary"}, converter=segmentation_image__data__field_converter_override - ) + ) # type: ignore[misc] """ The image data. Should always be a rank-2 tensor. """ @@ -62,7 +62,7 @@ class SegmentationImage(Archetype): metadata={"component": "secondary"}, default=None, converter=components.DrawOrderArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ An optional floating point value that specifies the 2D drawing order. Objects with higher values are drawn on top of those with lower values. diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/tensor.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/tensor.py index 6295da2ef079..740eb7425695 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/tensor.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/tensor.py @@ -18,12 +18,12 @@ class Tensor(Archetype): """A generic n-dimensional Tensor.""" - # You can define your own __init__ function by defining a function called "tensor__init_override" + # You can define your own __init__ function as a member of TensorExt in tensor_ext.py data: components.TensorDataArray = field( metadata={"component": "primary"}, converter=components.TensorDataArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ The tensor data """ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/text_document.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/text_document.py index 10e93c6a5bf3..b35f188fb6af 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/text_document.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/text_document.py @@ -18,11 +18,11 @@ class TextDocument(Archetype): """A text element intended to be displayed in its own text-box.""" - # You can define your own __init__ function by defining a function called "text_document__init_override" + # You can define your own __init__ function as a member of TextDocumentExt in text_document_ext.py body: components.TextArray = field( metadata={"component": "primary"}, converter=components.TextArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] __str__ = Archetype.__str__ __repr__ = Archetype.__repr__ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/text_log.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/text_log.py index b93f9bd64c91..0d4054fd1d92 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/text_log.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/text_log.py @@ -18,21 +18,21 @@ class TextLog(Archetype): """A log entry in a text log, comprised of a text body and its log level.""" - # You can define your own __init__ function by defining a function called "text_log__init_override" + # You can define your own __init__ function as a member of TextLogExt in text_log_ext.py body: components.TextArray = field( metadata={"component": "primary"}, converter=components.TextArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] level: components.TextLogLevelArray | None = field( metadata={"component": "secondary"}, default=None, converter=components.TextLogLevelArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] color: components.ColorArray | None = field( metadata={"component": "secondary"}, default=None, converter=components.ColorArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] __str__ = Archetype.__str__ __repr__ = Archetype.__repr__ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/transform3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/transform3d.py index 40638692e602..da640531f7ba 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/transform3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/transform3d.py @@ -51,12 +51,12 @@ class Transform3D(Archetype): ``` """ - # You can define your own __init__ function by defining a function called "transform3d__init_override" + # You can define your own __init__ function as a member of Transform3DExt in transform3d_ext.py transform: components.Transform3DArray = field( metadata={"component": "primary"}, converter=components.Transform3DArray.from_similar, # type: ignore[misc] - ) + ) # type: ignore[misc] """ The transform """ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer10.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer10.py index fc25517b934c..6fdd3a970afb 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer10.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer10.py @@ -22,9 +22,9 @@ @define class AffixFuzzer10: - # You can define your own __init__ function by defining a function called "affix_fuzzer10__init_override" + # You can define your own __init__ function as a member of AffixFuzzer10Ext in affix_fuzzer10_ext.py - single_string_optional: str | None = field(default=None, converter=str_or_none) + single_string_optional: str | None = field(default=None, converter=str_or_none) # type: ignore[misc] AffixFuzzer10Like = AffixFuzzer10 @@ -48,7 +48,7 @@ class AffixFuzzer10Array(BaseExtensionArray[AffixFuzzer10ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer10ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer10__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/components/_overrides/affix_fuzzer10.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer10_ext.py AffixFuzzer10Type._ARRAY_TYPE = AffixFuzzer10Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer11.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer11.py index 57b496a6ba9f..d425b196eea3 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer11.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer11.py @@ -24,12 +24,12 @@ @define class AffixFuzzer11: - # You can define your own __init__ function by defining a function called "affix_fuzzer11__init_override" + # You can define your own __init__ function as a member of AffixFuzzer11Ext in affix_fuzzer11_ext.py - many_floats_optional: npt.NDArray[np.float32] | None = field(default=None, converter=to_np_float32) + many_floats_optional: npt.NDArray[np.float32] | None = field(default=None, converter=to_np_float32) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "affix_fuzzer11__as_array_override" + # You can define your own __array__ function as a member of AffixFuzzer11Ext in affix_fuzzer11_ext.py return np.asarray(self.many_floats_optional, dtype=dtype) @@ -58,7 +58,7 @@ class AffixFuzzer11Array(BaseExtensionArray[AffixFuzzer11ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer11ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer11__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/components/_overrides/affix_fuzzer11.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer11_ext.py AffixFuzzer11Type._ARRAY_TYPE = AffixFuzzer11Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer12.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer12.py index 2989ff4aa6f1..8e473fe6eef7 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer12.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer12.py @@ -19,9 +19,9 @@ @define class AffixFuzzer12: - # You can define your own __init__ function by defining a function called "affix_fuzzer12__init_override" + # You can define your own __init__ function as a member of AffixFuzzer12Ext in affix_fuzzer12_ext.py - many_strings_required: list[str] = field() + many_strings_required: list[str] = field() # type: ignore[misc] AffixFuzzer12Like = AffixFuzzer12 @@ -49,7 +49,7 @@ class AffixFuzzer12Array(BaseExtensionArray[AffixFuzzer12ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer12ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer12__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/components/_overrides/affix_fuzzer12.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer12_ext.py AffixFuzzer12Type._ARRAY_TYPE = AffixFuzzer12Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer13.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer13.py index a9bc998297ca..7588fc4c45a5 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer13.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer13.py @@ -19,9 +19,9 @@ @define class AffixFuzzer13: - # You can define your own __init__ function by defining a function called "affix_fuzzer13__init_override" + # You can define your own __init__ function as a member of AffixFuzzer13Ext in affix_fuzzer13_ext.py - many_strings_optional: list[str] | None = field(default=None) + many_strings_optional: list[str] | None = field(default=None) # type: ignore[misc] AffixFuzzer13Like = AffixFuzzer13 @@ -49,7 +49,7 @@ class AffixFuzzer13Array(BaseExtensionArray[AffixFuzzer13ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer13ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer13__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/components/_overrides/affix_fuzzer13.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer13_ext.py AffixFuzzer13Type._ARRAY_TYPE = AffixFuzzer13Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer16.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer16.py index 8a662a4d8c70..2dbf50670c5b 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer16.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer16.py @@ -20,9 +20,9 @@ @define class AffixFuzzer16: - # You can define your own __init__ function by defining a function called "affix_fuzzer16__init_override" + # You can define your own __init__ function as a member of AffixFuzzer16Ext in affix_fuzzer16_ext.py - many_required_unions: list[datatypes.AffixFuzzer3] = field() + many_required_unions: list[datatypes.AffixFuzzer3] = field() # type: ignore[misc] AffixFuzzer16Like = AffixFuzzer16 @@ -124,7 +124,7 @@ class AffixFuzzer16Array(BaseExtensionArray[AffixFuzzer16ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer16ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer16__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/components/_overrides/affix_fuzzer16.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer16_ext.py AffixFuzzer16Type._ARRAY_TYPE = AffixFuzzer16Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer17.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer17.py index a341f1e80199..da9ebeff02cc 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer17.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer17.py @@ -20,9 +20,9 @@ @define class AffixFuzzer17: - # You can define your own __init__ function by defining a function called "affix_fuzzer17__init_override" + # You can define your own __init__ function as a member of AffixFuzzer17Ext in affix_fuzzer17_ext.py - many_optional_unions: list[datatypes.AffixFuzzer3] | None = field(default=None) + many_optional_unions: list[datatypes.AffixFuzzer3] | None = field(default=None) # type: ignore[misc] AffixFuzzer17Like = AffixFuzzer17 @@ -124,7 +124,7 @@ class AffixFuzzer17Array(BaseExtensionArray[AffixFuzzer17ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer17ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer17__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/components/_overrides/affix_fuzzer17.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer17_ext.py AffixFuzzer17Type._ARRAY_TYPE = AffixFuzzer17Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer18.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer18.py index 74d0f0cdf7ff..016c25545370 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer18.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer18.py @@ -20,9 +20,9 @@ @define class AffixFuzzer18: - # You can define your own __init__ function by defining a function called "affix_fuzzer18__init_override" + # You can define your own __init__ function as a member of AffixFuzzer18Ext in affix_fuzzer18_ext.py - many_optional_unions: list[datatypes.AffixFuzzer4] | None = field(default=None) + many_optional_unions: list[datatypes.AffixFuzzer4] | None = field(default=None) # type: ignore[misc] AffixFuzzer18Like = AffixFuzzer18 @@ -421,7 +421,7 @@ class AffixFuzzer18Array(BaseExtensionArray[AffixFuzzer18ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer18ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer18__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/components/_overrides/affix_fuzzer18.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer18_ext.py AffixFuzzer18Type._ARRAY_TYPE = AffixFuzzer18Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer7.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer7.py index 663b715b4cb2..9d2f6273354a 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer7.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer7.py @@ -20,9 +20,9 @@ @define class AffixFuzzer7: - # You can define your own __init__ function by defining a function called "affix_fuzzer7__init_override" + # You can define your own __init__ function as a member of AffixFuzzer7Ext in affix_fuzzer7_ext.py - many_optional: list[datatypes.AffixFuzzer1] | None = field(default=None) + many_optional: list[datatypes.AffixFuzzer1] | None = field(default=None) # type: ignore[misc] AffixFuzzer7Like = AffixFuzzer7 @@ -89,7 +89,7 @@ class AffixFuzzer7Array(BaseExtensionArray[AffixFuzzer7ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer7ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer7__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/components/_overrides/affix_fuzzer7.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer7_ext.py AffixFuzzer7Type._ARRAY_TYPE = AffixFuzzer7Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer8.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer8.py index a861d0b92e7a..b4112993dac5 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer8.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer8.py @@ -24,12 +24,12 @@ @define class AffixFuzzer8: - # You can define your own __init__ function by defining a function called "affix_fuzzer8__init_override" + # You can define your own __init__ function as a member of AffixFuzzer8Ext in affix_fuzzer8_ext.py - single_float_optional: float | None = field(default=None, converter=float_or_none) + single_float_optional: float | None = field(default=None, converter=float_or_none) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "affix_fuzzer8__as_array_override" + # You can define your own __array__ function as a member of AffixFuzzer8Ext in affix_fuzzer8_ext.py return np.asarray(self.single_float_optional, dtype=dtype) @@ -54,7 +54,7 @@ class AffixFuzzer8Array(BaseExtensionArray[AffixFuzzer8ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer8ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer8__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/components/_overrides/affix_fuzzer8.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer8_ext.py AffixFuzzer8Type._ARRAY_TYPE = AffixFuzzer8Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer9.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer9.py index be047c2906a9..8f2545255d0d 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer9.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer9.py @@ -19,9 +19,9 @@ @define class AffixFuzzer9: - # You can define your own __init__ function by defining a function called "affix_fuzzer9__init_override" + # You can define your own __init__ function as a member of AffixFuzzer9Ext in affix_fuzzer9_ext.py - single_string_required: str = field(converter=str) + single_string_required: str = field(converter=str) # type: ignore[misc] def __str__(self) -> str: return str(self.single_string_required) @@ -48,7 +48,7 @@ class AffixFuzzer9Array(BaseExtensionArray[AffixFuzzer9ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer9ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer9__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/components/_overrides/affix_fuzzer9.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer9_ext.py AffixFuzzer9Type._ARRAY_TYPE = AffixFuzzer9Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/annotation_context.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/annotation_context.py index 6ac893be7295..20102bc9a998 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/annotation_context.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/annotation_context.py @@ -41,11 +41,9 @@ class AnnotationContext: path. """ - # You can define your own __init__ function by defining a function called "annotation_context__init_override" + # You can define your own __init__ function as a member of AnnotationContextExt in annotation_context_ext.py - class_map: list[datatypes.ClassDescriptionMapElem] = field( - converter=annotation_context__class_map__field_converter_override - ) + class_map: list[datatypes.ClassDescriptionMapElem] = field(converter=annotation_context__class_map__field_converter_override) # type: ignore[misc] AnnotationContextLike = AnnotationContext diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/depth_meter.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/depth_meter.py index 11b3c7e3b9f6..86305171b705 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/depth_meter.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/depth_meter.py @@ -24,12 +24,12 @@ class DepthMeter: """A component indicating how long a meter is, expressed in native units.""" - # You can define your own __init__ function by defining a function called "depth_meter__init_override" + # You can define your own __init__ function as a member of DepthMeterExt in depth_meter_ext.py - value: float = field(converter=float) + value: float = field(converter=float) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "depth_meter__as_array_override" + # You can define your own __array__ function as a member of DepthMeterExt in depth_meter_ext.py return np.asarray(self.value, dtype=dtype) def __float__(self) -> float: diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/disconnected_space.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/disconnected_space.py index 4b61ff93dc50..7e32aba942a8 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/disconnected_space.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/disconnected_space.py @@ -36,9 +36,9 @@ class DisconnectedSpace: If a transform or pinhole is logged on the same path, this component will be ignored. """ - # You can define your own __init__ function by defining a function called "disconnected_space__init_override" + # You can define your own __init__ function as a member of DisconnectedSpaceExt in disconnected_space_ext.py - is_disconnected: bool = field(converter=bool) + is_disconnected: bool = field(converter=bool) # type: ignore[misc] if TYPE_CHECKING: diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/draw_order.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/draw_order.py index 4b7be4e65388..8bd90499783a 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/draw_order.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/draw_order.py @@ -32,12 +32,12 @@ class DrawOrder: Draw order for entities with the same draw order is generally undefined. """ - # You can define your own __init__ function by defining a function called "draw_order__init_override" + # You can define your own __init__ function as a member of DrawOrderExt in draw_order_ext.py - value: float = field(converter=float) + value: float = field(converter=float) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "draw_order__as_array_override" + # You can define your own __array__ function as a member of DrawOrderExt in draw_order_ext.py return np.asarray(self.value, dtype=dtype) def __float__(self) -> float: diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/instance_key.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/instance_key.py index 918b76b1c073..def34bc30f95 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/instance_key.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/instance_key.py @@ -24,12 +24,12 @@ class InstanceKey: """A unique numeric identifier for each individual instance within a batch.""" - # You can define your own __init__ function by defining a function called "instance_key__init_override" + # You can define your own __init__ function as a member of InstanceKeyExt in instance_key_ext.py - value: int = field(converter=int) + value: int = field(converter=int) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "instance_key__as_array_override" + # You can define your own __array__ function as a member of InstanceKeyExt in instance_key_ext.py return np.asarray(self.value, dtype=dtype) def __int__(self) -> int: diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip2d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip2d.py index e6b3789665d3..b7f040a9e0d7 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip2d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip2d.py @@ -38,9 +38,9 @@ class LineStrip2D: ``` """ - # You can define your own __init__ function by defining a function called "line_strip2d__init_override" + # You can define your own __init__ function as a member of LineStrip2DExt in line_strip2d_ext.py - points: list[datatypes.Vec2D] = field() + points: list[datatypes.Vec2D] = field() # type: ignore[misc] if TYPE_CHECKING: diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip3d.py index d278657176da..fffbef1cc133 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip3d.py @@ -38,9 +38,9 @@ class LineStrip3D: ``` """ - # You can define your own __init__ function by defining a function called "line_strip3d__init_override" + # You can define your own __init__ function as a member of LineStrip3DExt in line_strip3d_ext.py - points: list[datatypes.Vec3D] = field() + points: list[datatypes.Vec3D] = field() # type: ignore[misc] if TYPE_CHECKING: diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/radius.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/radius.py index ffc1f013e584..9053af69b756 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/radius.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/radius.py @@ -24,12 +24,12 @@ class Radius: """A Radius component.""" - # You can define your own __init__ function by defining a function called "radius__init_override" + # You can define your own __init__ function as a member of RadiusExt in radius_ext.py - value: float = field(converter=float) + value: float = field(converter=float) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "radius__as_array_override" + # You can define your own __array__ function as a member of RadiusExt in radius_ext.py return np.asarray(self.value, dtype=dtype) def __float__(self) -> float: diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer1.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer1.py index 43d2226f85b4..195262041cb2 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer1.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer1.py @@ -37,19 +37,17 @@ def _affix_fuzzer1__almost_flattened_scalar__special_field_converter_override( @define class AffixFuzzer1: - # You can define your own __init__ function by defining a function called "affix_fuzzer1__init_override" + # You can define your own __init__ function as a member of AffixFuzzer1Ext in affix_fuzzer1_ext.py - single_string_required: str = field(converter=str) - many_strings_required: list[str] = field() - flattened_scalar: float = field(converter=float) - almost_flattened_scalar: datatypes.FlattenedScalar = field( - converter=_affix_fuzzer1__almost_flattened_scalar__special_field_converter_override - ) - single_float_optional: float | None = field(default=None, converter=float_or_none) - single_string_optional: str | None = field(default=None, converter=str_or_none) - many_floats_optional: npt.NDArray[np.float32] | None = field(default=None, converter=to_np_float32) - many_strings_optional: list[str] | None = field(default=None) - from_parent: bool | None = field(default=None, converter=bool_or_none) + single_string_required: str = field(converter=str) # type: ignore[misc] + many_strings_required: list[str] = field() # type: ignore[misc] + flattened_scalar: float = field(converter=float) # type: ignore[misc] + almost_flattened_scalar: datatypes.FlattenedScalar = field(converter=_affix_fuzzer1__almost_flattened_scalar__special_field_converter_override) # type: ignore[misc] + single_float_optional: float | None = field(default=None, converter=float_or_none) # type: ignore[misc] + single_string_optional: str | None = field(default=None, converter=str_or_none) # type: ignore[misc] + many_floats_optional: npt.NDArray[np.float32] | None = field(default=None, converter=to_np_float32) # type: ignore[misc] + many_strings_optional: list[str] | None = field(default=None) # type: ignore[misc] + from_parent: bool | None = field(default=None, converter=bool_or_none) # type: ignore[misc] AffixFuzzer1Like = AffixFuzzer1 @@ -109,7 +107,7 @@ class AffixFuzzer1Array(BaseExtensionArray[AffixFuzzer1ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer1ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer1__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/affix_fuzzer1.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer1_ext.py AffixFuzzer1Type._ARRAY_TYPE = AffixFuzzer1Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer2.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer2.py index 540a5cd95a28..81dcaeb81576 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer2.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer2.py @@ -24,12 +24,12 @@ @define class AffixFuzzer2: - # You can define your own __init__ function by defining a function called "affix_fuzzer2__init_override" + # You can define your own __init__ function as a member of AffixFuzzer2Ext in affix_fuzzer2_ext.py - single_float_optional: float | None = field(default=None, converter=float_or_none) + single_float_optional: float | None = field(default=None, converter=float_or_none) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "affix_fuzzer2__as_array_override" + # You can define your own __array__ function as a member of AffixFuzzer2Ext in affix_fuzzer2_ext.py return np.asarray(self.single_float_optional, dtype=dtype) @@ -54,7 +54,7 @@ class AffixFuzzer2Array(BaseExtensionArray[AffixFuzzer2ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer2ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer2__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/affix_fuzzer2.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer2_ext.py AffixFuzzer2Type._ARRAY_TYPE = AffixFuzzer2Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer20.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer20.py index 77ff89b6ff18..7122014da098 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer20.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer20.py @@ -36,10 +36,10 @@ def _affix_fuzzer20__s__special_field_converter_override(x: datatypes.StringComp @define class AffixFuzzer20: - # You can define your own __init__ function by defining a function called "affix_fuzzer20__init_override" + # You can define your own __init__ function as a member of AffixFuzzer20Ext in affix_fuzzer20_ext.py - p: datatypes.PrimitiveComponent = field(converter=_affix_fuzzer20__p__special_field_converter_override) - s: datatypes.StringComponent = field(converter=_affix_fuzzer20__s__special_field_converter_override) + p: datatypes.PrimitiveComponent = field(converter=_affix_fuzzer20__p__special_field_converter_override) # type: ignore[misc] + s: datatypes.StringComponent = field(converter=_affix_fuzzer20__s__special_field_converter_override) # type: ignore[misc] AffixFuzzer20Like = AffixFuzzer20 @@ -72,7 +72,7 @@ class AffixFuzzer20Array(BaseExtensionArray[AffixFuzzer20ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer20ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer20__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/affix_fuzzer20.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer20_ext.py AffixFuzzer20Type._ARRAY_TYPE = AffixFuzzer20Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer3.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer3.py index 2aa696a0dff3..f79f06d3c62a 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer3.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer3.py @@ -22,9 +22,9 @@ @define class AffixFuzzer3: - # You can define your own __init__ function by defining a function called "affix_fuzzer3__init_override" + # You can define your own __init__ function as a member of AffixFuzzer3Ext in affix_fuzzer3_ext.py - inner: float | list[datatypes.AffixFuzzer1] | npt.NDArray[np.float32] = field() + inner: float | list[datatypes.AffixFuzzer1] | npt.NDArray[np.float32] = field() # type: ignore[misc] """ degrees (float): @@ -131,7 +131,7 @@ class AffixFuzzer3Array(BaseExtensionArray[AffixFuzzer3ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer3ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer3__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/affix_fuzzer3.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer3_ext.py AffixFuzzer3Type._ARRAY_TYPE = AffixFuzzer3Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer4.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer4.py index 322a9a6dff92..71631833b9f0 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer4.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer4.py @@ -20,9 +20,9 @@ @define class AffixFuzzer4: - # You can define your own __init__ function by defining a function called "affix_fuzzer4__init_override" + # You can define your own __init__ function as a member of AffixFuzzer4Ext in affix_fuzzer4_ext.py - inner: datatypes.AffixFuzzer3 | list[datatypes.AffixFuzzer3] = field() + inner: datatypes.AffixFuzzer3 | list[datatypes.AffixFuzzer3] = field() # type: ignore[misc] """ single_required (datatypes.AffixFuzzer3): @@ -384,7 +384,7 @@ class AffixFuzzer4Array(BaseExtensionArray[AffixFuzzer4ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer4ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer4__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/affix_fuzzer4.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer4_ext.py AffixFuzzer4Type._ARRAY_TYPE = AffixFuzzer4Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer5.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer5.py index 596c0b8da49f..2dde6e1b57f3 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer5.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer5.py @@ -31,11 +31,9 @@ def _affix_fuzzer5__single_optional_union__special_field_converter_override( @define class AffixFuzzer5: - # You can define your own __init__ function by defining a function called "affix_fuzzer5__init_override" + # You can define your own __init__ function as a member of AffixFuzzer5Ext in affix_fuzzer5_ext.py - single_optional_union: datatypes.AffixFuzzer4 | None = field( - default=None, converter=_affix_fuzzer5__single_optional_union__special_field_converter_override - ) + single_optional_union: datatypes.AffixFuzzer4 | None = field(default=None, converter=_affix_fuzzer5__single_optional_union__special_field_converter_override) # type: ignore[misc] AffixFuzzer5Like = AffixFuzzer5 @@ -452,7 +450,7 @@ class AffixFuzzer5Array(BaseExtensionArray[AffixFuzzer5ArrayLike]): @staticmethod def _native_to_pa_array(data: AffixFuzzer5ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "affix_fuzzer5__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/affix_fuzzer5.py + raise NotImplementedError # You need to implement native_to_pa_array_override in affix_fuzzer5_ext.py AffixFuzzer5Type._ARRAY_TYPE = AffixFuzzer5Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/angle.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/angle.py index a90247c2f5f7..ee4b257a1e87 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/angle.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/angle.py @@ -13,19 +13,18 @@ BaseExtensionArray, BaseExtensionType, ) -from ._overrides import angle__init_override # noqa: F401 +from .angle_ext import AngleExt __all__ = ["Angle", "AngleArray", "AngleArrayLike", "AngleLike", "AngleType"] @define(init=False) -class Angle: +class Angle(AngleExt): """Angle in either radians or degrees.""" - def __init__(self, *args, **kwargs): # type: ignore[no-untyped-def] - angle__init_override(self, *args, **kwargs) + # __init__ can be found in angle_ext.py - inner: float = field(converter=float) + inner: float = field(converter=float) # type: ignore[misc] """ Radians (float): 3D rotation angle in radians. Only one of `degrees` or `radians` should be set. @@ -75,7 +74,7 @@ class AngleArray(BaseExtensionArray[AngleArrayLike]): @staticmethod def _native_to_pa_array(data: AngleArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "angle__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/angle.py + raise NotImplementedError # You need to implement native_to_pa_array_override in angle_ext.py AngleType._ARRAY_TYPE = AngleArray diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/annotation_info.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/annotation_info.py index 0a6cbfc75f88..7cbc67f5fc45 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/annotation_info.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/annotation_info.py @@ -52,23 +52,19 @@ class AnnotationInfo: The id refers either to a class or key-point id """ - # You can define your own __init__ function by defining a function called "annotation_info__init_override" + # You can define your own __init__ function as a member of AnnotationInfoExt in annotation_info_ext.py - id: int = field(converter=int) + id: int = field(converter=int) # type: ignore[misc] """ `ClassId` or `KeypointId` to which this annotation info belongs. """ - label: datatypes.Utf8 | None = field( - default=None, converter=_annotation_info__label__special_field_converter_override - ) + label: datatypes.Utf8 | None = field(default=None, converter=_annotation_info__label__special_field_converter_override) # type: ignore[misc] """ The label that will be shown in the UI. """ - color: datatypes.Color | None = field( - default=None, converter=_annotation_info__color__special_field_converter_override - ) + color: datatypes.Color | None = field(default=None, converter=_annotation_info__color__special_field_converter_override) # type: ignore[misc] """ The color that will be applied to the annotated entity. """ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description.py index 8e9a643df00d..412b5b92a7d9 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description.py @@ -54,21 +54,17 @@ class ClassDescription: def __init__(self, *args, **kwargs): # type: ignore[no-untyped-def] class_description__init_override(self, *args, **kwargs) - info: datatypes.AnnotationInfo = field(converter=class_description__info__field_converter_override) + info: datatypes.AnnotationInfo = field(converter=class_description__info__field_converter_override) # type: ignore[misc] """ The `AnnotationInfo` for the class. """ - keypoint_annotations: list[datatypes.AnnotationInfo] = field( - converter=class_description__keypoint_annotations__field_converter_override - ) + keypoint_annotations: list[datatypes.AnnotationInfo] = field(converter=class_description__keypoint_annotations__field_converter_override) # type: ignore[misc] """ The `AnnotationInfo` for all of the keypoints. """ - keypoint_connections: list[datatypes.KeypointPair] = field( - converter=class_description__keypoint_connections__field_converter_override - ) + keypoint_connections: list[datatypes.KeypointPair] = field(converter=class_description__keypoint_connections__field_converter_override) # type: ignore[misc] """ The connections between keypoints. """ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description_map_elem.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description_map_elem.py index 16de5219e880..9f9f205893d8 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description_map_elem.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description_map_elem.py @@ -42,12 +42,10 @@ class ClassDescriptionMapElem: This is internal to the `AnnotationContext` structure. """ - # You can define your own __init__ function by defining a function called "class_description_map_elem__init_override" + # You can define your own __init__ function as a member of ClassDescriptionMapElemExt in class_description_map_elem_ext.py - class_id: datatypes.ClassId = field( - converter=_class_description_map_elem__class_id__special_field_converter_override - ) - class_description: datatypes.ClassDescription = field() + class_id: datatypes.ClassId = field(converter=_class_description_map_elem__class_id__special_field_converter_override) # type: ignore[misc] + class_description: datatypes.ClassDescription = field() # type: ignore[misc] if TYPE_CHECKING: diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_id.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_id.py index f07eafc29417..5c4dabca530e 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_id.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_id.py @@ -24,12 +24,12 @@ class ClassId: """A 16-bit ID representing a type of semantic class.""" - # You can define your own __init__ function by defining a function called "class_id__init_override" + # You can define your own __init__ function as a member of ClassIdExt in class_id_ext.py - id: int = field(converter=int) + id: int = field(converter=int) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "class_id__as_array_override" + # You can define your own __array__ function as a member of ClassIdExt in class_id_ext.py return np.asarray(self.id, dtype=dtype) def __int__(self) -> int: diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/color.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/color.py index 0f0abf26441e..c2b507b49b5c 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/color.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/color.py @@ -15,13 +15,13 @@ BaseExtensionArray, BaseExtensionType, ) -from ._overrides import color__native_to_pa_array_override, color__rgba__field_converter_override # noqa: F401 +from .color_ext import ColorExt __all__ = ["Color", "ColorArray", "ColorArrayLike", "ColorLike", "ColorType"] @define -class Color: +class Color(ColorExt): """ An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha. @@ -33,12 +33,12 @@ class Color: If there is an alpha, we assume it is in linear space, and separate (NOT pre-multiplied). """ - # You can define your own __init__ function by defining a function called "color__init_override" + # You can define your own __init__ function as a member of ColorExt in color_ext.py - rgba: int = field(converter=color__rgba__field_converter_override) + rgba: int = field(converter=ColorExt.rgba__field_converter_override) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "color__as_array_override" + # You can define your own __array__ function as a member of ColorExt in color_ext.py return np.asarray(self.rgba, dtype=dtype) def __int__(self) -> int: @@ -73,7 +73,7 @@ class ColorArray(BaseExtensionArray[ColorArrayLike]): @staticmethod def _native_to_pa_array(data: ColorArrayLike, data_type: pa.DataType) -> pa.Array: - return color__native_to_pa_array_override(data, data_type) + return ColorExt.native_to_pa_array_override(data, data_type) ColorType._ARRAY_TYPE = ColorArray diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/flattened_scalar.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/flattened_scalar.py index 6740b25de2c4..c4e98f6ec3fb 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/flattened_scalar.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/flattened_scalar.py @@ -27,12 +27,12 @@ @define class FlattenedScalar: - # You can define your own __init__ function by defining a function called "flattened_scalar__init_override" + # You can define your own __init__ function as a member of FlattenedScalarExt in flattened_scalar_ext.py - value: float = field(converter=float) + value: float = field(converter=float) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "flattened_scalar__as_array_override" + # You can define your own __array__ function as a member of FlattenedScalarExt in flattened_scalar_ext.py return np.asarray(self.value, dtype=dtype) def __float__(self) -> float: @@ -64,7 +64,7 @@ class FlattenedScalarArray(BaseExtensionArray[FlattenedScalarArrayLike]): @staticmethod def _native_to_pa_array(data: FlattenedScalarArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "flattened_scalar__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/flattened_scalar.py + raise NotImplementedError # You need to implement native_to_pa_array_override in flattened_scalar_ext.py FlattenedScalarType._ARRAY_TYPE = FlattenedScalarArray diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/float32.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/float32.py index 6a864aac0e33..51228509ea3c 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/float32.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/float32.py @@ -21,12 +21,12 @@ @define class Float32: - # You can define your own __init__ function by defining a function called "float32__init_override" + # You can define your own __init__ function as a member of Float32Ext in float32_ext.py - value: float = field(converter=float) + value: float = field(converter=float) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "float32__as_array_override" + # You can define your own __array__ function as a member of Float32Ext in float32_ext.py return np.asarray(self.value, dtype=dtype) def __float__(self) -> float: @@ -54,7 +54,7 @@ class Float32Array(BaseExtensionArray[Float32ArrayLike]): @staticmethod def _native_to_pa_array(data: Float32ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "float32__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/float32.py + raise NotImplementedError # You need to implement native_to_pa_array_override in float32_ext.py Float32Type._ARRAY_TYPE = Float32Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_id.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_id.py index 181028943e2a..57e7d8f74056 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_id.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_id.py @@ -31,12 +31,12 @@ class KeypointId: [`rerun.components.AnnotationContext`]. """ - # You can define your own __init__ function by defining a function called "keypoint_id__init_override" + # You can define your own __init__ function as a member of KeypointIdExt in keypoint_id_ext.py - id: int = field(converter=int) + id: int = field(converter=int) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "keypoint_id__as_array_override" + # You can define your own __array__ function as a member of KeypointIdExt in keypoint_id_ext.py return np.asarray(self.id, dtype=dtype) def __int__(self) -> int: diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_pair.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_pair.py index 7cbb51e4aaa6..d870021d84d9 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_pair.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_pair.py @@ -37,10 +37,10 @@ def _keypoint_pair__keypoint1__special_field_converter_override(x: datatypes.Key class KeypointPair: """A connection between two `Keypoints`.""" - # You can define your own __init__ function by defining a function called "keypoint_pair__init_override" + # You can define your own __init__ function as a member of KeypointPairExt in keypoint_pair_ext.py - keypoint0: datatypes.KeypointId = field(converter=_keypoint_pair__keypoint0__special_field_converter_override) - keypoint1: datatypes.KeypointId = field(converter=_keypoint_pair__keypoint1__special_field_converter_override) + keypoint0: datatypes.KeypointId = field(converter=_keypoint_pair__keypoint0__special_field_converter_override) # type: ignore[misc] + keypoint1: datatypes.KeypointId = field(converter=_keypoint_pair__keypoint1__special_field_converter_override) # type: ignore[misc] if TYPE_CHECKING: diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat3x3.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat3x3.py index f74e8898a219..d34fe20787a4 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat3x3.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat3x3.py @@ -24,12 +24,12 @@ class Mat3x3: """A 3x3 column-major Matrix.""" - # You can define your own __init__ function by defining a function called "mat3x3__init_override" + # You can define your own __init__ function as a member of Mat3x3Ext in mat3x3_ext.py - coeffs: npt.NDArray[np.float32] = field(converter=mat3x3__coeffs__field_converter_override) + coeffs: npt.NDArray[np.float32] = field(converter=mat3x3__coeffs__field_converter_override) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "mat3x3__as_array_override" + # You can define your own __array__ function as a member of Mat3x3Ext in mat3x3_ext.py return np.asarray(self.coeffs, dtype=dtype) @@ -60,7 +60,7 @@ class Mat3x3Array(BaseExtensionArray[Mat3x3ArrayLike]): @staticmethod def _native_to_pa_array(data: Mat3x3ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "mat3x3__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/mat3x3.py + raise NotImplementedError # You need to implement native_to_pa_array_override in mat3x3_ext.py Mat3x3Type._ARRAY_TYPE = Mat3x3Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat4x4.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat4x4.py index 65c06bae3467..0d81c5935cd2 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat4x4.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat4x4.py @@ -24,12 +24,12 @@ class Mat4x4: """A 4x4 column-major Matrix.""" - # You can define your own __init__ function by defining a function called "mat4x4__init_override" + # You can define your own __init__ function as a member of Mat4x4Ext in mat4x4_ext.py - coeffs: npt.NDArray[np.float32] = field(converter=mat4x4__coeffs__field_converter_override) + coeffs: npt.NDArray[np.float32] = field(converter=mat4x4__coeffs__field_converter_override) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "mat4x4__as_array_override" + # You can define your own __array__ function as a member of Mat4x4Ext in mat4x4_ext.py return np.asarray(self.coeffs, dtype=dtype) @@ -60,7 +60,7 @@ class Mat4x4Array(BaseExtensionArray[Mat4x4ArrayLike]): @staticmethod def _native_to_pa_array(data: Mat4x4ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "mat4x4__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/mat4x4.py + raise NotImplementedError # You need to implement native_to_pa_array_override in mat4x4_ext.py Mat4x4Type._ARRAY_TYPE = Mat4x4Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/primitive_component.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/primitive_component.py index 30bcdf099a83..7de2cc67b9c1 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/primitive_component.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/primitive_component.py @@ -27,12 +27,12 @@ @define class PrimitiveComponent: - # You can define your own __init__ function by defining a function called "primitive_component__init_override" + # You can define your own __init__ function as a member of PrimitiveComponentExt in primitive_component_ext.py - value: int = field(converter=int) + value: int = field(converter=int) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "primitive_component__as_array_override" + # You can define your own __array__ function as a member of PrimitiveComponentExt in primitive_component_ext.py return np.asarray(self.value, dtype=dtype) def __int__(self) -> int: @@ -60,7 +60,7 @@ class PrimitiveComponentArray(BaseExtensionArray[PrimitiveComponentArrayLike]): @staticmethod def _native_to_pa_array(data: PrimitiveComponentArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "primitive_component__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/primitive_component.py + raise NotImplementedError # You need to implement native_to_pa_array_override in primitive_component_ext.py PrimitiveComponentType._ARRAY_TYPE = PrimitiveComponentArray diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/quaternion.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/quaternion.py index e7d5bd51930a..cf04ad2014d0 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/quaternion.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/quaternion.py @@ -35,10 +35,10 @@ class Quaternion: def __init__(self, *args, **kwargs): # type: ignore[no-untyped-def] quaternion__init_override(self, *args, **kwargs) - xyzw: npt.NDArray[np.float32] = field(converter=to_np_float32) + xyzw: npt.NDArray[np.float32] = field(converter=to_np_float32) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "quaternion__as_array_override" + # You can define your own __array__ function as a member of QuaternionExt in quaternion_ext.py return np.asarray(self.xyzw, dtype=dtype) @@ -65,7 +65,7 @@ class QuaternionArray(BaseExtensionArray[QuaternionArrayLike]): @staticmethod def _native_to_pa_array(data: QuaternionArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "quaternion__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/quaternion.py + raise NotImplementedError # You need to implement native_to_pa_array_override in quaternion_ext.py QuaternionType._ARRAY_TYPE = QuaternionArray diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation3d.py index fcc1acf0fdb9..7203371b1e24 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation3d.py @@ -23,9 +23,9 @@ class Rotation3D: """A 3D rotation.""" - # You can define your own __init__ function by defining a function called "rotation3d__init_override" + # You can define your own __init__ function as a member of Rotation3DExt in rotation3d_ext.py - inner: datatypes.Quaternion | datatypes.RotationAxisAngle = field(converter=rotation3d__inner_converter_override) + inner: datatypes.Quaternion | datatypes.RotationAxisAngle = field(converter=rotation3d__inner_converter_override) # type: ignore[misc] """ Quaternion (datatypes.Quaternion): Rotation defined by a quaternion. @@ -102,7 +102,7 @@ class Rotation3DArray(BaseExtensionArray[Rotation3DArrayLike]): @staticmethod def _native_to_pa_array(data: Rotation3DArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "rotation3d__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/rotation3d.py + raise NotImplementedError # You need to implement native_to_pa_array_override in rotation3d_ext.py Rotation3DType._ARRAY_TYPE = Rotation3DArray diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation_axis_angle.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation_axis_angle.py index 3487b9e5e702..693a29703478 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation_axis_angle.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation_axis_angle.py @@ -36,9 +36,9 @@ def _rotation_axis_angle__axis__special_field_converter_override(x: datatypes.Ve class RotationAxisAngle: """3D rotation represented by a rotation around a given axis.""" - # You can define your own __init__ function by defining a function called "rotation_axis_angle__init_override" + # You can define your own __init__ function as a member of RotationAxisAngleExt in rotation_axis_angle_ext.py - axis: datatypes.Vec3D = field(converter=_rotation_axis_angle__axis__special_field_converter_override) + axis: datatypes.Vec3D = field(converter=_rotation_axis_angle__axis__special_field_converter_override) # type: ignore[misc] """ Axis to rotate around. @@ -47,7 +47,7 @@ class RotationAxisAngle: ignored. """ - angle: datatypes.Angle = field(converter=rotation_axis_angle__angle__field_converter_override) + angle: datatypes.Angle = field(converter=rotation_axis_angle__angle__field_converter_override) # type: ignore[misc] """ How much to rotate around the axis. """ @@ -99,7 +99,7 @@ class RotationAxisAngleArray(BaseExtensionArray[RotationAxisAngleArrayLike]): @staticmethod def _native_to_pa_array(data: RotationAxisAngleArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "rotation_axis_angle__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/rotation_axis_angle.py + raise NotImplementedError # You need to implement native_to_pa_array_override in rotation_axis_angle_ext.py RotationAxisAngleType._ARRAY_TYPE = RotationAxisAngleArray diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/scale3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/scale3d.py index fdfbd9f15f13..592f2d0b8f3f 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/scale3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/scale3d.py @@ -36,9 +36,9 @@ class Scale3D: ``` """ - # You can define your own __init__ function by defining a function called "scale3d__init_override" + # You can define your own __init__ function as a member of Scale3DExt in scale3d_ext.py - inner: datatypes.Vec3D | float = field(converter=scale3d__inner_converter_override) + inner: datatypes.Vec3D | float = field(converter=scale3d__inner_converter_override) # type: ignore[misc] """ ThreeD (datatypes.Vec3D): Individual scaling factors for each axis, distorting the original object. @@ -89,7 +89,7 @@ class Scale3DArray(BaseExtensionArray[Scale3DArrayLike]): @staticmethod def _native_to_pa_array(data: Scale3DArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "scale3d__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/scale3d.py + raise NotImplementedError # You need to implement native_to_pa_array_override in scale3d_ext.py Scale3DType._ARRAY_TYPE = Scale3DArray diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/string_component.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/string_component.py index b45cd696d57e..927fdc4c51a3 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/string_component.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/string_component.py @@ -25,9 +25,9 @@ @define class StringComponent: - # You can define your own __init__ function by defining a function called "string_component__init_override" + # You can define your own __init__ function as a member of StringComponentExt in string_component_ext.py - value: str = field(converter=str) + value: str = field(converter=str) # type: ignore[misc] def __str__(self) -> str: return str(self.value) @@ -54,7 +54,7 @@ class StringComponentArray(BaseExtensionArray[StringComponentArrayLike]): @staticmethod def _native_to_pa_array(data: StringComponentArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "string_component__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/string_component.py + raise NotImplementedError # You need to implement native_to_pa_array_override in string_component_ext.py StringComponentType._ARRAY_TYPE = StringComponentArray diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_buffer.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_buffer.py index 1a18d4378479..f7b5e02c65f5 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_buffer.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_buffer.py @@ -28,17 +28,9 @@ class TensorBuffer: Tensor elements are stored in a contiguous buffer of a single type. """ - # You can define your own __init__ function by defining a function called "tensor_buffer__init_override" - - inner: npt.NDArray[np.float32] | npt.NDArray[np.float64] | npt.NDArray[np.int16] | npt.NDArray[ - np.int32 - ] | npt.NDArray[np.int64] | npt.NDArray[np.int8] | npt.NDArray[np.uint16] | npt.NDArray[np.uint32] | npt.NDArray[ - np.uint64 - ] | npt.NDArray[ - np.uint8 - ] = field( - converter=tensor_buffer__inner_converter_override - ) + # You can define your own __init__ function as a member of TensorBufferExt in tensor_buffer_ext.py + + inner: npt.NDArray[np.float32] | npt.NDArray[np.float64] | npt.NDArray[np.int16] | npt.NDArray[np.int32] | npt.NDArray[np.int64] | npt.NDArray[np.int8] | npt.NDArray[np.uint16] | npt.NDArray[np.uint32] | npt.NDArray[np.uint64] | npt.NDArray[np.uint8] = field(converter=tensor_buffer__inner_converter_override) # type: ignore[misc] """ U8 (npt.NDArray[np.uint8]): @@ -186,7 +178,7 @@ class TensorBufferArray(BaseExtensionArray[TensorBufferArrayLike]): @staticmethod def _native_to_pa_array(data: TensorBufferArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "tensor_buffer__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/tensor_buffer.py + raise NotImplementedError # You need to implement native_to_pa_array_override in tensor_buffer_ext.py TensorBufferType._ARRAY_TYPE = TensorBufferArray diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_data.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_data.py index 48cddefd7d6f..e6520886a165 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_data.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_data.py @@ -43,8 +43,8 @@ class TensorData: def __init__(self, *args, **kwargs): # type: ignore[no-untyped-def] tensor_data__init_override(self, *args, **kwargs) - shape: list[datatypes.TensorDimension] = field() - buffer: datatypes.TensorBuffer = field(converter=_tensor_data__buffer__special_field_converter_override) + shape: list[datatypes.TensorDimension] = field() # type: ignore[misc] + buffer: datatypes.TensorBuffer = field(converter=_tensor_data__buffer__special_field_converter_override) # type: ignore[misc] if TYPE_CHECKING: diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_dimension.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_dimension.py index 6fcaa14de99e..a3d4f5a888f8 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_dimension.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_dimension.py @@ -30,10 +30,10 @@ class TensorDimension: """A single dimension within a multi-dimensional tensor.""" - # You can define your own __init__ function by defining a function called "tensor_dimension__init_override" + # You can define your own __init__ function as a member of TensorDimensionExt in tensor_dimension_ext.py - size: int = field(converter=int) - name: str | None = field(default=None, converter=str_or_none) + size: int = field(converter=int) # type: ignore[misc] + name: str | None = field(default=None, converter=str_or_none) # type: ignore[misc] TensorDimensionLike = TensorDimension @@ -66,7 +66,7 @@ class TensorDimensionArray(BaseExtensionArray[TensorDimensionArrayLike]): @staticmethod def _native_to_pa_array(data: TensorDimensionArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "tensor_dimension__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/tensor_dimension.py + raise NotImplementedError # You need to implement native_to_pa_array_override in tensor_dimension_ext.py TensorDimensionType._ARRAY_TYPE = TensorDimensionArray diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/transform3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/transform3d.py index 249b3fcf5236..7f6371583168 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/transform3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/transform3d.py @@ -23,9 +23,9 @@ class Transform3D: """Representation of a 3D affine transform.""" - # You can define your own __init__ function by defining a function called "transform3d__init_override" + # You can define your own __init__ function as a member of Transform3DExt in transform3d_ext.py - inner: datatypes.TranslationAndMat3x3 | datatypes.TranslationRotationScale3D = field() + inner: datatypes.TranslationAndMat3x3 | datatypes.TranslationRotationScale3D = field() # type: ignore[misc] """ TranslationAndMat3x3 (datatypes.TranslationAndMat3x3): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_and_mat3x3.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_and_mat3x3.py index 2f8079132cae..124daa6c432e 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_and_mat3x3.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_and_mat3x3.py @@ -58,22 +58,18 @@ class TranslationAndMat3x3: def __init__(self, *args, **kwargs): # type: ignore[no-untyped-def] translation_and_mat3x3__init_override(self, *args, **kwargs) - from_parent: bool = field(converter=bool) + from_parent: bool = field(converter=bool) # type: ignore[misc] """ If true, the transform maps from the parent space to the space where the transform was logged. Otherwise, the transform maps from the space to its parent. """ - translation: datatypes.Vec3D | None = field( - default=None, converter=_translation_and_mat3x3__translation__special_field_converter_override - ) + translation: datatypes.Vec3D | None = field(default=None, converter=_translation_and_mat3x3__translation__special_field_converter_override) # type: ignore[misc] """ 3D translation, applied after the matrix. """ - matrix: datatypes.Mat3x3 | None = field( - default=None, converter=_translation_and_mat3x3__matrix__special_field_converter_override - ) + matrix: datatypes.Mat3x3 | None = field(default=None, converter=_translation_and_mat3x3__matrix__special_field_converter_override) # type: ignore[misc] """ 3x3 matrix for scale, rotation & shear. """ @@ -120,7 +116,7 @@ class TranslationAndMat3x3Array(BaseExtensionArray[TranslationAndMat3x3ArrayLike @staticmethod def _native_to_pa_array(data: TranslationAndMat3x3ArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "translation_and_mat3x3__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/translation_and_mat3x3.py + raise NotImplementedError # You need to implement native_to_pa_array_override in translation_and_mat3x3_ext.py TranslationAndMat3x3Type._ARRAY_TYPE = TranslationAndMat3x3Array diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_rotation_scale3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_rotation_scale3d.py index d4176f4ff413..cffb82fe7c31 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_rotation_scale3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_rotation_scale3d.py @@ -65,29 +65,23 @@ class TranslationRotationScale3D: def __init__(self, *args, **kwargs): # type: ignore[no-untyped-def] translation_rotation_scale3d__init_override(self, *args, **kwargs) - from_parent: bool = field(converter=bool) + from_parent: bool = field(converter=bool) # type: ignore[misc] """ If true, the transform maps from the parent space to the space where the transform was logged. Otherwise, the transform maps from the space to its parent. """ - translation: datatypes.Vec3D | None = field( - default=None, converter=_translation_rotation_scale3d__translation__special_field_converter_override - ) + translation: datatypes.Vec3D | None = field(default=None, converter=_translation_rotation_scale3d__translation__special_field_converter_override) # type: ignore[misc] """ 3D translation vector, applied last. """ - rotation: datatypes.Rotation3D | None = field( - default=None, converter=_translation_rotation_scale3d__rotation__special_field_converter_override - ) + rotation: datatypes.Rotation3D | None = field(default=None, converter=_translation_rotation_scale3d__rotation__special_field_converter_override) # type: ignore[misc] """ 3D rotation, applied second. """ - scale: datatypes.Scale3D | None = field( - default=None, converter=_translation_rotation_scale3d__scale__special_field_converter_override - ) + scale: datatypes.Scale3D | None = field(default=None, converter=_translation_rotation_scale3d__scale__special_field_converter_override) # type: ignore[misc] """ 3D scale, applied first. """ @@ -192,7 +186,7 @@ class TranslationRotationScale3DArray(BaseExtensionArray[TranslationRotationScal @staticmethod def _native_to_pa_array(data: TranslationRotationScale3DArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError # You need to implement "translation_rotation_scale3d__native_to_pa_array_override" in rerun_py/rerun_sdk/rerun/_rerun2/datatypes/_overrides/translation_rotation_scale3d.py + raise NotImplementedError # You need to implement native_to_pa_array_override in translation_rotation_scale3d_ext.py TranslationRotationScale3DType._ARRAY_TYPE = TranslationRotationScale3DArray diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/utf8.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/utf8.py index 98cc2c24cfc5..878c5a6fabd6 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/utf8.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/utf8.py @@ -22,9 +22,9 @@ class Utf8: """A string of text, encoded as UTF-8.""" - # You can define your own __init__ function by defining a function called "utf8__init_override" + # You can define your own __init__ function as a member of Utf8Ext in utf8_ext.py - value: str = field(converter=str) + value: str = field(converter=str) # type: ignore[misc] def __str__(self) -> str: return str(self.value) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec2d.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec2d.py index 30b44bf6788f..7f9989dc2194 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec2d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec2d.py @@ -27,12 +27,12 @@ class Vec2D: """A vector in 2D space.""" - # You can define your own __init__ function by defining a function called "vec2d__init_override" + # You can define your own __init__ function as a member of Vec2DExt in vec2d_ext.py - xy: npt.NDArray[np.float32] = field(converter=to_np_float32) + xy: npt.NDArray[np.float32] = field(converter=to_np_float32) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "vec2d__as_array_override" + # You can define your own __array__ function as a member of Vec2DExt in vec2d_ext.py return np.asarray(self.xy, dtype=dtype) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec3d.py index e4e3b236222f..60084a2b7290 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec3d.py @@ -27,12 +27,12 @@ class Vec3D: """A vector in 3D space.""" - # You can define your own __init__ function by defining a function called "vec3d__init_override" + # You can define your own __init__ function as a member of Vec3DExt in vec3d_ext.py - xyz: npt.NDArray[np.float32] = field(converter=to_np_float32) + xyz: npt.NDArray[np.float32] = field(converter=to_np_float32) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "vec3d__as_array_override" + # You can define your own __array__ function as a member of Vec3DExt in vec3d_ext.py return np.asarray(self.xyz, dtype=dtype) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec4d.py b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec4d.py index 83666c8d3554..9b617e997ffb 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec4d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec4d.py @@ -27,12 +27,12 @@ class Vec4D: """A vector in 4D space.""" - # You can define your own __init__ function by defining a function called "vec4d__init_override" + # You can define your own __init__ function as a member of Vec4DExt in vec4d_ext.py - xyzw: npt.NDArray[np.float32] = field(converter=to_np_float32) + xyzw: npt.NDArray[np.float32] = field(converter=to_np_float32) # type: ignore[misc] def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: - # You can replace `np.asarray` here with your own code by defining a function named "vec4d__as_array_override" + # You can define your own __array__ function as a member of Vec4DExt in vec4d_ext.py return np.asarray(self.xyzw, dtype=dtype) From 0a434ef8c535807beb25a72a3991a9daf437e786 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Tue, 12 Sep 2023 22:04:45 +0200 Subject: [PATCH 10/18] A bit more in the docs --- rerun_py/ARCHITECTURE.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rerun_py/ARCHITECTURE.md b/rerun_py/ARCHITECTURE.md index c521ddfdf606..a635ec29b393 100644 --- a/rerun_py/ARCHITECTURE.md +++ b/rerun_py/ARCHITECTURE.md @@ -88,7 +88,12 @@ During codegen, each class looks for a file: `class_ext.py` in the same director will be generated. For example `datatypes/color_ext.py` is the extension file for the `Color` datatype, which can be found in `datatypes/color.py`. -In this file you must define a class called `Ext` that will be added as a mixin to the generated class. +In this file you must define a class called `Ext`, which will be added as a mixin to the generated class. + +Any methods defined in the extension class will be accessible via the generated class, so this can be a helpful way of adding +things such as custom constructors. + +Additionally the extension class allows you to overide `__init__()`, `__array__()`, `native_to_pa_array`, or the field converters for any of the generated fields. #### Native object init method (`__init__()`) From 846c33ebf34a7e45198cc10a3c9957c55f772585 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Tue, 12 Sep 2023 22:21:50 +0200 Subject: [PATCH 11/18] Rename to ExtensionClass. Add more docs and docstrings --- crates/re_types/source_hash.txt | 2 +- crates/re_types_builder/src/codegen/python.rs | 137 ++++++++++-------- 2 files changed, 80 insertions(+), 59 deletions(-) diff --git a/crates/re_types/source_hash.txt b/crates/re_types/source_hash.txt index 960245236e19..d4316b85c61e 100644 --- a/crates/re_types/source_hash.txt +++ b/crates/re_types/source_hash.txt @@ -1,4 +1,4 @@ # This is a sha256 hash for all direct and indirect dependencies of this crate's build script. # It can be safely removed at anytime to force the build script to run again. # Check out build.rs to see how it's computed. -ff7b8cdfe54da0cd3ea9a28ec29912164de760a6cc1b26e6b7fdf2f70257ff87 +332ed2e7d445bf3179aa0e70cd8501a0efc8d922c8ed46d3b9012d4b560208e0 diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index 1ffe9b332537..5ec0d80b579b 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -25,16 +25,7 @@ const ARRAY_METHOD: &str = "__array__"; /// The method used to convert a native type into a pyarrow array const NATIVE_TO_PA_ARRAY_METHOD: &str = "native_to_pa_array_override"; -/// The common suffix for method used to convert fields to their canonical representation.jjj -/// -/// If an extension class has a method named after the field with this suffix, it will be passed -/// as the converter argument to the `attrs` field constructor. -/// -/// For example, `ColorExt` has a method `rgba__field_converter_override`. This results in -/// the rgba field being created as: -/// ``` -/// rgba: int = field(converter=ColorExt.rgba__field_converter_override) -/// ``` +/// The common suffix for method used to convert fields to their canonical representation. const FIELD_CONVERTER_SUFFIX: &str = "__field_converter_override"; // --- @@ -145,34 +136,64 @@ impl CodeGenerator for PythonCodeGenerator { } } -struct ObjectExt { - /// Whether or not the `ObjectExtension` was found +/// `ExtensionClass` represents an optional means of extending the generated python code +/// +/// For any given type the extension will be looked for using the `_ext.py` suffix in the same +/// directory as the type and must have a name ending with `Ext`. +/// +/// For example, if the generated class for `Color` is found in `color.py`, then the `ExtensionClass` +/// should be `ColorExt` and found in the `color_ext.py` file. +/// +/// If the `ExtensionClass` is found it will be added as another parent-class of the base type. +/// Python supports multiple-inheritance and often refers to this as a "mixin" class. +struct ExtensionClass { + /// Whether or not the `ObjectExt` was found found: bool, - /// The name of the file where the `ObjectExtension` is implemented + /// The name of the file where the `ObjectExt` is implemented file_name: String, - /// The name of the module where `ObjectExtension` is implemented + /// The name of the module where `ObjectExt` is implemented module_name: String, - /// The name of this `ObjectExtension` + /// The name of this `ObjectExt` name: String, - /// The discovered overrides + /// The discovered overrides for field converters. + /// + /// The overrides must end in [`FIELD_CONVERTER_SUFFIX`] in order to be discovered. + /// + /// If an extension class has a method named after the field with this suffix, it will be passed + /// as the converter argument to the `attrs` field constructor. + /// + /// For example, `ColorExt` has a method `rgba__field_converter_override`. This results in + /// the rgba field being created as: + /// ``` + /// rgba: int = field(converter=ColorExt.rgba__field_converter_override) + /// ``` field_converter_overrides: Vec, - /// Whether the ObjectExt contains __init__() + /// Whether the `ObjectExt` contains __init__() + /// + /// If the `ExtensioNClass` contains its own `__init__`, we need to avoid creating the + /// default `__init__` via `attrs.define`. This can be done by specifying: + /// ``` + /// @define(init=false) + /// ``` has_init: bool, - /// Whether the ObjectExt contains __array__() + /// Whether the `ObjectExt` contains __array__() + /// + /// If the `ExtensionClass` contains its own `__array__` then we avoid generating + /// a default implementation. has_array: bool, - /// Whether the ObjectExt contains __native_to_pa_array__() + /// Whether the `ObjectExt` contains __native_to_pa_array__() has_native_to_pa_array: bool, } -impl ObjectExt { - fn new(base_path: &Utf8Path, obj: &Object) -> ObjectExt { +impl ExtensionClass { + fn new(base_path: &Utf8Path, obj: &Object) -> ExtensionClass { let file_name = format!("{}_ext.py", obj.snake_case_name()); let path = base_path.join(file_name.clone()); let module_name = path.file_stem().unwrap().to_owned(); @@ -203,7 +224,7 @@ impl ObjectExt { .map(|l| l.to_owned()) .collect(); - ObjectExt { + ExtensionClass { found: true, file_name, module_name, @@ -214,7 +235,7 @@ impl ObjectExt { has_native_to_pa_array, } } else { - ObjectExt { + ExtensionClass { found: false, file_name, module_name, @@ -249,7 +270,7 @@ impl PythonCodeGenerator { for &obj in &ordered_objects { let filepath = kind_path.join(format!("{}.py", obj.snake_case_name())); - let obj_ext = ObjectExt::new(&kind_path, obj); + let ext_class = ExtensionClass::new(&kind_path, obj); let names = match obj.kind { ObjectKind::Datatype | ObjectKind::Component => { @@ -326,9 +347,9 @@ impl PythonCodeGenerator { 0, ); - if obj_ext.found { + if ext_class.found { code.push_unindented_text( - format!("from .{} import {}", obj_ext.module_name, obj_ext.name,), + format!("from .{} import {}", ext_class.module_name, ext_class.name,), 1, ); } @@ -376,9 +397,9 @@ impl PythonCodeGenerator { ); let obj_code = if obj.is_struct() { - code_for_struct(arrow_registry, &obj_ext, &overrides, objects, obj) + code_for_struct(arrow_registry, &ext_class, &overrides, objects, obj) } else { - code_for_union(arrow_registry, &obj_ext, &overrides, objects, obj) + code_for_union(arrow_registry, &ext_class, &overrides, objects, obj) }; code.push_text(&obj_code, 1, 0); @@ -470,7 +491,7 @@ fn lib_source_code(archetype_names: &[String]) -> String { fn code_for_struct( arrow_registry: &ArrowRegistry, - obj_ext: &ObjectExt, + ext_class: &ExtensionClass, overrides: &HashSet, objects: &Objects, obj: &Object, @@ -503,11 +524,11 @@ fn code_for_struct( let converter_override_name = format!("{}{FIELD_CONVERTER_SUFFIX}", field.name); - let converter = if obj_ext + let converter = if ext_class .field_converter_overrides .contains(&converter_override_name) { - format!("converter={}.{converter_override_name}", obj_ext.name) + format!("converter={}.{converter_override_name}", ext_class.name) } else if overrides.contains(&old_converter_override_name) { format!("converter={old_converter_override_name}") } else if *kind == ObjectKind::Archetype { @@ -526,7 +547,7 @@ fn code_for_struct( // init override handling let old_init_override_name = format!("{}__init_override", obj.snake_case_name()); - let init_define_arg = if obj_ext.has_init || overrides.contains(&old_init_override_name) { + let init_define_arg = if ext_class.has_init || overrides.contains(&old_init_override_name) { "init=False".to_owned() } else { String::new() @@ -538,8 +559,8 @@ fn code_for_struct( superclasses.push("Archetype"); } - if obj_ext.found { - superclasses.push(obj_ext.name.as_str()); + if ext_class.found { + superclasses.push(ext_class.name.as_str()); } let superclass_decl = if !superclasses.is_empty() { @@ -575,9 +596,9 @@ fn code_for_struct( code.push_text(quote_doc_from_docs(docs), 0, 4); - if obj_ext.has_init { + if ext_class.has_init { code.push_text( - format!("# __init__ can be found in {}", obj_ext.file_name), + format!("# __init__ can be found in {}", ext_class.file_name), 2, 4, ); @@ -596,7 +617,7 @@ fn code_for_struct( code.push_text( format!( "# You can define your own __init__ function as a member of {} in {}", - obj_ext.name, obj_ext.file_name + ext_class.name, ext_class.file_name ), 2, 4, @@ -669,7 +690,7 @@ fn code_for_struct( } code.push_text( - quote_array_method_from_obj(obj_ext, overrides, objects, obj), + quote_array_method_from_obj(ext_class, overrides, objects, obj), 1, 4, ); @@ -693,7 +714,7 @@ fn code_for_struct( ); } else { code.push_text( - quote_arrow_support_from_obj(arrow_registry, obj_ext, overrides, obj), + quote_arrow_support_from_obj(arrow_registry, ext_class, overrides, obj), 1, 0, ); @@ -701,7 +722,7 @@ fn code_for_struct( } ObjectKind::Datatype => { code.push_text( - quote_arrow_support_from_obj(arrow_registry, obj_ext, overrides, obj), + quote_arrow_support_from_obj(arrow_registry, ext_class, overrides, obj), 1, 0, ); @@ -713,7 +734,7 @@ fn code_for_struct( fn code_for_union( arrow_registry: &ArrowRegistry, - obj_ext: &ObjectExt, + ext_class: &ExtensionClass, overrides: &HashSet, objects: &Objects, obj: &Object, @@ -733,7 +754,7 @@ fn code_for_union( // init override handling let old_init_override_name = format!("{}__init_override", obj.snake_case_name()); - let define_args = if obj_ext.has_init || overrides.contains(&old_init_override_name) { + let define_args = if ext_class.has_init || overrides.contains(&old_init_override_name) { "(init=False)".to_owned() } else { String::new() @@ -745,8 +766,8 @@ fn code_for_union( superclasses.push("Archetype"); } - if obj_ext.found { - superclasses.push(obj_ext.name.as_str()); + if ext_class.found { + superclasses.push(ext_class.name.as_str()); } let superclass_decl = if !superclasses.is_empty() { @@ -768,9 +789,9 @@ fn code_for_union( code.push_text(quote_doc_from_docs(docs), 0, 4); - if obj_ext.has_init { + if ext_class.has_init { code.push_text( - format!("# __init__ can be found in {}", obj_ext.file_name), + format!("# __init__ can be found in {}", ext_class.file_name), 2, 4, ); @@ -789,7 +810,7 @@ fn code_for_union( code.push_text( format!( "# You can define your own __init__ function as a member of {} in {}", - obj_ext.name, obj_ext.file_name + ext_class.name, ext_class.file_name ), 2, 4, @@ -820,11 +841,11 @@ fn code_for_union( format!("{}__inner_converter_override", obj.snake_case_name()); let converter_override_name = "inner_converter_override".to_owned(); - let converter = if obj_ext + let converter = if ext_class .field_converter_overrides .contains(&converter_override_name) { - format!("converter={}.{converter_override_name}", obj_ext.name) + format!("converter={}.{converter_override_name}", ext_class.name) } else if overrides.contains(&old_converter_override_name) { format!("converter={old_converter_override_name}") } else if !default_converter.is_empty() { @@ -865,7 +886,7 @@ fn code_for_union( } ObjectKind::Datatype => { code.push_text( - quote_arrow_support_from_obj(arrow_registry, obj_ext, overrides, obj), + quote_arrow_support_from_obj(arrow_registry, ext_class, overrides, obj), 1, 0, ); @@ -940,7 +961,7 @@ fn quote_doc_from_fields(objects: &Objects, fields: &Vec) -> String /// /// Only applies to datatypes and components. fn quote_array_method_from_obj( - obj_ext: &ObjectExt, + ext_class: &ExtensionClass, overrides: &HashSet, objects: &Objects, obj: &Object, @@ -950,8 +971,8 @@ fn quote_array_method_from_obj( // allow overriding the __array__ function let old_override_name = format!("{}__as_array_override", obj.snake_case_name()); - if obj_ext.has_array { - return format!("# __array__ can be found in {}", obj_ext.file_name); + if ext_class.has_array { + return format!("# __array__ can be found in {}", ext_class.file_name); } else if overrides.contains(&old_override_name) { return unindent::unindent(&format!( " @@ -978,7 +999,7 @@ fn quote_array_method_from_obj( # You can define your own __array__ function as a member of {} in {} return np.asarray(self.{field_name}, dtype=dtype) ", - obj_ext.name, obj_ext.file_name + ext_class.name, ext_class.file_name )) } @@ -1401,7 +1422,7 @@ fn quote_arrow_support_from_delegating_component(obj: &Object, dtype_obj: &Objec /// delegate to the Datatype's arrow support. fn quote_arrow_support_from_obj( arrow_registry: &ArrowRegistry, - obj_ext: &ObjectExt, + ext_class: &ExtensionClass, overrides: &HashSet, obj: &Object, ) -> String { @@ -1429,17 +1450,17 @@ fn quote_arrow_support_from_obj( .unwrap_or_else(|| fqname.clone()); let old_override_name = format!("{}__native_to_pa_array_override", obj.snake_case_name()); - let override_ = if obj_ext.has_native_to_pa_array { + let override_ = if ext_class.has_native_to_pa_array { format!( "return {}.{NATIVE_TO_PA_ARRAY_METHOD}(data, data_type)", - obj_ext.name + ext_class.name ) } else if overrides.contains(&old_override_name) { format!("return {old_override_name}(data, data_type)") } else { format!( "raise NotImplementedError # You need to implement {NATIVE_TO_PA_ARRAY_METHOD} in {}", - obj_ext.file_name + ext_class.file_name ) }; From e2a870ceb7b712f6b8e688a21da56b23fab3a310 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Wed, 13 Sep 2023 00:38:36 +0200 Subject: [PATCH 12/18] Spell --- rerun_py/ARCHITECTURE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rerun_py/ARCHITECTURE.md b/rerun_py/ARCHITECTURE.md index a635ec29b393..54db55507980 100644 --- a/rerun_py/ARCHITECTURE.md +++ b/rerun_py/ARCHITECTURE.md @@ -93,7 +93,7 @@ In this file you must define a class called `Ext`, which will be added as Any methods defined in the extension class will be accessible via the generated class, so this can be a helpful way of adding things such as custom constructors. -Additionally the extension class allows you to overide `__init__()`, `__array__()`, `native_to_pa_array`, or the field converters for any of the generated fields. +Additionally the extension class allows you to override `__init__()`, `__array__()`, `native_to_pa_array`, or the field converters for any of the generated fields. #### Native object init method (`__init__()`) From c60243e5d85764b74813bab9cbbbb09bc5395aa9 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Wed, 13 Sep 2023 01:28:56 +0200 Subject: [PATCH 13/18] Some comments aren't doctests --- crates/re_types/source_hash.txt | 2 +- crates/re_types_builder/src/codegen/python.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/re_types/source_hash.txt b/crates/re_types/source_hash.txt index d4316b85c61e..3358c284add8 100644 --- a/crates/re_types/source_hash.txt +++ b/crates/re_types/source_hash.txt @@ -1,4 +1,4 @@ # This is a sha256 hash for all direct and indirect dependencies of this crate's build script. # It can be safely removed at anytime to force the build script to run again. # Check out build.rs to see how it's computed. -332ed2e7d445bf3179aa0e70cd8501a0efc8d922c8ed46d3b9012d4b560208e0 +276eb7b145fec22187d9e85f38c6adc01e04c2daaa9abe6200501d89f00771f8 diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index 5ec0d80b579b..98922e7615b0 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -168,7 +168,7 @@ struct ExtensionClass { /// /// For example, `ColorExt` has a method `rgba__field_converter_override`. This results in /// the rgba field being created as: - /// ``` + /// ```python /// rgba: int = field(converter=ColorExt.rgba__field_converter_override) /// ``` field_converter_overrides: Vec, @@ -177,7 +177,7 @@ struct ExtensionClass { /// /// If the `ExtensioNClass` contains its own `__init__`, we need to avoid creating the /// default `__init__` via `attrs.define`. This can be done by specifying: - /// ``` + /// ```python /// @define(init=false) /// ``` has_init: bool, From f34a2f0f02a5b0d1e790dc10f989b00e3be9bf37 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Wed, 13 Sep 2023 00:21:19 +0200 Subject: [PATCH 14/18] Create Component objects, even for DelegatingComponents --- crates/re_types_builder/src/codegen/python.rs | 178 ++++++++++-------- 1 file changed, 103 insertions(+), 75 deletions(-) diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index 98922e7615b0..4bf493603b8e 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -277,7 +277,7 @@ impl PythonCodeGenerator { let name = &obj.name; if obj.is_delegating_component() { - vec![format!("{name}Array"), format!("{name}Type")] + vec![name.clone(), format!("{name}Array"), format!("{name}Type")] } else { vec![ format!("{name}"), @@ -508,10 +508,11 @@ fn code_for_struct( let mut code = String::new(); - if *kind != ObjectKind::Component || obj.is_non_delegating_component() { - // field converters preprocessing pass — must be performed here because we must autogen - // converter function *before* the class - let mut field_converters: HashMap = HashMap::new(); + // field converters preprocessing pass — must be performed here because we must autogen + // converter function *before* the class + let mut field_converters: HashMap = HashMap::new(); + + if !obj.is_delegating_component() { for field in fields { let (default_converter, converter_function) = quote_field_converter_from_field(obj, objects, field); @@ -544,86 +545,113 @@ fn code_for_struct( }; field_converters.insert(field.fqname.clone(), converter); } + } - // init override handling - let old_init_override_name = format!("{}__init_override", obj.snake_case_name()); - let init_define_arg = if ext_class.has_init || overrides.contains(&old_init_override_name) { - "init=False".to_owned() - } else { - String::new() - }; + // init override handling + let old_init_override_name = format!("{}__init_override", obj.snake_case_name()); + let init_define_arg = if ext_class.has_init || overrides.contains(&old_init_override_name) { + "init=False".to_owned() + } else { + String::new() + }; - let mut superclasses = vec![]; + let mut superclasses: Vec = vec![]; - if *kind == ObjectKind::Archetype { - superclasses.push("Archetype"); - } + if *kind == ObjectKind::Archetype { + superclasses.push("Archetype".to_owned()); + } - if ext_class.found { - superclasses.push(ext_class.name.as_str()); - } + if ext_class.found { + superclasses.push(ext_class.name.clone()); + } - let superclass_decl = if !superclasses.is_empty() { - format!("({})", superclasses.join(",")) - } else { - String::new() - }; + // Delegating component inheritance comes after the `ExtensionClass` + // This way if a component needs to override `__init__` it still can. + if obj.is_delegating_component() { + superclasses.push(format!( + "datatypes.{}", + obj.delegate_datatype(objects).unwrap().name + )); + } - let define_args = if *kind == ObjectKind::Archetype { - format!( - "str=False, repr=False{}{init_define_arg}", - if init_define_arg.is_empty() { "" } else { ", " } - ) - } else { - init_define_arg - }; + let superclass_decl = if !superclasses.is_empty() { + format!("({})", superclasses.join(",")) + } else { + String::new() + }; - let define_args = if !define_args.is_empty() { - format!("({define_args})") - } else { - define_args - }; + let define_args = if *kind == ObjectKind::Archetype { + format!( + "str=False, repr=False{}{init_define_arg}", + if init_define_arg.is_empty() { "" } else { ", " } + ) + } else { + init_define_arg + }; - code.push_unindented_text( - format!( - r#" - @define{define_args} + let define_args = if !define_args.is_empty() { + format!("({define_args})") + } else { + define_args + }; + + let define_decorator = if !obj.is_delegating_component() { + format!("@define{define_args}") + } else { + String::new() + }; + + code.push_unindented_text( + format!( + r#" + {define_decorator} class {name}{superclass_decl}: "# - ), - 0, - ); + ), + 0, + ); - code.push_text(quote_doc_from_docs(docs), 0, 4); + code.push_text(quote_doc_from_docs(docs), 0, 4); - if ext_class.has_init { - code.push_text( - format!("# __init__ can be found in {}", ext_class.file_name), - 2, - 4, - ); - } else if overrides.contains(&old_init_override_name) { - code.push_text( - "def __init__(self, *args, **kwargs): #type: ignore[no-untyped-def]", - 1, - 4, - ); - code.push_text( - format!("{old_init_override_name}(self, *args, **kwargs)"), - 2, - 8, - ); - } else { - code.push_text( - format!( - "# You can define your own __init__ function as a member of {} in {}", - ext_class.name, ext_class.file_name - ), - 2, - 4, - ); - } + if ext_class.has_init { + code.push_text( + format!("# __init__ can be found in {}", ext_class.file_name), + 2, + 4, + ); + } else if overrides.contains(&old_init_override_name) { + code.push_text( + "def __init__(self, *args, **kwargs): #type: ignore[no-untyped-def]", + 1, + 4, + ); + code.push_text( + format!("{old_init_override_name}(self, *args, **kwargs)"), + 2, + 8, + ); + } else { + code.push_text( + format!( + "# You can define your own __init__ function as a member of {} in {}", + ext_class.name, ext_class.file_name + ), + 2, + 4, + ); + } + if obj.is_delegating_component() { + code.push_text( + format!( + "# Note: there are no fields here because {} delegates to datatypes.{}", + obj.name, + obj.delegate_datatype(objects).unwrap().name + ), + 2, + 4, + ); + } else { // NOTE: We need to add required fields first, and then optional ones, otherwise mypy // complains. // TODO(ab, #2641): this is required because fields without default should appear before fields @@ -674,9 +702,9 @@ fn code_for_struct( format!("{typ} = field({metadata}{converter}) # type: ignore[misc]") } else { format!( - "{typ} | None = field({metadata}default=None{}{converter}) # type: ignore[misc]", - if converter.is_empty() { "" } else { ", " }, - ) + "{typ} | None = field({metadata}default=None{}{converter}) # type: ignore[misc]", + if converter.is_empty() { "" } else { ", " }, + ) }; code.push_text(format!("{name}: {typ}"), 1, 4); From db6375f5dfe6be9a114310d10d15cb39d32efb24 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Wed, 13 Sep 2023 00:22:05 +0200 Subject: [PATCH 15/18] Migrate TextLogLevel to extension class --- .../components/_overrides/text_log_level.py | 21 ----------------- .../_rerun2/components/text_log_level.py | 21 ++++++++++++++++- .../_rerun2/components/text_log_level_ext.py | 23 +++++++++++++++++++ 3 files changed, 43 insertions(+), 22 deletions(-) delete mode 100644 rerun_py/rerun_sdk/rerun/_rerun2/components/_overrides/text_log_level.py create mode 100644 rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/_overrides/text_log_level.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/_overrides/text_log_level.py deleted file mode 100644 index 1f85eec700df..000000000000 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/_overrides/text_log_level.py +++ /dev/null @@ -1,21 +0,0 @@ -from __future__ import annotations - -from .. import TextLogLevelType - -setattr(TextLogLevelType, "CRITICAL", "CRITICAL") -TextLogLevelType.CRITICAL.__doc__ = """ Designates catastrophic failures. """ - -setattr(TextLogLevelType, "ERROR", "ERROR") -TextLogLevelType.ERROR.__doc__ = """ Designates very serious errors. """ - -setattr(TextLogLevelType, "WARN", "WARN") -TextLogLevelType.WARN.__doc__ = """ Designates hazardous situations. """ - -setattr(TextLogLevelType, "INFO", "INFO") -TextLogLevelType.INFO.__doc__ = """ Designates useful information. """ - -setattr(TextLogLevelType, "DEBUG", "DEBUG") -TextLogLevelType.DEBUG.__doc__ = """ Designates lower priority information. """ - -setattr(TextLogLevelType, "TRACE", "TRACE") -TextLogLevelType.TRACE.__doc__ = """ Designates very low priority, often extremely verbose, information. """ diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level.py index efb2983f375e..4d59f61b3c85 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level.py @@ -9,8 +9,27 @@ BaseDelegatingExtensionArray, BaseDelegatingExtensionType, ) +from .text_log_level_ext import TextLogLevelExt -__all__ = ["TextLogLevelArray", "TextLogLevelType"] +__all__ = ["TextLogLevel", "TextLogLevelArray", "TextLogLevelType"] + + +class TextLogLevel(TextLogLevelExt, datatypes.Utf8): + """ + The severity level of a text log message. + + Recommended to be one of: + * `"CRITICAL"` + * `"ERROR"` + * `"WARN"` + * `"INFO"` + * `"DEBUG"` + * `"TRACE"` + """ + + # You can define your own __init__ function as a member of TextLogLevelExt in text_log_level_ext.py + + # Note: there are no fields here because TextLogLevel delegates to datatypes.Utf8 class TextLogLevelType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level_ext.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level_ext.py new file mode 100644 index 000000000000..f02e25cba51b --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level_ext.py @@ -0,0 +1,23 @@ +from __future__ import annotations + +from typing import Final + + +class TextLogLevelExt: + CRITICAL: Final = "CRITICAL" + """ Designates catastrophic failures. """ + + ERROR: Final = "ERROR" + """ Designates very serious errors. """ + + WARN: Final = "WARN" + """ Designates hazardous situations. """ + + INFO: Final = "INFO" + """ Designates useful information. """ + + DEBUG: Final = "DEBUG" + """ Designates lower priority information. """ + + TRACE: Final = "TRACE" + """ Designates very low priority, often extremely verbose, information. """ From 8b04331bae3dd3702fb8ca2156c531330ec9d491 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Wed, 13 Sep 2023 00:22:19 +0200 Subject: [PATCH 16/18] Codegen for the other components --- crates/re_types/source_hash.txt | 2 +- .../rerun/_rerun2/components/__init__.py | 69 ++++++++++++------- .../rerun/_rerun2/components/affix_fuzzer1.py | 46 +++++++++++-- .../_rerun2/components/affix_fuzzer14.py | 46 +++++++++++-- .../_rerun2/components/affix_fuzzer15.py | 46 +++++++++++-- .../_rerun2/components/affix_fuzzer19.py | 46 +++++++++++-- .../rerun/_rerun2/components/affix_fuzzer2.py | 46 +++++++++++-- .../_rerun2/components/affix_fuzzer20.py | 46 +++++++++++-- .../rerun/_rerun2/components/affix_fuzzer3.py | 46 +++++++++++-- .../rerun/_rerun2/components/affix_fuzzer4.py | 46 +++++++++++-- .../rerun/_rerun2/components/affix_fuzzer5.py | 46 +++++++++++-- .../rerun/_rerun2/components/affix_fuzzer6.py | 46 +++++++++++-- .../rerun/_rerun2/components/class_id.py | 10 ++- .../rerun/_rerun2/components/color.py | 19 ++++- .../rerun/_rerun2/components/half_sizes2d.py | 15 +++- .../rerun/_rerun2/components/keypoint_id.py | 17 ++++- .../rerun/_rerun2/components/origin2d.py | 10 ++- .../rerun/_rerun2/components/origin3d.py | 10 ++- .../rerun/_rerun2/components/point2d.py | 10 ++- .../rerun/_rerun2/components/point3d.py | 10 ++- .../rerun/_rerun2/components/tensor_data.py | 46 +++++++++++-- .../rerun/_rerun2/components/text.py | 10 ++- .../rerun/_rerun2/components/transform3d.py | 10 ++- .../rerun/_rerun2/components/vector3d.py | 10 ++- 24 files changed, 618 insertions(+), 90 deletions(-) diff --git a/crates/re_types/source_hash.txt b/crates/re_types/source_hash.txt index 3358c284add8..6fb3b2f3b54e 100644 --- a/crates/re_types/source_hash.txt +++ b/crates/re_types/source_hash.txt @@ -1,4 +1,4 @@ # This is a sha256 hash for all direct and indirect dependencies of this crate's build script. # It can be safely removed at anytime to force the build script to run again. # Check out build.rs to see how it's computed. -276eb7b145fec22187d9e85f38c6adc01e04c2daaa9abe6200501d89f00771f8 +762c15f15b857a7f139cdc66ccea6e442de44fde4b1a402b30b1f80bf44fe29d diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/__init__.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/__init__.py index 49675e6649cf..3ea5e31226f1 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/__init__.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/__init__.py @@ -2,12 +2,12 @@ from __future__ import annotations -from .affix_fuzzer1 import AffixFuzzer1Array, AffixFuzzer1Type -from .affix_fuzzer2 import AffixFuzzer2Array, AffixFuzzer2Type -from .affix_fuzzer3 import AffixFuzzer3Array, AffixFuzzer3Type -from .affix_fuzzer4 import AffixFuzzer4Array, AffixFuzzer4Type -from .affix_fuzzer5 import AffixFuzzer5Array, AffixFuzzer5Type -from .affix_fuzzer6 import AffixFuzzer6Array, AffixFuzzer6Type +from .affix_fuzzer1 import AffixFuzzer1, AffixFuzzer1Array, AffixFuzzer1Type +from .affix_fuzzer2 import AffixFuzzer2, AffixFuzzer2Array, AffixFuzzer2Type +from .affix_fuzzer3 import AffixFuzzer3, AffixFuzzer3Array, AffixFuzzer3Type +from .affix_fuzzer4 import AffixFuzzer4, AffixFuzzer4Array, AffixFuzzer4Type +from .affix_fuzzer5 import AffixFuzzer5, AffixFuzzer5Array, AffixFuzzer5Type +from .affix_fuzzer6 import AffixFuzzer6, AffixFuzzer6Array, AffixFuzzer6Type from .affix_fuzzer7 import AffixFuzzer7, AffixFuzzer7Array, AffixFuzzer7ArrayLike, AffixFuzzer7Like, AffixFuzzer7Type from .affix_fuzzer8 import AffixFuzzer8, AffixFuzzer8Array, AffixFuzzer8ArrayLike, AffixFuzzer8Like, AffixFuzzer8Type from .affix_fuzzer9 import AffixFuzzer9, AffixFuzzer9Array, AffixFuzzer9ArrayLike, AffixFuzzer9Like, AffixFuzzer9Type @@ -39,8 +39,8 @@ AffixFuzzer13Like, AffixFuzzer13Type, ) -from .affix_fuzzer14 import AffixFuzzer14Array, AffixFuzzer14Type -from .affix_fuzzer15 import AffixFuzzer15Array, AffixFuzzer15Type +from .affix_fuzzer14 import AffixFuzzer14, AffixFuzzer14Array, AffixFuzzer14Type +from .affix_fuzzer15 import AffixFuzzer15, AffixFuzzer15Array, AffixFuzzer15Type from .affix_fuzzer16 import ( AffixFuzzer16, AffixFuzzer16Array, @@ -62,8 +62,8 @@ AffixFuzzer18Like, AffixFuzzer18Type, ) -from .affix_fuzzer19 import AffixFuzzer19Array, AffixFuzzer19Type -from .affix_fuzzer20 import AffixFuzzer20Array, AffixFuzzer20Type +from .affix_fuzzer19 import AffixFuzzer19, AffixFuzzer19Array, AffixFuzzer19Type +from .affix_fuzzer20 import AffixFuzzer20, AffixFuzzer20Array, AffixFuzzer20Type from .annotation_context import ( AnnotationContext, AnnotationContextArray, @@ -71,8 +71,8 @@ AnnotationContextLike, AnnotationContextType, ) -from .class_id import ClassIdArray, ClassIdType -from .color import ColorArray, ColorType +from .class_id import ClassId, ClassIdArray, ClassIdType +from .color import Color, ColorArray, ColorType from .depth_meter import DepthMeter, DepthMeterArray, DepthMeterArrayLike, DepthMeterLike, DepthMeterType from .disconnected_space import ( DisconnectedSpace, @@ -82,23 +82,24 @@ DisconnectedSpaceType, ) from .draw_order import DrawOrder, DrawOrderArray, DrawOrderArrayLike, DrawOrderLike, DrawOrderType -from .half_sizes2d import HalfSizes2DArray, HalfSizes2DType +from .half_sizes2d import HalfSizes2D, HalfSizes2DArray, HalfSizes2DType from .instance_key import InstanceKey, InstanceKeyArray, InstanceKeyArrayLike, InstanceKeyLike, InstanceKeyType -from .keypoint_id import KeypointIdArray, KeypointIdType +from .keypoint_id import KeypointId, KeypointIdArray, KeypointIdType from .line_strip2d import LineStrip2D, LineStrip2DArray, LineStrip2DArrayLike, LineStrip2DLike, LineStrip2DType from .line_strip3d import LineStrip3D, LineStrip3DArray, LineStrip3DArrayLike, LineStrip3DLike, LineStrip3DType -from .origin2d import Origin2DArray, Origin2DType -from .origin3d import Origin3DArray, Origin3DType -from .point2d import Point2DArray, Point2DType -from .point3d import Point3DArray, Point3DType +from .origin2d import Origin2D, Origin2DArray, Origin2DType +from .origin3d import Origin3D, Origin3DArray, Origin3DType +from .point2d import Point2D, Point2DArray, Point2DType +from .point3d import Point3D, Point3DArray, Point3DType from .radius import Radius, RadiusArray, RadiusArrayLike, RadiusLike, RadiusType -from .tensor_data import TensorDataArray, TensorDataType -from .text import TextArray, TextType -from .text_log_level import TextLogLevelArray, TextLogLevelType -from .transform3d import Transform3DArray, Transform3DType -from .vector3d import Vector3DArray, Vector3DType +from .tensor_data import TensorData, TensorDataArray, TensorDataType +from .text import Text, TextArray, TextType +from .text_log_level import TextLogLevel, TextLogLevelArray, TextLogLevelType +from .transform3d import Transform3D, Transform3DArray, Transform3DType +from .vector3d import Vector3D, Vector3DArray, Vector3DType __all__ = [ + "AffixFuzzer1", "AffixFuzzer10", "AffixFuzzer10Array", "AffixFuzzer10ArrayLike", @@ -119,8 +120,10 @@ "AffixFuzzer13ArrayLike", "AffixFuzzer13Like", "AffixFuzzer13Type", + "AffixFuzzer14", "AffixFuzzer14Array", "AffixFuzzer14Type", + "AffixFuzzer15", "AffixFuzzer15Array", "AffixFuzzer15Type", "AffixFuzzer16", @@ -138,20 +141,27 @@ "AffixFuzzer18ArrayLike", "AffixFuzzer18Like", "AffixFuzzer18Type", + "AffixFuzzer19", "AffixFuzzer19Array", "AffixFuzzer19Type", "AffixFuzzer1Array", "AffixFuzzer1Type", + "AffixFuzzer2", + "AffixFuzzer20", "AffixFuzzer20Array", "AffixFuzzer20Type", "AffixFuzzer2Array", "AffixFuzzer2Type", + "AffixFuzzer3", "AffixFuzzer3Array", "AffixFuzzer3Type", + "AffixFuzzer4", "AffixFuzzer4Array", "AffixFuzzer4Type", + "AffixFuzzer5", "AffixFuzzer5Array", "AffixFuzzer5Type", + "AffixFuzzer6", "AffixFuzzer6Array", "AffixFuzzer6Type", "AffixFuzzer7", @@ -174,8 +184,10 @@ "AnnotationContextArrayLike", "AnnotationContextLike", "AnnotationContextType", + "ClassId", "ClassIdArray", "ClassIdType", + "Color", "ColorArray", "ColorType", "DepthMeter", @@ -193,6 +205,7 @@ "DrawOrderArrayLike", "DrawOrderLike", "DrawOrderType", + "HalfSizes2D", "HalfSizes2DArray", "HalfSizes2DType", "InstanceKey", @@ -200,6 +213,7 @@ "InstanceKeyArrayLike", "InstanceKeyLike", "InstanceKeyType", + "KeypointId", "KeypointIdArray", "KeypointIdType", "LineStrip2D", @@ -212,12 +226,16 @@ "LineStrip3DArrayLike", "LineStrip3DLike", "LineStrip3DType", + "Origin2D", "Origin2DArray", "Origin2DType", + "Origin3D", "Origin3DArray", "Origin3DType", + "Point2D", "Point2DArray", "Point2DType", + "Point3D", "Point3DArray", "Point3DType", "Radius", @@ -225,14 +243,19 @@ "RadiusArrayLike", "RadiusLike", "RadiusType", + "TensorData", "TensorDataArray", "TensorDataType", + "Text", "TextArray", + "TextLogLevel", "TextLogLevelArray", "TextLogLevelType", "TextType", + "Transform3D", "Transform3DArray", "Transform3DType", + "Vector3D", "Vector3DArray", "Vector3DType", ] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer1.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer1.py index 4b6906a697d4..f440a68fc643 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer1.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer1.py @@ -2,29 +2,65 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". + from __future__ import annotations -from .. import datatypes +from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, + TYPE_CHECKING, SupportsFloat, Literal) + +from attrs import define, field +import numpy as np +import numpy.typing as npt +import pyarrow as pa +import uuid + from .._baseclasses import ( - BaseDelegatingExtensionArray, + Archetype, + BaseExtensionType, + BaseExtensionArray, BaseDelegatingExtensionType, + BaseDelegatingExtensionArray +) +from .._converters import ( + int_or_none, + float_or_none, + bool_or_none, + str_or_none, + to_np_uint8, + to_np_uint16, + to_np_uint32, + to_np_uint64, + to_np_int8, + to_np_int16, + to_np_int32, + to_np_int64, + to_np_bool, + to_np_float16, + to_np_float32, + to_np_float64 ) +from .. import datatypes +__all__ = ["AffixFuzzer1", "AffixFuzzer1Array", "AffixFuzzer1Type"] -__all__ = ["AffixFuzzer1Array", "AffixFuzzer1Type"] + +class AffixFuzzer1(datatypes.AffixFuzzer1): + # You can define your own __init__ function as a member of AffixFuzzer1Ext in affix_fuzzer1_ext.py + + # Note: there are no fields here because AffixFuzzer1 delegates to datatypes.AffixFuzzer1 class AffixFuzzer1Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer1" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer1Type - class AffixFuzzer1Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer1ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer1" _EXTENSION_TYPE = AffixFuzzer1Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer1Array - AffixFuzzer1Type._ARRAY_TYPE = AffixFuzzer1Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer1Type()) + + diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer14.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer14.py index f5941f96032c..02c293830d3a 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer14.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer14.py @@ -2,29 +2,65 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". + from __future__ import annotations -from .. import datatypes +from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, + TYPE_CHECKING, SupportsFloat, Literal) + +from attrs import define, field +import numpy as np +import numpy.typing as npt +import pyarrow as pa +import uuid + from .._baseclasses import ( - BaseDelegatingExtensionArray, + Archetype, + BaseExtensionType, + BaseExtensionArray, BaseDelegatingExtensionType, + BaseDelegatingExtensionArray +) +from .._converters import ( + int_or_none, + float_or_none, + bool_or_none, + str_or_none, + to_np_uint8, + to_np_uint16, + to_np_uint32, + to_np_uint64, + to_np_int8, + to_np_int16, + to_np_int32, + to_np_int64, + to_np_bool, + to_np_float16, + to_np_float32, + to_np_float64 ) +from .. import datatypes +__all__ = ["AffixFuzzer14", "AffixFuzzer14Array", "AffixFuzzer14Type"] -__all__ = ["AffixFuzzer14Array", "AffixFuzzer14Type"] + +class AffixFuzzer14(datatypes.AffixFuzzer3): + # You can define your own __init__ function as a member of AffixFuzzer14Ext in affix_fuzzer14_ext.py + + # Note: there are no fields here because AffixFuzzer14 delegates to datatypes.AffixFuzzer3 class AffixFuzzer14Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer14" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer3Type - class AffixFuzzer14Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer3ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer14" _EXTENSION_TYPE = AffixFuzzer14Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer3Array - AffixFuzzer14Type._ARRAY_TYPE = AffixFuzzer14Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer14Type()) + + diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer15.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer15.py index a15964bca104..30760740ea74 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer15.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer15.py @@ -2,29 +2,65 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". + from __future__ import annotations -from .. import datatypes +from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, + TYPE_CHECKING, SupportsFloat, Literal) + +from attrs import define, field +import numpy as np +import numpy.typing as npt +import pyarrow as pa +import uuid + from .._baseclasses import ( - BaseDelegatingExtensionArray, + Archetype, + BaseExtensionType, + BaseExtensionArray, BaseDelegatingExtensionType, + BaseDelegatingExtensionArray +) +from .._converters import ( + int_or_none, + float_or_none, + bool_or_none, + str_or_none, + to_np_uint8, + to_np_uint16, + to_np_uint32, + to_np_uint64, + to_np_int8, + to_np_int16, + to_np_int32, + to_np_int64, + to_np_bool, + to_np_float16, + to_np_float32, + to_np_float64 ) +from .. import datatypes +__all__ = ["AffixFuzzer15", "AffixFuzzer15Array", "AffixFuzzer15Type"] -__all__ = ["AffixFuzzer15Array", "AffixFuzzer15Type"] + +class AffixFuzzer15(datatypes.AffixFuzzer3): + # You can define your own __init__ function as a member of AffixFuzzer15Ext in affix_fuzzer15_ext.py + + # Note: there are no fields here because AffixFuzzer15 delegates to datatypes.AffixFuzzer3 class AffixFuzzer15Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer15" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer3Type - class AffixFuzzer15Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer3ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer15" _EXTENSION_TYPE = AffixFuzzer15Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer3Array - AffixFuzzer15Type._ARRAY_TYPE = AffixFuzzer15Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer15Type()) + + diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer19.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer19.py index f5ae3cc793e0..0668e2913447 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer19.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer19.py @@ -2,29 +2,65 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". + from __future__ import annotations -from .. import datatypes +from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, + TYPE_CHECKING, SupportsFloat, Literal) + +from attrs import define, field +import numpy as np +import numpy.typing as npt +import pyarrow as pa +import uuid + from .._baseclasses import ( - BaseDelegatingExtensionArray, + Archetype, + BaseExtensionType, + BaseExtensionArray, BaseDelegatingExtensionType, + BaseDelegatingExtensionArray +) +from .._converters import ( + int_or_none, + float_or_none, + bool_or_none, + str_or_none, + to_np_uint8, + to_np_uint16, + to_np_uint32, + to_np_uint64, + to_np_int8, + to_np_int16, + to_np_int32, + to_np_int64, + to_np_bool, + to_np_float16, + to_np_float32, + to_np_float64 ) +from .. import datatypes +__all__ = ["AffixFuzzer19", "AffixFuzzer19Array", "AffixFuzzer19Type"] -__all__ = ["AffixFuzzer19Array", "AffixFuzzer19Type"] + +class AffixFuzzer19(datatypes.AffixFuzzer5): + # You can define your own __init__ function as a member of AffixFuzzer19Ext in affix_fuzzer19_ext.py + + # Note: there are no fields here because AffixFuzzer19 delegates to datatypes.AffixFuzzer5 class AffixFuzzer19Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer19" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer5Type - class AffixFuzzer19Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer5ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer19" _EXTENSION_TYPE = AffixFuzzer19Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer5Array - AffixFuzzer19Type._ARRAY_TYPE = AffixFuzzer19Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer19Type()) + + diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer2.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer2.py index c1a09757360b..07ac176844ca 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer2.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer2.py @@ -2,29 +2,65 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". + from __future__ import annotations -from .. import datatypes +from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, + TYPE_CHECKING, SupportsFloat, Literal) + +from attrs import define, field +import numpy as np +import numpy.typing as npt +import pyarrow as pa +import uuid + from .._baseclasses import ( - BaseDelegatingExtensionArray, + Archetype, + BaseExtensionType, + BaseExtensionArray, BaseDelegatingExtensionType, + BaseDelegatingExtensionArray +) +from .._converters import ( + int_or_none, + float_or_none, + bool_or_none, + str_or_none, + to_np_uint8, + to_np_uint16, + to_np_uint32, + to_np_uint64, + to_np_int8, + to_np_int16, + to_np_int32, + to_np_int64, + to_np_bool, + to_np_float16, + to_np_float32, + to_np_float64 ) +from .. import datatypes +__all__ = ["AffixFuzzer2", "AffixFuzzer2Array", "AffixFuzzer2Type"] -__all__ = ["AffixFuzzer2Array", "AffixFuzzer2Type"] + +class AffixFuzzer2(datatypes.AffixFuzzer1): + # You can define your own __init__ function as a member of AffixFuzzer2Ext in affix_fuzzer2_ext.py + + # Note: there are no fields here because AffixFuzzer2 delegates to datatypes.AffixFuzzer1 class AffixFuzzer2Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer2" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer1Type - class AffixFuzzer2Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer1ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer2" _EXTENSION_TYPE = AffixFuzzer2Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer1Array - AffixFuzzer2Type._ARRAY_TYPE = AffixFuzzer2Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer2Type()) + + diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer20.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer20.py index cf0d254cc0e0..ba47e6d3ae58 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer20.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer20.py @@ -2,29 +2,65 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". + from __future__ import annotations -from .. import datatypes +from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, + TYPE_CHECKING, SupportsFloat, Literal) + +from attrs import define, field +import numpy as np +import numpy.typing as npt +import pyarrow as pa +import uuid + from .._baseclasses import ( - BaseDelegatingExtensionArray, + Archetype, + BaseExtensionType, + BaseExtensionArray, BaseDelegatingExtensionType, + BaseDelegatingExtensionArray +) +from .._converters import ( + int_or_none, + float_or_none, + bool_or_none, + str_or_none, + to_np_uint8, + to_np_uint16, + to_np_uint32, + to_np_uint64, + to_np_int8, + to_np_int16, + to_np_int32, + to_np_int64, + to_np_bool, + to_np_float16, + to_np_float32, + to_np_float64 ) +from .. import datatypes +__all__ = ["AffixFuzzer20", "AffixFuzzer20Array", "AffixFuzzer20Type"] -__all__ = ["AffixFuzzer20Array", "AffixFuzzer20Type"] + +class AffixFuzzer20(datatypes.AffixFuzzer20): + # You can define your own __init__ function as a member of AffixFuzzer20Ext in affix_fuzzer20_ext.py + + # Note: there are no fields here because AffixFuzzer20 delegates to datatypes.AffixFuzzer20 class AffixFuzzer20Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer20" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer20Type - class AffixFuzzer20Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer20ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer20" _EXTENSION_TYPE = AffixFuzzer20Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer20Array - AffixFuzzer20Type._ARRAY_TYPE = AffixFuzzer20Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer20Type()) + + diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer3.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer3.py index 624b758f2bfe..889d2c192aa2 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer3.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer3.py @@ -2,29 +2,65 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". + from __future__ import annotations -from .. import datatypes +from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, + TYPE_CHECKING, SupportsFloat, Literal) + +from attrs import define, field +import numpy as np +import numpy.typing as npt +import pyarrow as pa +import uuid + from .._baseclasses import ( - BaseDelegatingExtensionArray, + Archetype, + BaseExtensionType, + BaseExtensionArray, BaseDelegatingExtensionType, + BaseDelegatingExtensionArray +) +from .._converters import ( + int_or_none, + float_or_none, + bool_or_none, + str_or_none, + to_np_uint8, + to_np_uint16, + to_np_uint32, + to_np_uint64, + to_np_int8, + to_np_int16, + to_np_int32, + to_np_int64, + to_np_bool, + to_np_float16, + to_np_float32, + to_np_float64 ) +from .. import datatypes +__all__ = ["AffixFuzzer3", "AffixFuzzer3Array", "AffixFuzzer3Type"] -__all__ = ["AffixFuzzer3Array", "AffixFuzzer3Type"] + +class AffixFuzzer3(datatypes.AffixFuzzer1): + # You can define your own __init__ function as a member of AffixFuzzer3Ext in affix_fuzzer3_ext.py + + # Note: there are no fields here because AffixFuzzer3 delegates to datatypes.AffixFuzzer1 class AffixFuzzer3Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer3" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer1Type - class AffixFuzzer3Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer1ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer3" _EXTENSION_TYPE = AffixFuzzer3Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer1Array - AffixFuzzer3Type._ARRAY_TYPE = AffixFuzzer3Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer3Type()) + + diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer4.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer4.py index b86fc183fca4..73ff96e75d1a 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer4.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer4.py @@ -2,29 +2,65 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". + from __future__ import annotations -from .. import datatypes +from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, + TYPE_CHECKING, SupportsFloat, Literal) + +from attrs import define, field +import numpy as np +import numpy.typing as npt +import pyarrow as pa +import uuid + from .._baseclasses import ( - BaseDelegatingExtensionArray, + Archetype, + BaseExtensionType, + BaseExtensionArray, BaseDelegatingExtensionType, + BaseDelegatingExtensionArray +) +from .._converters import ( + int_or_none, + float_or_none, + bool_or_none, + str_or_none, + to_np_uint8, + to_np_uint16, + to_np_uint32, + to_np_uint64, + to_np_int8, + to_np_int16, + to_np_int32, + to_np_int64, + to_np_bool, + to_np_float16, + to_np_float32, + to_np_float64 ) +from .. import datatypes +__all__ = ["AffixFuzzer4", "AffixFuzzer4Array", "AffixFuzzer4Type"] -__all__ = ["AffixFuzzer4Array", "AffixFuzzer4Type"] + +class AffixFuzzer4(datatypes.AffixFuzzer1): + # You can define your own __init__ function as a member of AffixFuzzer4Ext in affix_fuzzer4_ext.py + + # Note: there are no fields here because AffixFuzzer4 delegates to datatypes.AffixFuzzer1 class AffixFuzzer4Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer4" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer1Type - class AffixFuzzer4Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer1ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer4" _EXTENSION_TYPE = AffixFuzzer4Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer1Array - AffixFuzzer4Type._ARRAY_TYPE = AffixFuzzer4Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer4Type()) + + diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer5.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer5.py index f31e5615fe6f..60f08ff77ef3 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer5.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer5.py @@ -2,29 +2,65 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". + from __future__ import annotations -from .. import datatypes +from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, + TYPE_CHECKING, SupportsFloat, Literal) + +from attrs import define, field +import numpy as np +import numpy.typing as npt +import pyarrow as pa +import uuid + from .._baseclasses import ( - BaseDelegatingExtensionArray, + Archetype, + BaseExtensionType, + BaseExtensionArray, BaseDelegatingExtensionType, + BaseDelegatingExtensionArray +) +from .._converters import ( + int_or_none, + float_or_none, + bool_or_none, + str_or_none, + to_np_uint8, + to_np_uint16, + to_np_uint32, + to_np_uint64, + to_np_int8, + to_np_int16, + to_np_int32, + to_np_int64, + to_np_bool, + to_np_float16, + to_np_float32, + to_np_float64 ) +from .. import datatypes +__all__ = ["AffixFuzzer5", "AffixFuzzer5Array", "AffixFuzzer5Type"] -__all__ = ["AffixFuzzer5Array", "AffixFuzzer5Type"] + +class AffixFuzzer5(datatypes.AffixFuzzer1): + # You can define your own __init__ function as a member of AffixFuzzer5Ext in affix_fuzzer5_ext.py + + # Note: there are no fields here because AffixFuzzer5 delegates to datatypes.AffixFuzzer1 class AffixFuzzer5Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer5" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer1Type - class AffixFuzzer5Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer1ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer5" _EXTENSION_TYPE = AffixFuzzer5Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer1Array - AffixFuzzer5Type._ARRAY_TYPE = AffixFuzzer5Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer5Type()) + + diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer6.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer6.py index fafe5604faa2..2d76be66bde3 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer6.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer6.py @@ -2,29 +2,65 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". + from __future__ import annotations -from .. import datatypes +from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, + TYPE_CHECKING, SupportsFloat, Literal) + +from attrs import define, field +import numpy as np +import numpy.typing as npt +import pyarrow as pa +import uuid + from .._baseclasses import ( - BaseDelegatingExtensionArray, + Archetype, + BaseExtensionType, + BaseExtensionArray, BaseDelegatingExtensionType, + BaseDelegatingExtensionArray +) +from .._converters import ( + int_or_none, + float_or_none, + bool_or_none, + str_or_none, + to_np_uint8, + to_np_uint16, + to_np_uint32, + to_np_uint64, + to_np_int8, + to_np_int16, + to_np_int32, + to_np_int64, + to_np_bool, + to_np_float16, + to_np_float32, + to_np_float64 ) +from .. import datatypes +__all__ = ["AffixFuzzer6", "AffixFuzzer6Array", "AffixFuzzer6Type"] -__all__ = ["AffixFuzzer6Array", "AffixFuzzer6Type"] + +class AffixFuzzer6(datatypes.AffixFuzzer1): + # You can define your own __init__ function as a member of AffixFuzzer6Ext in affix_fuzzer6_ext.py + + # Note: there are no fields here because AffixFuzzer6 delegates to datatypes.AffixFuzzer1 class AffixFuzzer6Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer6" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer1Type - class AffixFuzzer6Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer1ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer6" _EXTENSION_TYPE = AffixFuzzer6Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer1Array - AffixFuzzer6Type._ARRAY_TYPE = AffixFuzzer6Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer6Type()) + + diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/class_id.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/class_id.py index 026e8895ba10..48460d8fc0c4 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/class_id.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/class_id.py @@ -10,7 +10,15 @@ BaseDelegatingExtensionType, ) -__all__ = ["ClassIdArray", "ClassIdType"] +__all__ = ["ClassId", "ClassIdArray", "ClassIdType"] + + +class ClassId(datatypes.ClassId): + """A 16-bit ID representing a type of semantic class.""" + + # You can define your own __init__ function as a member of ClassIdExt in class_id_ext.py + + # Note: there are no fields here because ClassId delegates to datatypes.ClassId class ClassIdType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/color.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/color.py index d8a27bcb664a..91213aa1674d 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/color.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/color.py @@ -10,7 +10,24 @@ BaseDelegatingExtensionType, ) -__all__ = ["ColorArray", "ColorType"] +__all__ = ["Color", "ColorArray", "ColorType"] + + +class Color(datatypes.Color): + """ + An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha. + + The color is stored as a 32-bit integer, where the most significant + byte is `R` and the least significant byte is `A`. + + Float colors are assumed to be in 0-1 gamma sRGB space. + All other colors are assumed to be in 0-255 gamma sRGB space. + If there is an alpha, we assume it is in linear space, and separate (NOT pre-multiplied). + """ + + # You can define your own __init__ function as a member of ColorExt in color_ext.py + + # Note: there are no fields here because Color delegates to datatypes.Color class ColorType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/half_sizes2d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/half_sizes2d.py index 1c61bc24a343..015a96963783 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/half_sizes2d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/half_sizes2d.py @@ -10,7 +10,20 @@ BaseDelegatingExtensionType, ) -__all__ = ["HalfSizes2DArray", "HalfSizes2DType"] +__all__ = ["HalfSizes2D", "HalfSizes2DArray", "HalfSizes2DType"] + + +class HalfSizes2D(datatypes.Vec2D): + """ + Half-sizes (extents) of a 2D box along its local axis, starting at its local origin/center. + + The box extends both in negative and positive direction along each axis. + Negative sizes indicate that the box is flipped along the respective axis, but this has no effect on how it is displayed. + """ + + # You can define your own __init__ function as a member of HalfSizes2DExt in half_sizes2d_ext.py + + # Note: there are no fields here because HalfSizes2D delegates to datatypes.Vec2D class HalfSizes2DType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/keypoint_id.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/keypoint_id.py index 8ad922b867c1..e83fa0ed7970 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/keypoint_id.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/keypoint_id.py @@ -10,7 +10,22 @@ BaseDelegatingExtensionType, ) -__all__ = ["KeypointIdArray", "KeypointIdType"] +__all__ = ["KeypointId", "KeypointIdArray", "KeypointIdType"] + + +class KeypointId(datatypes.KeypointId): + """ + A 16-bit ID representing a type of semantic keypoint within a class. + + `KeypointId`s are only meaningful within the context of a [`rerun.components.ClassDescription`][]. + + Used to look up an [`rerun.components.AnnotationInfo`][] for a Keypoint within the + [`rerun.components.AnnotationContext`]. + """ + + # You can define your own __init__ function as a member of KeypointIdExt in keypoint_id_ext.py + + # Note: there are no fields here because KeypointId delegates to datatypes.KeypointId class KeypointIdType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/origin2d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/origin2d.py index 7f320e5902da..27d0bd962d15 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/origin2d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/origin2d.py @@ -10,7 +10,15 @@ BaseDelegatingExtensionType, ) -__all__ = ["Origin2DArray", "Origin2DType"] +__all__ = ["Origin2D", "Origin2DArray", "Origin2DType"] + + +class Origin2D(datatypes.Vec2D): + """A point of origin in 2D space.""" + + # You can define your own __init__ function as a member of Origin2DExt in origin2d_ext.py + + # Note: there are no fields here because Origin2D delegates to datatypes.Vec2D class Origin2DType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/origin3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/origin3d.py index ea0359152f72..41aae3ce302a 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/origin3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/origin3d.py @@ -10,7 +10,15 @@ BaseDelegatingExtensionType, ) -__all__ = ["Origin3DArray", "Origin3DType"] +__all__ = ["Origin3D", "Origin3DArray", "Origin3DType"] + + +class Origin3D(datatypes.Vec3D): + """A point of origin in 3D space.""" + + # You can define your own __init__ function as a member of Origin3DExt in origin3d_ext.py + + # Note: there are no fields here because Origin3D delegates to datatypes.Vec3D class Origin3DType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/point2d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/point2d.py index 46bc854d1df4..317da7882138 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/point2d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/point2d.py @@ -10,7 +10,15 @@ BaseDelegatingExtensionType, ) -__all__ = ["Point2DArray", "Point2DType"] +__all__ = ["Point2D", "Point2DArray", "Point2DType"] + + +class Point2D(datatypes.Vec2D): + """A point in 2D space.""" + + # You can define your own __init__ function as a member of Point2DExt in point2d_ext.py + + # Note: there are no fields here because Point2D delegates to datatypes.Vec2D class Point2DType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/point3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/point3d.py index e75c60aa06dc..1f417314cc08 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/point3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/point3d.py @@ -10,7 +10,15 @@ BaseDelegatingExtensionType, ) -__all__ = ["Point3DArray", "Point3DType"] +__all__ = ["Point3D", "Point3DArray", "Point3DType"] + + +class Point3D(datatypes.Vec3D): + """A point in 3D space.""" + + # You can define your own __init__ function as a member of Point3DExt in point3d_ext.py + + # Note: there are no fields here because Point3D delegates to datatypes.Vec3D class Point3DType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/tensor_data.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/tensor_data.py index 388a27592fd9..940d2136115f 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/tensor_data.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/tensor_data.py @@ -2,29 +2,65 @@ # Based on "crates/re_types/definitions/rerun/components/tensor_data.fbs". + from __future__ import annotations -from .. import datatypes +from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, + TYPE_CHECKING, SupportsFloat, Literal) + +from attrs import define, field +import numpy as np +import numpy.typing as npt +import pyarrow as pa +import uuid + from .._baseclasses import ( - BaseDelegatingExtensionArray, + Archetype, + BaseExtensionType, + BaseExtensionArray, BaseDelegatingExtensionType, + BaseDelegatingExtensionArray +) +from .._converters import ( + int_or_none, + float_or_none, + bool_or_none, + str_or_none, + to_np_uint8, + to_np_uint16, + to_np_uint32, + to_np_uint64, + to_np_int8, + to_np_int16, + to_np_int32, + to_np_int64, + to_np_bool, + to_np_float16, + to_np_float32, + to_np_float64 ) +from .. import datatypes +__all__ = ["TensorData", "TensorDataArray", "TensorDataType"] -__all__ = ["TensorDataArray", "TensorDataType"] + +class TensorData(datatypes.TensorData): + # You can define your own __init__ function as a member of TensorDataExt in tensor_data_ext.py + + # Note: there are no fields here because TensorData delegates to datatypes.TensorData class TensorDataType(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.components.TensorData" _DELEGATED_EXTENSION_TYPE = datatypes.TensorDataType - class TensorDataArray(BaseDelegatingExtensionArray[datatypes.TensorDataArrayLike]): _EXTENSION_NAME = "rerun.components.TensorData" _EXTENSION_TYPE = TensorDataType _DELEGATED_ARRAY_TYPE = datatypes.TensorDataArray - TensorDataType._ARRAY_TYPE = TensorDataArray # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(TensorDataType()) + + diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/text.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/text.py index 23fd8b33c5bb..f2351539efe4 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/text.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/text.py @@ -10,7 +10,15 @@ BaseDelegatingExtensionType, ) -__all__ = ["TextArray", "TextType"] +__all__ = ["Text", "TextArray", "TextType"] + + +class Text(datatypes.Utf8): + """A string of text, e.g. for labels and text documents.""" + + # You can define your own __init__ function as a member of TextExt in text_ext.py + + # Note: there are no fields here because Text delegates to datatypes.Utf8 class TextType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/transform3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/transform3d.py index 7cd2aa3fd41a..de15af9ceb94 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/transform3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/transform3d.py @@ -10,7 +10,15 @@ BaseDelegatingExtensionType, ) -__all__ = ["Transform3DArray", "Transform3DType"] +__all__ = ["Transform3D", "Transform3DArray", "Transform3DType"] + + +class Transform3D(datatypes.Transform3D): + """An affine transform between two 3D spaces, represented in a given direction.""" + + # You can define your own __init__ function as a member of Transform3DExt in transform3d_ext.py + + # Note: there are no fields here because Transform3D delegates to datatypes.Transform3D class Transform3DType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/vector3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/vector3d.py index 920136b6a3da..b8b034fa3524 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/vector3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/vector3d.py @@ -10,7 +10,15 @@ BaseDelegatingExtensionType, ) -__all__ = ["Vector3DArray", "Vector3DType"] +__all__ = ["Vector3D", "Vector3DArray", "Vector3DType"] + + +class Vector3D(datatypes.Vec3D): + """A vector in 3D space.""" + + # You can define your own __init__ function as a member of Vector3DExt in vector3d_ext.py + + # Note: there are no fields here because Vector3D delegates to datatypes.Vec3D class Vector3DType(BaseDelegatingExtensionType): From d3d8b18e76744bb4a37de2eb6bdedca378a06865 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Wed, 13 Sep 2023 00:29:30 +0200 Subject: [PATCH 17/18] Add pass for delegating component declaration --- crates/re_types/source_hash.txt | 2 +- crates/re_types_builder/src/codegen/python.rs | 3 +- .../rerun/_rerun2/components/affix_fuzzer1.py | 41 +++---------------- .../_rerun2/components/affix_fuzzer14.py | 41 +++---------------- .../_rerun2/components/affix_fuzzer15.py | 41 +++---------------- .../_rerun2/components/affix_fuzzer19.py | 41 +++---------------- .../rerun/_rerun2/components/affix_fuzzer2.py | 41 +++---------------- .../_rerun2/components/affix_fuzzer20.py | 41 +++---------------- .../rerun/_rerun2/components/affix_fuzzer3.py | 41 +++---------------- .../rerun/_rerun2/components/affix_fuzzer4.py | 41 +++---------------- .../rerun/_rerun2/components/affix_fuzzer5.py | 41 +++---------------- .../rerun/_rerun2/components/affix_fuzzer6.py | 41 +++---------------- .../rerun/_rerun2/components/class_id.py | 1 + .../rerun/_rerun2/components/color.py | 1 + .../rerun/_rerun2/components/half_sizes2d.py | 1 + .../rerun/_rerun2/components/keypoint_id.py | 1 + .../rerun/_rerun2/components/origin2d.py | 1 + .../rerun/_rerun2/components/origin3d.py | 1 + .../rerun/_rerun2/components/point2d.py | 1 + .../rerun/_rerun2/components/point3d.py | 1 + .../rerun/_rerun2/components/tensor_data.py | 41 +++---------------- .../rerun/_rerun2/components/text.py | 1 + .../_rerun2/components/text_log_level.py | 1 + .../rerun/_rerun2/components/transform3d.py | 1 + .../rerun/_rerun2/components/vector3d.py | 1 + 25 files changed, 81 insertions(+), 387 deletions(-) diff --git a/crates/re_types/source_hash.txt b/crates/re_types/source_hash.txt index 6fb3b2f3b54e..59a09735b63d 100644 --- a/crates/re_types/source_hash.txt +++ b/crates/re_types/source_hash.txt @@ -1,4 +1,4 @@ # This is a sha256 hash for all direct and indirect dependencies of this crate's build script. # It can be safely removed at anytime to force the build script to run again. # Check out build.rs to see how it's computed. -762c15f15b857a7f139cdc66ccea6e442de44fde4b1a402b30b1f80bf44fe29d +9152129b25eb84575afb76d7c5a8a81161051cb24a56fb16cb938b15cd0b4fef diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index 4bf493603b8e..8420f42e5abe 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -648,9 +648,10 @@ fn code_for_struct( obj.name, obj.delegate_datatype(objects).unwrap().name ), - 2, + 1, 4, ); + code.push_text("pass", 2, 4); } else { // NOTE: We need to add required fields first, and then optional ones, otherwise mypy // complains. diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer1.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer1.py index f440a68fc643..9fab983b1553 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer1.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer1.py @@ -2,44 +2,14 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". - from __future__ import annotations -from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, - TYPE_CHECKING, SupportsFloat, Literal) - -from attrs import define, field -import numpy as np -import numpy.typing as npt -import pyarrow as pa -import uuid - +from .. import datatypes from .._baseclasses import ( - Archetype, - BaseExtensionType, - BaseExtensionArray, + BaseDelegatingExtensionArray, BaseDelegatingExtensionType, - BaseDelegatingExtensionArray -) -from .._converters import ( - int_or_none, - float_or_none, - bool_or_none, - str_or_none, - to_np_uint8, - to_np_uint16, - to_np_uint32, - to_np_uint64, - to_np_int8, - to_np_int16, - to_np_int32, - to_np_int64, - to_np_bool, - to_np_float16, - to_np_float32, - to_np_float64 ) -from .. import datatypes + __all__ = ["AffixFuzzer1", "AffixFuzzer1Array", "AffixFuzzer1Type"] @@ -47,20 +17,21 @@ class AffixFuzzer1(datatypes.AffixFuzzer1): # You can define your own __init__ function as a member of AffixFuzzer1Ext in affix_fuzzer1_ext.py # Note: there are no fields here because AffixFuzzer1 delegates to datatypes.AffixFuzzer1 + pass class AffixFuzzer1Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer1" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer1Type + class AffixFuzzer1Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer1ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer1" _EXTENSION_TYPE = AffixFuzzer1Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer1Array + AffixFuzzer1Type._ARRAY_TYPE = AffixFuzzer1Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer1Type()) - - diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer14.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer14.py index 02c293830d3a..444d52cae1d9 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer14.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer14.py @@ -2,44 +2,14 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". - from __future__ import annotations -from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, - TYPE_CHECKING, SupportsFloat, Literal) - -from attrs import define, field -import numpy as np -import numpy.typing as npt -import pyarrow as pa -import uuid - +from .. import datatypes from .._baseclasses import ( - Archetype, - BaseExtensionType, - BaseExtensionArray, + BaseDelegatingExtensionArray, BaseDelegatingExtensionType, - BaseDelegatingExtensionArray -) -from .._converters import ( - int_or_none, - float_or_none, - bool_or_none, - str_or_none, - to_np_uint8, - to_np_uint16, - to_np_uint32, - to_np_uint64, - to_np_int8, - to_np_int16, - to_np_int32, - to_np_int64, - to_np_bool, - to_np_float16, - to_np_float32, - to_np_float64 ) -from .. import datatypes + __all__ = ["AffixFuzzer14", "AffixFuzzer14Array", "AffixFuzzer14Type"] @@ -47,20 +17,21 @@ class AffixFuzzer14(datatypes.AffixFuzzer3): # You can define your own __init__ function as a member of AffixFuzzer14Ext in affix_fuzzer14_ext.py # Note: there are no fields here because AffixFuzzer14 delegates to datatypes.AffixFuzzer3 + pass class AffixFuzzer14Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer14" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer3Type + class AffixFuzzer14Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer3ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer14" _EXTENSION_TYPE = AffixFuzzer14Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer3Array + AffixFuzzer14Type._ARRAY_TYPE = AffixFuzzer14Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer14Type()) - - diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer15.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer15.py index 30760740ea74..f3bb66e8fcdf 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer15.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer15.py @@ -2,44 +2,14 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". - from __future__ import annotations -from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, - TYPE_CHECKING, SupportsFloat, Literal) - -from attrs import define, field -import numpy as np -import numpy.typing as npt -import pyarrow as pa -import uuid - +from .. import datatypes from .._baseclasses import ( - Archetype, - BaseExtensionType, - BaseExtensionArray, + BaseDelegatingExtensionArray, BaseDelegatingExtensionType, - BaseDelegatingExtensionArray -) -from .._converters import ( - int_or_none, - float_or_none, - bool_or_none, - str_or_none, - to_np_uint8, - to_np_uint16, - to_np_uint32, - to_np_uint64, - to_np_int8, - to_np_int16, - to_np_int32, - to_np_int64, - to_np_bool, - to_np_float16, - to_np_float32, - to_np_float64 ) -from .. import datatypes + __all__ = ["AffixFuzzer15", "AffixFuzzer15Array", "AffixFuzzer15Type"] @@ -47,20 +17,21 @@ class AffixFuzzer15(datatypes.AffixFuzzer3): # You can define your own __init__ function as a member of AffixFuzzer15Ext in affix_fuzzer15_ext.py # Note: there are no fields here because AffixFuzzer15 delegates to datatypes.AffixFuzzer3 + pass class AffixFuzzer15Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer15" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer3Type + class AffixFuzzer15Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer3ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer15" _EXTENSION_TYPE = AffixFuzzer15Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer3Array + AffixFuzzer15Type._ARRAY_TYPE = AffixFuzzer15Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer15Type()) - - diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer19.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer19.py index 0668e2913447..4e4c82e9f168 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer19.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer19.py @@ -2,44 +2,14 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". - from __future__ import annotations -from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, - TYPE_CHECKING, SupportsFloat, Literal) - -from attrs import define, field -import numpy as np -import numpy.typing as npt -import pyarrow as pa -import uuid - +from .. import datatypes from .._baseclasses import ( - Archetype, - BaseExtensionType, - BaseExtensionArray, + BaseDelegatingExtensionArray, BaseDelegatingExtensionType, - BaseDelegatingExtensionArray -) -from .._converters import ( - int_or_none, - float_or_none, - bool_or_none, - str_or_none, - to_np_uint8, - to_np_uint16, - to_np_uint32, - to_np_uint64, - to_np_int8, - to_np_int16, - to_np_int32, - to_np_int64, - to_np_bool, - to_np_float16, - to_np_float32, - to_np_float64 ) -from .. import datatypes + __all__ = ["AffixFuzzer19", "AffixFuzzer19Array", "AffixFuzzer19Type"] @@ -47,20 +17,21 @@ class AffixFuzzer19(datatypes.AffixFuzzer5): # You can define your own __init__ function as a member of AffixFuzzer19Ext in affix_fuzzer19_ext.py # Note: there are no fields here because AffixFuzzer19 delegates to datatypes.AffixFuzzer5 + pass class AffixFuzzer19Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer19" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer5Type + class AffixFuzzer19Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer5ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer19" _EXTENSION_TYPE = AffixFuzzer19Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer5Array + AffixFuzzer19Type._ARRAY_TYPE = AffixFuzzer19Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer19Type()) - - diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer2.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer2.py index 07ac176844ca..99f74322bfc0 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer2.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer2.py @@ -2,44 +2,14 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". - from __future__ import annotations -from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, - TYPE_CHECKING, SupportsFloat, Literal) - -from attrs import define, field -import numpy as np -import numpy.typing as npt -import pyarrow as pa -import uuid - +from .. import datatypes from .._baseclasses import ( - Archetype, - BaseExtensionType, - BaseExtensionArray, + BaseDelegatingExtensionArray, BaseDelegatingExtensionType, - BaseDelegatingExtensionArray -) -from .._converters import ( - int_or_none, - float_or_none, - bool_or_none, - str_or_none, - to_np_uint8, - to_np_uint16, - to_np_uint32, - to_np_uint64, - to_np_int8, - to_np_int16, - to_np_int32, - to_np_int64, - to_np_bool, - to_np_float16, - to_np_float32, - to_np_float64 ) -from .. import datatypes + __all__ = ["AffixFuzzer2", "AffixFuzzer2Array", "AffixFuzzer2Type"] @@ -47,20 +17,21 @@ class AffixFuzzer2(datatypes.AffixFuzzer1): # You can define your own __init__ function as a member of AffixFuzzer2Ext in affix_fuzzer2_ext.py # Note: there are no fields here because AffixFuzzer2 delegates to datatypes.AffixFuzzer1 + pass class AffixFuzzer2Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer2" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer1Type + class AffixFuzzer2Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer1ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer2" _EXTENSION_TYPE = AffixFuzzer2Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer1Array + AffixFuzzer2Type._ARRAY_TYPE = AffixFuzzer2Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer2Type()) - - diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer20.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer20.py index ba47e6d3ae58..271815cecbd0 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer20.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer20.py @@ -2,44 +2,14 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". - from __future__ import annotations -from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, - TYPE_CHECKING, SupportsFloat, Literal) - -from attrs import define, field -import numpy as np -import numpy.typing as npt -import pyarrow as pa -import uuid - +from .. import datatypes from .._baseclasses import ( - Archetype, - BaseExtensionType, - BaseExtensionArray, + BaseDelegatingExtensionArray, BaseDelegatingExtensionType, - BaseDelegatingExtensionArray -) -from .._converters import ( - int_or_none, - float_or_none, - bool_or_none, - str_or_none, - to_np_uint8, - to_np_uint16, - to_np_uint32, - to_np_uint64, - to_np_int8, - to_np_int16, - to_np_int32, - to_np_int64, - to_np_bool, - to_np_float16, - to_np_float32, - to_np_float64 ) -from .. import datatypes + __all__ = ["AffixFuzzer20", "AffixFuzzer20Array", "AffixFuzzer20Type"] @@ -47,20 +17,21 @@ class AffixFuzzer20(datatypes.AffixFuzzer20): # You can define your own __init__ function as a member of AffixFuzzer20Ext in affix_fuzzer20_ext.py # Note: there are no fields here because AffixFuzzer20 delegates to datatypes.AffixFuzzer20 + pass class AffixFuzzer20Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer20" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer20Type + class AffixFuzzer20Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer20ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer20" _EXTENSION_TYPE = AffixFuzzer20Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer20Array + AffixFuzzer20Type._ARRAY_TYPE = AffixFuzzer20Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer20Type()) - - diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer3.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer3.py index 889d2c192aa2..f5cd61b91810 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer3.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer3.py @@ -2,44 +2,14 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". - from __future__ import annotations -from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, - TYPE_CHECKING, SupportsFloat, Literal) - -from attrs import define, field -import numpy as np -import numpy.typing as npt -import pyarrow as pa -import uuid - +from .. import datatypes from .._baseclasses import ( - Archetype, - BaseExtensionType, - BaseExtensionArray, + BaseDelegatingExtensionArray, BaseDelegatingExtensionType, - BaseDelegatingExtensionArray -) -from .._converters import ( - int_or_none, - float_or_none, - bool_or_none, - str_or_none, - to_np_uint8, - to_np_uint16, - to_np_uint32, - to_np_uint64, - to_np_int8, - to_np_int16, - to_np_int32, - to_np_int64, - to_np_bool, - to_np_float16, - to_np_float32, - to_np_float64 ) -from .. import datatypes + __all__ = ["AffixFuzzer3", "AffixFuzzer3Array", "AffixFuzzer3Type"] @@ -47,20 +17,21 @@ class AffixFuzzer3(datatypes.AffixFuzzer1): # You can define your own __init__ function as a member of AffixFuzzer3Ext in affix_fuzzer3_ext.py # Note: there are no fields here because AffixFuzzer3 delegates to datatypes.AffixFuzzer1 + pass class AffixFuzzer3Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer3" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer1Type + class AffixFuzzer3Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer1ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer3" _EXTENSION_TYPE = AffixFuzzer3Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer1Array + AffixFuzzer3Type._ARRAY_TYPE = AffixFuzzer3Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer3Type()) - - diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer4.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer4.py index 73ff96e75d1a..1e37c1cd39f8 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer4.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer4.py @@ -2,44 +2,14 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". - from __future__ import annotations -from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, - TYPE_CHECKING, SupportsFloat, Literal) - -from attrs import define, field -import numpy as np -import numpy.typing as npt -import pyarrow as pa -import uuid - +from .. import datatypes from .._baseclasses import ( - Archetype, - BaseExtensionType, - BaseExtensionArray, + BaseDelegatingExtensionArray, BaseDelegatingExtensionType, - BaseDelegatingExtensionArray -) -from .._converters import ( - int_or_none, - float_or_none, - bool_or_none, - str_or_none, - to_np_uint8, - to_np_uint16, - to_np_uint32, - to_np_uint64, - to_np_int8, - to_np_int16, - to_np_int32, - to_np_int64, - to_np_bool, - to_np_float16, - to_np_float32, - to_np_float64 ) -from .. import datatypes + __all__ = ["AffixFuzzer4", "AffixFuzzer4Array", "AffixFuzzer4Type"] @@ -47,20 +17,21 @@ class AffixFuzzer4(datatypes.AffixFuzzer1): # You can define your own __init__ function as a member of AffixFuzzer4Ext in affix_fuzzer4_ext.py # Note: there are no fields here because AffixFuzzer4 delegates to datatypes.AffixFuzzer1 + pass class AffixFuzzer4Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer4" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer1Type + class AffixFuzzer4Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer1ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer4" _EXTENSION_TYPE = AffixFuzzer4Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer1Array + AffixFuzzer4Type._ARRAY_TYPE = AffixFuzzer4Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer4Type()) - - diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer5.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer5.py index 60f08ff77ef3..b8fdf2940708 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer5.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer5.py @@ -2,44 +2,14 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". - from __future__ import annotations -from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, - TYPE_CHECKING, SupportsFloat, Literal) - -from attrs import define, field -import numpy as np -import numpy.typing as npt -import pyarrow as pa -import uuid - +from .. import datatypes from .._baseclasses import ( - Archetype, - BaseExtensionType, - BaseExtensionArray, + BaseDelegatingExtensionArray, BaseDelegatingExtensionType, - BaseDelegatingExtensionArray -) -from .._converters import ( - int_or_none, - float_or_none, - bool_or_none, - str_or_none, - to_np_uint8, - to_np_uint16, - to_np_uint32, - to_np_uint64, - to_np_int8, - to_np_int16, - to_np_int32, - to_np_int64, - to_np_bool, - to_np_float16, - to_np_float32, - to_np_float64 ) -from .. import datatypes + __all__ = ["AffixFuzzer5", "AffixFuzzer5Array", "AffixFuzzer5Type"] @@ -47,20 +17,21 @@ class AffixFuzzer5(datatypes.AffixFuzzer1): # You can define your own __init__ function as a member of AffixFuzzer5Ext in affix_fuzzer5_ext.py # Note: there are no fields here because AffixFuzzer5 delegates to datatypes.AffixFuzzer1 + pass class AffixFuzzer5Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer5" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer1Type + class AffixFuzzer5Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer1ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer5" _EXTENSION_TYPE = AffixFuzzer5Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer1Array + AffixFuzzer5Type._ARRAY_TYPE = AffixFuzzer5Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer5Type()) - - diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer6.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer6.py index 2d76be66bde3..25a8a17c22d0 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer6.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer6.py @@ -2,44 +2,14 @@ # Based on "crates/re_types/definitions/rerun/testing/components/fuzzy.fbs". - from __future__ import annotations -from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, - TYPE_CHECKING, SupportsFloat, Literal) - -from attrs import define, field -import numpy as np -import numpy.typing as npt -import pyarrow as pa -import uuid - +from .. import datatypes from .._baseclasses import ( - Archetype, - BaseExtensionType, - BaseExtensionArray, + BaseDelegatingExtensionArray, BaseDelegatingExtensionType, - BaseDelegatingExtensionArray -) -from .._converters import ( - int_or_none, - float_or_none, - bool_or_none, - str_or_none, - to_np_uint8, - to_np_uint16, - to_np_uint32, - to_np_uint64, - to_np_int8, - to_np_int16, - to_np_int32, - to_np_int64, - to_np_bool, - to_np_float16, - to_np_float32, - to_np_float64 ) -from .. import datatypes + __all__ = ["AffixFuzzer6", "AffixFuzzer6Array", "AffixFuzzer6Type"] @@ -47,20 +17,21 @@ class AffixFuzzer6(datatypes.AffixFuzzer1): # You can define your own __init__ function as a member of AffixFuzzer6Ext in affix_fuzzer6_ext.py # Note: there are no fields here because AffixFuzzer6 delegates to datatypes.AffixFuzzer1 + pass class AffixFuzzer6Type(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.testing.components.AffixFuzzer6" _DELEGATED_EXTENSION_TYPE = datatypes.AffixFuzzer1Type + class AffixFuzzer6Array(BaseDelegatingExtensionArray[datatypes.AffixFuzzer1ArrayLike]): _EXTENSION_NAME = "rerun.testing.components.AffixFuzzer6" _EXTENSION_TYPE = AffixFuzzer6Type _DELEGATED_ARRAY_TYPE = datatypes.AffixFuzzer1Array + AffixFuzzer6Type._ARRAY_TYPE = AffixFuzzer6Array # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(AffixFuzzer6Type()) - - diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/class_id.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/class_id.py index 48460d8fc0c4..ae768a8b56ec 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/class_id.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/class_id.py @@ -19,6 +19,7 @@ class ClassId(datatypes.ClassId): # You can define your own __init__ function as a member of ClassIdExt in class_id_ext.py # Note: there are no fields here because ClassId delegates to datatypes.ClassId + pass class ClassIdType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/color.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/color.py index 91213aa1674d..471413d1e9a3 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/color.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/color.py @@ -28,6 +28,7 @@ class Color(datatypes.Color): # You can define your own __init__ function as a member of ColorExt in color_ext.py # Note: there are no fields here because Color delegates to datatypes.Color + pass class ColorType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/half_sizes2d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/half_sizes2d.py index 015a96963783..fd4b0b1dd07f 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/half_sizes2d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/half_sizes2d.py @@ -24,6 +24,7 @@ class HalfSizes2D(datatypes.Vec2D): # You can define your own __init__ function as a member of HalfSizes2DExt in half_sizes2d_ext.py # Note: there are no fields here because HalfSizes2D delegates to datatypes.Vec2D + pass class HalfSizes2DType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/keypoint_id.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/keypoint_id.py index e83fa0ed7970..d7d6f60bb974 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/keypoint_id.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/keypoint_id.py @@ -26,6 +26,7 @@ class KeypointId(datatypes.KeypointId): # You can define your own __init__ function as a member of KeypointIdExt in keypoint_id_ext.py # Note: there are no fields here because KeypointId delegates to datatypes.KeypointId + pass class KeypointIdType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/origin2d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/origin2d.py index 27d0bd962d15..9aa1144181bc 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/origin2d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/origin2d.py @@ -19,6 +19,7 @@ class Origin2D(datatypes.Vec2D): # You can define your own __init__ function as a member of Origin2DExt in origin2d_ext.py # Note: there are no fields here because Origin2D delegates to datatypes.Vec2D + pass class Origin2DType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/origin3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/origin3d.py index 41aae3ce302a..e9bbcdca9081 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/origin3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/origin3d.py @@ -19,6 +19,7 @@ class Origin3D(datatypes.Vec3D): # You can define your own __init__ function as a member of Origin3DExt in origin3d_ext.py # Note: there are no fields here because Origin3D delegates to datatypes.Vec3D + pass class Origin3DType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/point2d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/point2d.py index 317da7882138..37698f13a6b7 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/point2d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/point2d.py @@ -19,6 +19,7 @@ class Point2D(datatypes.Vec2D): # You can define your own __init__ function as a member of Point2DExt in point2d_ext.py # Note: there are no fields here because Point2D delegates to datatypes.Vec2D + pass class Point2DType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/point3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/point3d.py index 1f417314cc08..2d5d024e704f 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/point3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/point3d.py @@ -19,6 +19,7 @@ class Point3D(datatypes.Vec3D): # You can define your own __init__ function as a member of Point3DExt in point3d_ext.py # Note: there are no fields here because Point3D delegates to datatypes.Vec3D + pass class Point3DType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/tensor_data.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/tensor_data.py index 940d2136115f..ee0f686683bf 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/tensor_data.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/tensor_data.py @@ -2,44 +2,14 @@ # Based on "crates/re_types/definitions/rerun/components/tensor_data.fbs". - from __future__ import annotations -from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, - TYPE_CHECKING, SupportsFloat, Literal) - -from attrs import define, field -import numpy as np -import numpy.typing as npt -import pyarrow as pa -import uuid - +from .. import datatypes from .._baseclasses import ( - Archetype, - BaseExtensionType, - BaseExtensionArray, + BaseDelegatingExtensionArray, BaseDelegatingExtensionType, - BaseDelegatingExtensionArray -) -from .._converters import ( - int_or_none, - float_or_none, - bool_or_none, - str_or_none, - to_np_uint8, - to_np_uint16, - to_np_uint32, - to_np_uint64, - to_np_int8, - to_np_int16, - to_np_int32, - to_np_int64, - to_np_bool, - to_np_float16, - to_np_float32, - to_np_float64 ) -from .. import datatypes + __all__ = ["TensorData", "TensorDataArray", "TensorDataType"] @@ -47,20 +17,21 @@ class TensorData(datatypes.TensorData): # You can define your own __init__ function as a member of TensorDataExt in tensor_data_ext.py # Note: there are no fields here because TensorData delegates to datatypes.TensorData + pass class TensorDataType(BaseDelegatingExtensionType): _TYPE_NAME = "rerun.components.TensorData" _DELEGATED_EXTENSION_TYPE = datatypes.TensorDataType + class TensorDataArray(BaseDelegatingExtensionArray[datatypes.TensorDataArrayLike]): _EXTENSION_NAME = "rerun.components.TensorData" _EXTENSION_TYPE = TensorDataType _DELEGATED_ARRAY_TYPE = datatypes.TensorDataArray + TensorDataType._ARRAY_TYPE = TensorDataArray # TODO(cmc): bring back registration to pyarrow once legacy types are gone # pa.register_extension_type(TensorDataType()) - - diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/text.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/text.py index f2351539efe4..f58f5b49a717 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/text.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/text.py @@ -19,6 +19,7 @@ class Text(datatypes.Utf8): # You can define your own __init__ function as a member of TextExt in text_ext.py # Note: there are no fields here because Text delegates to datatypes.Utf8 + pass class TextType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level.py index 4d59f61b3c85..1f793842c98e 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level.py @@ -30,6 +30,7 @@ class TextLogLevel(TextLogLevelExt, datatypes.Utf8): # You can define your own __init__ function as a member of TextLogLevelExt in text_log_level_ext.py # Note: there are no fields here because TextLogLevel delegates to datatypes.Utf8 + pass class TextLogLevelType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/transform3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/transform3d.py index de15af9ceb94..087c88c1dd00 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/transform3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/transform3d.py @@ -19,6 +19,7 @@ class Transform3D(datatypes.Transform3D): # You can define your own __init__ function as a member of Transform3DExt in transform3d_ext.py # Note: there are no fields here because Transform3D delegates to datatypes.Transform3D + pass class Transform3DType(BaseDelegatingExtensionType): diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/vector3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/vector3d.py index b8b034fa3524..d80731a9d29d 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/vector3d.py +++ b/rerun_py/rerun_sdk/rerun/_rerun2/components/vector3d.py @@ -19,6 +19,7 @@ class Vector3D(datatypes.Vec3D): # You can define your own __init__ function as a member of Vector3DExt in vector3d_ext.py # Note: there are no fields here because Vector3D delegates to datatypes.Vec3D + pass class Vector3DType(BaseDelegatingExtensionType): From 177f58319e85da35d223c1fd0a109d35fbc7bd03 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Wed, 13 Sep 2023 15:34:55 +0200 Subject: [PATCH 18/18] Bad merge --- crates/re_types/source_hash.txt | 2 +- crates/re_types_builder/src/codegen/python.rs | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/re_types/source_hash.txt b/crates/re_types/source_hash.txt index 3c1a9cb2b194..07a0c1f4f571 100644 --- a/crates/re_types/source_hash.txt +++ b/crates/re_types/source_hash.txt @@ -1,4 +1,4 @@ # This is a sha256 hash for all direct and indirect dependencies of this crate's build script. # It can be safely removed at anytime to force the build script to run again. # Check out build.rs to see how it's computed. -a75b6f06caee08354ca51d671fb98f14bc247980f2eb3584c181c6cd21b695ca +e5b4091795cf7d9702b7d034faa0d5338d99af69450b1c9e61f11fa8c8f9e9c7 diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index 696117b25d2a..567ffd944520 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -584,10 +584,10 @@ fn code_for_struct( )); } - let superclass_decl = if !superclasses.is_empty() { - format!("({})", superclasses.join(",")) - } else { + let superclass_decl = if superclasses.is_empty() { String::new() + } else { + format!("({})", superclasses.join(",")) }; let define_args = if *kind == ObjectKind::Archetype { @@ -599,16 +599,16 @@ fn code_for_struct( init_define_arg }; - let define_args = if !define_args.is_empty() { - format!("({define_args})") - } else { + let define_args = if define_args.is_empty() { define_args + } else { + format!("({define_args})") }; - let define_decorator = if !obj.is_delegating_component() { - format!("@define{define_args}") - } else { + let define_decorator = if obj.is_delegating_component() { String::new() + } else { + format!("@define{define_args}") }; code.push_unindented_text(