Skip to content

Commit

Permalink
types are types, but type aliases are Types with a T
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Jun 13, 2023
1 parent b906479 commit 243b57f
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 18 deletions.
6 changes: 4 additions & 2 deletions rerun_py/rerun_sdk/rerun2/components/class_id_ext.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
from __future__ import annotations

from typing import Any, Sequence
__all__ = ["ClassIdArrayExt"]

from typing import Any, Sequence, Type

import numpy as np
import pyarrow as pa


class ClassIdArrayExt:
@staticmethod
def _from_similar(data: Any | None, *, mono: type, mono_aliases: type, many: type, many_aliases: type, arrow: type):
def _from_similar(data: Any | None, *, mono: type, mono_aliases: Type, many: type, many_aliases: Type, arrow: type):
if isinstance(data, Sequence) and (len(data) > 0 and isinstance(data[0], mono)):
array = np.asarray([class_id.id for class_id in data], np.uint16)
else:
Expand Down
6 changes: 4 additions & 2 deletions rerun_py/rerun_sdk/rerun2/components/color_ext.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from __future__ import annotations

from typing import Any, Sequence
__all__ = ["ColorArrayExt"]

from typing import Any, Sequence, Type

import numpy as np
import pyarrow as pa
Expand All @@ -10,7 +12,7 @@

class ColorArrayExt:
@staticmethod
def _from_similar(data: Any | None, *, mono: type, mono_aliases: type, many: type, many_aliases: type, arrow: type):
def _from_similar(data: Any | None, *, mono: type, mono_aliases: Type, many: type, many_aliases: Type, arrow: type):
"""
Normalize flexible colors arrays.
Expand Down
6 changes: 4 additions & 2 deletions rerun_py/rerun_sdk/rerun2/components/draw_order_ext.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
from __future__ import annotations

from typing import Any, Sequence
__all__ = ["DrawOrderArrayExt"]

from typing import Any, Sequence, Type

import numpy as np
import pyarrow as pa


class DrawOrderArrayExt:
@staticmethod
def _from_similar(data: Any | None, *, mono: type, mono_aliases: type, many: type, many_aliases: type, arrow: type):
def _from_similar(data: Any | None, *, mono: type, mono_aliases: Type, many: type, many_aliases: Type, arrow: type):
if isinstance(data, Sequence) and (len(data) > 0 and isinstance(data[0], mono)):
array = np.asarray([draw_order.value for draw_order in data], np.float32)
else:
Expand Down
6 changes: 4 additions & 2 deletions rerun_py/rerun_sdk/rerun2/components/instance_key_ext.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
from __future__ import annotations

from typing import Any, Sequence
__all__ = ["InstanceKeyArrayExt"]

from typing import Any, Sequence, Type

import numpy as np
import pyarrow as pa


class InstanceKeyArrayExt:
@staticmethod
def _from_similar(data: Any | None, *, mono: type, mono_aliases: type, many: type, many_aliases: type, arrow: type):
def _from_similar(data: Any | None, *, mono: type, mono_aliases: Type, many: type, many_aliases: Type, arrow: type):
if isinstance(data, Sequence) and (len(data) > 0 and isinstance(data[0], mono)):
array = np.asarray([datum.value for datum in data], np.uint64)
else:
Expand Down
6 changes: 4 additions & 2 deletions rerun_py/rerun_sdk/rerun2/components/keypoint_id_ext.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
from __future__ import annotations

from typing import Any, Sequence
__all__ = ["KeypointIdArrayExt"]

from typing import Any, Sequence, Type

import numpy as np
import pyarrow as pa


class KeypointIdArrayExt:
@staticmethod
def _from_similar(data: Any | None, *, mono: type, mono_aliases: type, many: type, many_aliases: type, arrow: type):
def _from_similar(data: Any | None, *, mono: type, mono_aliases: Type, many: type, many_aliases: Type, arrow: type):
if isinstance(data, Sequence) and (len(data) > 0 and isinstance(data[0], mono)):
array = np.asarray([class_id.id for class_id in data], np.uint16)
else:
Expand Down
6 changes: 4 additions & 2 deletions rerun_py/rerun_sdk/rerun2/components/label_ext.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from __future__ import annotations

from typing import Any, Sequence
__all__ = ["LabelArrayExt"]

from typing import Any, Sequence, Type

import pyarrow as pa


class LabelArrayExt:
@staticmethod
def _from_similar(data: Any | None, *, mono: type, mono_aliases: type, many: type, many_aliases: type, arrow: type):
def _from_similar(data: Any | None, *, mono: type, mono_aliases: Type, many: type, many_aliases: Type, arrow: type):
if isinstance(data, Sequence):
array = [str(datum) for datum in data]
else:
Expand Down
4 changes: 2 additions & 2 deletions rerun_py/rerun_sdk/rerun2/components/point2d_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

__all__ = ["Point2DArrayExt"]

from typing import Any, Sequence
from typing import Any, Sequence, Type

import numpy as np
import pyarrow as pa


class Point2DArrayExt:
@staticmethod
def _from_similar(data: Any | None, *, mono: type, mono_aliases: type, many: type, many_aliases: type, arrow: type):
def _from_similar(data: Any | None, *, mono: type, mono_aliases: Type, many: type, many_aliases: Type, arrow: type):
if isinstance(data, Sequence) and (len(data) > 0 and isinstance(data[0], mono)):
arrays = [np.asarray(datum) for datum in data]
else:
Expand Down
4 changes: 2 additions & 2 deletions rerun_py/rerun_sdk/rerun2/components/radius_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

__all__ = ["RadiusArrayExt"]

from typing import Any, Sequence
from typing import Any, Sequence, Type

import numpy as np
import pyarrow as pa


class RadiusArrayExt:
@staticmethod
def _from_similar(data: Any | None, *, mono: type, mono_aliases: type, many: type, many_aliases: type, arrow: type):
def _from_similar(data: Any | None, *, mono: type, mono_aliases: Type, many: type, many_aliases: Type, arrow: type):
if isinstance(data, Sequence) and (len(data) > 0 and isinstance(data[0], mono)):
array = np.asarray([radius.value for radius in data], np.float32)
else:
Expand Down
4 changes: 2 additions & 2 deletions rerun_py/rerun_sdk/rerun2/datatypes/vec2d_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

__all__ = ["Vec2DArrayExt"]

from typing import Any, Sequence
from typing import Any, Sequence, Type

import numpy as np
import pyarrow as pa


class Vec2DArrayExt:
@staticmethod
def _from_similar(data: Any | None, *, mono: type, mono_aliases: type, many: type, many_aliases: type, arrow: type):
def _from_similar(data: Any | None, *, mono: type, mono_aliases: Type, many: type, many_aliases: Type, arrow: type):
if isinstance(data, Sequence) and (len(data) > 0 and isinstance(data[0], mono)):
arrays = [np.asarray(datum) for datum in data]
else:
Expand Down

0 comments on commit 243b57f

Please sign in to comment.