Skip to content

Commit

Permalink
Flip order rpy (#5)
Browse files Browse the repository at this point in the history
* flip rpy

* version bump

* update deps

* run ruff

* change publish workflow
  • Loading branch information
monoclecat authored Apr 22, 2024
1 parent 3922a01 commit 49bc838
Show file tree
Hide file tree
Showing 18 changed files with 198 additions and 307 deletions.
11 changes: 2 additions & 9 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Publish Python 🐍 distribution 📦 to PyPI

on:
push:
tags: '*'
tags:
- v*

jobs:
build:
Expand Down Expand Up @@ -78,14 +79,6 @@ jobs:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
Expand Down
284 changes: 142 additions & 142 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "uai_openlabel"
version = "0.3.6"
version = "0.3.7"
description = "A library to produce and parse JSONs in the OpenLABEL format."
license = "MIT"
authors = ["understand.ai <[email protected]>"]
Expand Down
4 changes: 1 addition & 3 deletions uai_openlabel/coordinate_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,4 @@ class CoordinateSystem(JsonSnakeCaseSerializableMixin):
children: Optional[Sequence[CoordinateSystemUid]] = field(
default=None
) # TODO See 7.8 first json example: child can also be what is defined in 6.4
pose_wrt_parent: Optional[
Union[Matrix4x4TransformData, QuaternionTransformData, EulerTransformData]
] = field(default=None)
pose_wrt_parent: Optional[Union[Matrix4x4TransformData, QuaternionTransformData, EulerTransformData]] = field(default=None)
8 changes: 2 additions & 6 deletions uai_openlabel/data_types/data_to_pointer_type_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@
)

# Don't export this, only the function
DATA_TO_POINTER_TYPE_MAPPING: dict[
type[Union[GenericData, GeometricData]], Union[GenericDataType, GeometricDataType]
] = {
DATA_TO_POINTER_TYPE_MAPPING: dict[type[Union[GenericData, GeometricData]], Union[GenericDataType, GeometricDataType]] = {
# GenericData
BooleanData: GenericDataType.Boolean,
NumberData: GenericDataType.Number,
Expand All @@ -61,9 +59,7 @@
}


def map_data_to_data_pointer_type(
data: Union[GenericData, GeometricData]
) -> Union[GenericDataType, GeometricDataType]:
def map_data_to_data_pointer_type(data: Union[GenericData, GeometricData]) -> Union[GenericDataType, GeometricDataType]:
if data.__class__ not in DATA_TO_POINTER_TYPE_MAPPING:
raise KeyError(data)
return DATA_TO_POINTER_TYPE_MAPPING[data.__class__]
36 changes: 10 additions & 26 deletions uai_openlabel/data_types/geometric_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ class ThreeDBoundingBoxQuaternion(JsonSnakeCaseSerializableMixin):
sz m The z-dimension of the cuboid or the z-coordinate.
"""

val: tuple[
Number, Number, Number, Number, Number, Number, Number, Number, Number, Number
] = field(
val: tuple[Number, Number, Number, Number, Number, Number, Number, Number, Number, Number] = field(
default_factory=lambda: no_default(field="ThreeDBoundingBoxQuaternion.val"),
metadata=required,
)
Expand Down Expand Up @@ -172,17 +170,15 @@ class ThreeDBoundingBoxEuler(JsonSnakeCaseSerializableMixin):
x m The x-coordinate of the 3D position of the center of the cuboid.
y m The y-coordinate of the 3D position of the center of the cuboid.
z m The z-coordinate of the 3D position of the center of the cuboid.
rz rad Euler angles, rz = yaw.
ry rad Euler angles, ry = pitch.
rx rad Euler angles, rx = roll.
ry rad Euler angles, ry = pitch.
rz rad Euler angles, rz = yaw.
sx m The x-dimension of the cuboid or the x-coordinate.
sy m The y-dimension of the cuboid or the y-coordinate.
sz m The z-dimension of the cuboid or the z-coordinate.
"""

val: tuple[
Number, Number, Number, Number, Number, Number, Number, Number, Number
] = field(
val: tuple[Number, Number, Number, Number, Number, Number, Number, Number, Number] = field(
default_factory=lambda: no_default(field="ThreeDBoundingBoxEuler.val"),
metadata=required,
)
Expand Down Expand Up @@ -231,9 +227,7 @@ class Poly2D(JsonSnakeCaseSerializableMixin):

attributes: Optional[Attributes] = field(default=None)

closed: bool = field(
default_factory=lambda: no_default(field="Poly2D.closed"), metadata=required
)
closed: bool = field(default_factory=lambda: no_default(field="Poly2D.closed"), metadata=required)
"""
A boolean that defines whether the polyline is closed or not.
In case it is closed, it is assumed that the last point of the sequence is connected with the first one.
Expand All @@ -245,13 +239,9 @@ class Poly2D(JsonSnakeCaseSerializableMixin):
hierarchy: Optional[Sequence[int]] = field(default=None)
"""Hierarchy of the 2D polyline in the context of a set of 2D polylines."""

mode: Poly2DMode = field(
default_factory=lambda: no_default(field="Poly2D.mode"), metadata=required
)
mode: Poly2DMode = field(default_factory=lambda: no_default(field="Poly2D.mode"), metadata=required)

name: AttributeName = field(
default_factory=lambda: no_default(field="Poly2D.name"), metadata=required
)
name: AttributeName = field(default_factory=lambda: no_default(field="Poly2D.name"), metadata=required)
"""This is a string encoding the name of this object data. It is used as index inside the corresponding object data pointers."""

val: Union[Sequence[Number], Sequence[str]] = field(
Expand Down Expand Up @@ -281,9 +271,7 @@ class Poly3D(JsonSnakeCaseSerializableMixin):

attributes: Optional[Attributes] = field(default=None)

closed: bool = field(
default_factory=lambda: no_default(field="Poly3D.closed"), metadata=required
)
closed: bool = field(default_factory=lambda: no_default(field="Poly3D.closed"), metadata=required)
"""
A boolean that defines whether the polyline is closed or not.
In case it is closed, it is assumed that the last point of the sequence is connected with the first one.
Expand All @@ -292,14 +280,10 @@ class Poly3D(JsonSnakeCaseSerializableMixin):
coordinate_system: Optional[CoordinateSystemUid] = field(default=None)
"""Name of the coordinate system in respect of which this object data is expressed."""

name: AttributeName = field(
default_factory=lambda: no_default(field="Poly3D.name"), metadata=required
)
name: AttributeName = field(default_factory=lambda: no_default(field="Poly3D.name"), metadata=required)
"""This is a string encoding the name of this object data. It is used as index inside the corresponding object data pointers."""

val: Sequence[Number] = field(
default_factory=lambda: no_default(field="Poly3D.val"), metadata=required
)
val: Sequence[Number] = field(default_factory=lambda: no_default(field="Poly3D.val"), metadata=required)
"""List of numerical values of the polyline."""

def __post_init__(self) -> None:
Expand Down
12 changes: 3 additions & 9 deletions uai_openlabel/elements/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,14 @@ class Action(JsonSnakeCaseSerializableMixin):
They may be defined for several frame intervals, similar to objects, for example, isWalking.
"""

name: str = field(
default_factory=lambda: no_default(field="Action.name"), metadata=required
)
type: str = field(
default_factory=lambda: no_default(field="Action.type"), metadata=required
)
name: str = field(default_factory=lambda: no_default(field="Action.name"), metadata=required)
type: str = field(default_factory=lambda: no_default(field="Action.type"), metadata=required)

frame_intervals: Optional[Sequence[FrameInterval]] = field(default=None)
ontology_uid: Optional[OntologyUid] = field(default=None)
resource_uid: Optional[ResourceUid] = field(default=None)
action_data: Optional[Attributes] = field(default=None)
action_data_pointers: Optional[Mapping[AttributeName, ElementDataPointer]] = field(
default=None
)
action_data_pointers: Optional[Mapping[AttributeName, ElementDataPointer]] = field(default=None)


@dataclass
Expand Down
12 changes: 3 additions & 9 deletions uai_openlabel/elements/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,14 @@ class Context(JsonSnakeCaseSerializableMixin):
- general information about the location, such as Germany or Spain.
"""

name: str = field(
default_factory=lambda: no_default(field="Context.name"), metadata=required
)
type: str = field(
default_factory=lambda: no_default(field="Context.type"), metadata=required
)
name: str = field(default_factory=lambda: no_default(field="Context.name"), metadata=required)
type: str = field(default_factory=lambda: no_default(field="Context.type"), metadata=required)

frame_intervals: Optional[Sequence[FrameInterval]] = field(default=None)
ontology_uid: Optional[OntologyUid] = field(default=None)
resource_uid: Optional[ResourceUid] = field(default=None)
context_data: Optional[Attributes] = field(default=None)
context_data_pointers: Optional[Mapping[AttributeName, ElementDataPointer]] = field(
default=None
)
context_data_pointers: Optional[Mapping[AttributeName, ElementDataPointer]] = field(default=None)


@dataclass
Expand Down
4 changes: 1 addition & 3 deletions uai_openlabel/elements/element_data_pointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ class ElementDataPointer(JsonSnakeCaseSerializableMixin):
)
"""List of frame intervals of the element data pointed by this pointer."""

attribute_pointers: Optional[Mapping[AttributeName, GenericDataType]] = field(
default=None
)
attribute_pointers: Optional[Mapping[AttributeName, GenericDataType]] = field(default=None)
"""
This is a JSON object which contains pointers to the attributes of the element data pointed by this pointer.
The attributes pointer keys shall be the \"name\" of the attribute of the element data this pointer points to.
Expand Down
12 changes: 3 additions & 9 deletions uai_openlabel/elements/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,14 @@ class Event(JsonSnakeCaseSerializableMixin):
Instants in time which have semantic load. events may trigger other events or actions, for example, startsWalking.
"""

name: str = field(
default_factory=lambda: no_default(field="Event.name"), metadata=required
)
type: str = field(
default_factory=lambda: no_default(field="Event.type"), metadata=required
)
name: str = field(default_factory=lambda: no_default(field="Event.name"), metadata=required)
type: str = field(default_factory=lambda: no_default(field="Event.type"), metadata=required)

frame_intervals: Optional[Sequence[FrameInterval]] = field(default=None)
ontology_uid: Optional[OntologyUid] = field(default=None)
resource_uid: Optional[ResourceUid] = field(default=None)
event_data: Optional[Attributes] = field(default=None)
event_data_pointers: Optional[Mapping[AttributeName, ElementDataPointer]] = field(
default=None
)
event_data_pointers: Optional[Mapping[AttributeName, ElementDataPointer]] = field(default=None)


@dataclass
Expand Down
16 changes: 4 additions & 12 deletions uai_openlabel/elements/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ class ObjectData(Attributes):
# area_reference: Optional[Sequence[...]] = field(default=None)
bbox: Optional[Sequence[TwoDBoundingBox]] = field(default=None)
# binary: Optional[Sequence[...]] = field(default=None)
cuboid: Optional[
Sequence[Union[ThreeDBoundingBoxEuler, ThreeDBoundingBoxQuaternion]]
] = field(default=None)
cuboid: Optional[Sequence[Union[ThreeDBoundingBoxEuler, ThreeDBoundingBoxQuaternion]]] = field(default=None)
# image: Optional[Sequence[...]] = field(default=None)
# line_reference: Optional[Sequence[...]] = field(default=None)
# mat: Optional[Sequence[...]] = field(default=None)
Expand Down Expand Up @@ -106,20 +104,14 @@ class Object(JsonSnakeCaseSerializableMixin):
:param object_data_pointers: Pointers to element data at frames.
"""

name: str = field(
default_factory=lambda: no_default(field="Object.name"), metadata=required
)
type: str = field(
default_factory=lambda: no_default(field="Object.type"), metadata=required
)
name: str = field(default_factory=lambda: no_default(field="Object.name"), metadata=required)
type: str = field(default_factory=lambda: no_default(field="Object.type"), metadata=required)

frame_intervals: Optional[Sequence[FrameInterval]] = field(default=None)
ontology_uid: Optional[OntologyUid] = field(default=None)
resource_uid: Optional[ResourceUid] = field(default=None)
object_data: Optional[ObjectData] = field(default=None)
object_data_pointers: Optional[Mapping[AttributeName, ElementDataPointer]] = field(
default=None
)
object_data_pointers: Optional[Mapping[AttributeName, ElementDataPointer]] = field(default=None)

@classmethod
def car_example(
Expand Down
16 changes: 4 additions & 12 deletions uai_openlabel/elements/relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,8 @@ class RdfAgent(JsonSnakeCaseSerializableMixin):
:param uid: The element UID this RDF agent refers to.
"""

type: RdfAgentType = field(
default_factory=lambda: no_default(field="RdfAgent.type"), metadata=required
)
uid: ElementUid = field(
default_factory=lambda: no_default(field="RdfAgent.uid"), metadata=required
)
type: RdfAgentType = field(default_factory=lambda: no_default(field="RdfAgent.type"), metadata=required)
uid: ElementUid = field(default_factory=lambda: no_default(field="RdfAgent.uid"), metadata=required)


@dataclass
Expand All @@ -69,12 +65,8 @@ class Relation(JsonSnakeCaseSerializableMixin):
:param type: The type of a relation defines the class the predicated of the relation corresponds to.
"""

name: str = field(
default_factory=lambda: no_default(field="Relation.name"), metadata=required
)
type: str = field(
default_factory=lambda: no_default(field="Relation.type"), metadata=required
)
name: str = field(default_factory=lambda: no_default(field="Relation.name"), metadata=required)
type: str = field(default_factory=lambda: no_default(field="Relation.type"), metadata=required)
rdf_objects: Sequence[RdfAgent] = field(
default_factory=lambda: no_default(field="Relation.rdf_objects"),
metadata=required,
Expand Down
4 changes: 1 addition & 3 deletions uai_openlabel/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ def example(
frame_properties=FrameProperties(
timestamp=timestamp,
transforms={
f"{src}_to_{dst}": Transform.no_rotation_example(
src=src, dst=dst, translation=transform_translation
)
f"{src}_to_{dst}": Transform.no_rotation_example(src=src, dst=dst, translation=transform_translation)
},
),
objects=frame_objects,
Expand Down
Loading

0 comments on commit 49bc838

Please sign in to comment.