Skip to content

Commit

Permalink
add noqa tag
Browse files Browse the repository at this point in the history
  • Loading branch information
LucienMorey committed Nov 13, 2024
1 parent 92e4ccd commit 6242712
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 33 deletions.
11 changes: 6 additions & 5 deletions photon-lib/py/photonlibpy/generated/MultiTargetPNPResultSerde.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
from ..targeting import * # noqa

if TYPE_CHECKING:
from ..targeting import MultiTargetPNPResult
from ..targeting import PnpResult
from ..targeting import MultiTargetPNPResult # noqa
from ..targeting import PnpResult # noqa


class MultiTargetPNPResultSerde:
Expand All @@ -36,7 +36,7 @@ class MultiTargetPNPResultSerde:
MESSAGE_FORMAT = "PnpResult:ae4d655c0a3104d88df4f5db144c1e86 estimatedPose;int16 fiducialIDsUsed[?];"

@staticmethod
def pack(value: "MultiTargetPNPResult") -> "Packet":
def pack(value: 'MultiTargetPNPResult' ) -> 'Packet':
ret = Packet()

# estimatedPose is of non-intrinsic type PnpResult
Expand All @@ -46,8 +46,9 @@ def pack(value: "MultiTargetPNPResult") -> "Packet":
ret.encodeShortList(value.fiducialIDsUsed)
return ret


@staticmethod
def unpack(packet: "Packet") -> "MultiTargetPNPResult":
def unpack(packet: 'Packet') -> 'MultiTargetPNPResult':
ret = MultiTargetPNPResult()

# estimatedPose is of non-intrinsic type PnpResult
Expand All @@ -60,4 +61,4 @@ def unpack(packet: "Packet") -> "MultiTargetPNPResult":


# Hack ourselves into the base class
MultiTargetPNPResult.photonStruct = MultiTargetPNPResultSerde()
MultiTargetPNPResult.photonStruct = MultiTargetPNPResultSerde()
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from ..targeting import * # noqa

if TYPE_CHECKING:
from ..targeting import PhotonPipelineMetadata
from ..targeting import PhotonPipelineMetadata # noqa


class PhotonPipelineMetadataSerde:
Expand All @@ -35,7 +35,7 @@ class PhotonPipelineMetadataSerde:
MESSAGE_FORMAT = "int64 sequenceID;int64 captureTimestampMicros;int64 publishTimestampMicros;int64 timeSinceLastPong;"

@staticmethod
def pack(value: "PhotonPipelineMetadata") -> "Packet":
def pack(value: 'PhotonPipelineMetadata' ) -> 'Packet':
ret = Packet()

# sequenceID is of intrinsic type int64
Expand All @@ -51,8 +51,9 @@ def pack(value: "PhotonPipelineMetadata") -> "Packet":
ret.encodeLong(value.timeSinceLastPong)
return ret


@staticmethod
def unpack(packet: "Packet") -> "PhotonPipelineMetadata":
def unpack(packet: 'Packet') -> 'PhotonPipelineMetadata':
ret = PhotonPipelineMetadata()

# sequenceID is of intrinsic type int64
Expand All @@ -71,4 +72,4 @@ def unpack(packet: "Packet") -> "PhotonPipelineMetadata":


# Hack ourselves into the base class
PhotonPipelineMetadata.photonStruct = PhotonPipelineMetadataSerde()
PhotonPipelineMetadata.photonStruct = PhotonPipelineMetadataSerde()
19 changes: 9 additions & 10 deletions photon-lib/py/photonlibpy/generated/PhotonPipelineResultSerde.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
from ..targeting import * # noqa

if TYPE_CHECKING:
from ..targeting import MultiTargetPNPResult
from ..targeting import PhotonPipelineMetadata
from ..targeting import PhotonPipelineResult
from ..targeting import PhotonTrackedTarget
from ..targeting import MultiTargetPNPResult # noqa
from ..targeting import PhotonPipelineMetadata # noqa
from ..targeting import PhotonPipelineResult # noqa
from ..targeting import PhotonTrackedTarget # noqa


class PhotonPipelineResultSerde:
Expand All @@ -38,13 +38,11 @@ class PhotonPipelineResultSerde:
MESSAGE_FORMAT = "PhotonPipelineMetadata:ac0a45f686457856fb30af77699ea356 metadata;PhotonTrackedTarget:cc6dbb5c5c1e0fa808108019b20863f1 targets[?];optional MultiTargetPNPResult:541096947e9f3ca2d3f425ff7b04aa7b multitagResult;"

@staticmethod
def pack(value: "PhotonPipelineResult") -> "Packet":
def pack(value: 'PhotonPipelineResult' ) -> 'Packet':
ret = Packet()

# metadata is of non-intrinsic type PhotonPipelineMetadata
ret.encodeBytes(
PhotonPipelineMetadata.photonStruct.pack(value.metadata).getData()
)
ret.encodeBytes(PhotonPipelineMetadata.photonStruct.pack(value.metadata).getData())

# targets is a custom VLA!
ret.encodeList(value.targets, PhotonTrackedTarget.photonStruct)
Expand All @@ -53,8 +51,9 @@ def pack(value: "PhotonPipelineResult") -> "Packet":
ret.encodeOptional(value.multitagResult, MultiTargetPNPResult.photonStruct)
return ret


@staticmethod
def unpack(packet: "Packet") -> "PhotonPipelineResult":
def unpack(packet: 'Packet') -> 'PhotonPipelineResult':
ret = PhotonPipelineResult()

# metadata is of non-intrinsic type PhotonPipelineMetadata
Expand All @@ -70,4 +69,4 @@ def unpack(packet: "Packet") -> "PhotonPipelineResult":


# Hack ourselves into the base class
PhotonPipelineResult.photonStruct = PhotonPipelineResultSerde()
PhotonPipelineResult.photonStruct = PhotonPipelineResultSerde()
11 changes: 6 additions & 5 deletions photon-lib/py/photonlibpy/generated/PhotonTrackedTargetSerde.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
from ..targeting import * # noqa

if TYPE_CHECKING:
from ..targeting import PhotonTrackedTarget
from ..targeting import TargetCorner
from ..targeting import PhotonTrackedTarget # noqa
from ..targeting import TargetCorner # noqa


class PhotonTrackedTargetSerde:
Expand All @@ -36,7 +36,7 @@ class PhotonTrackedTargetSerde:
MESSAGE_FORMAT = "float64 yaw;float64 pitch;float64 area;float64 skew;int32 fiducialId;int32 objDetectId;float32 objDetectConf;Transform3d bestCameraToTarget;Transform3d altCameraToTarget;float64 poseAmbiguity;TargetCorner:16f6ac0dedc8eaccb951f4895d9e18b6 minAreaRectCorners[?];TargetCorner:16f6ac0dedc8eaccb951f4895d9e18b6 detectedCorners[?];"

@staticmethod
def pack(value: "PhotonTrackedTarget") -> "Packet":
def pack(value: 'PhotonTrackedTarget' ) -> 'Packet':
ret = Packet()

# yaw is of intrinsic type float64
Expand Down Expand Up @@ -74,8 +74,9 @@ def pack(value: "PhotonTrackedTarget") -> "Packet":
ret.encodeList(value.detectedCorners, TargetCorner.photonStruct)
return ret


@staticmethod
def unpack(packet: "Packet") -> "PhotonTrackedTarget":
def unpack(packet: 'Packet') -> 'PhotonTrackedTarget':
ret = PhotonTrackedTarget()

# yaw is of intrinsic type float64
Expand Down Expand Up @@ -116,4 +117,4 @@ def unpack(packet: "Packet") -> "PhotonTrackedTarget":


# Hack ourselves into the base class
PhotonTrackedTarget.photonStruct = PhotonTrackedTargetSerde()
PhotonTrackedTarget.photonStruct = PhotonTrackedTargetSerde()
9 changes: 5 additions & 4 deletions photon-lib/py/photonlibpy/generated/PnpResultSerde.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from ..targeting import * # noqa

if TYPE_CHECKING:
from ..targeting import PnpResult
from ..targeting import PnpResult # noqa


class PnpResultSerde:
Expand All @@ -35,7 +35,7 @@ class PnpResultSerde:
MESSAGE_FORMAT = "Transform3d best;Transform3d alt;float64 bestReprojErr;float64 altReprojErr;float64 ambiguity;"

@staticmethod
def pack(value: "PnpResult") -> "Packet":
def pack(value: 'PnpResult' ) -> 'Packet':
ret = Packet()

ret.encodeTransform(value.best)
Expand All @@ -52,8 +52,9 @@ def pack(value: "PnpResult") -> "Packet":
ret.encodeDouble(value.ambiguity)
return ret


@staticmethod
def unpack(packet: "Packet") -> "PnpResult":
def unpack(packet: 'Packet') -> 'PnpResult':
ret = PnpResult()

ret.best = packet.decodeTransform()
Expand All @@ -73,4 +74,4 @@ def unpack(packet: "Packet") -> "PnpResult":


# Hack ourselves into the base class
PnpResult.photonStruct = PnpResultSerde()
PnpResult.photonStruct = PnpResultSerde()
9 changes: 5 additions & 4 deletions photon-lib/py/photonlibpy/generated/TargetCornerSerde.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from ..targeting import * # noqa

if TYPE_CHECKING:
from ..targeting import TargetCorner
from ..targeting import TargetCorner # noqa


class TargetCornerSerde:
Expand All @@ -35,7 +35,7 @@ class TargetCornerSerde:
MESSAGE_FORMAT = "float64 x;float64 y;"

@staticmethod
def pack(value: "TargetCorner") -> "Packet":
def pack(value: 'TargetCorner' ) -> 'Packet':
ret = Packet()

# x is of intrinsic type float64
Expand All @@ -45,8 +45,9 @@ def pack(value: "TargetCorner") -> "Packet":
ret.encodeDouble(value.y)
return ret


@staticmethod
def unpack(packet: "Packet") -> "TargetCorner":
def unpack(packet: 'Packet') -> 'TargetCorner':
ret = TargetCorner()

# x is of intrinsic type float64
Expand All @@ -59,4 +60,4 @@ def unpack(packet: "Packet") -> "TargetCorner":


# Hack ourselves into the base class
TargetCorner.photonStruct = TargetCornerSerde()
TargetCorner.photonStruct = TargetCornerSerde()
2 changes: 1 addition & 1 deletion photon-serde/templates/ThingSerde.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if TYPE_CHECKING:
{% set _ = ns.types.append(name) -%}
{%- for type in ns.types|sort%}
{%- if not type | is_shimmed and not type | is_intrinsic %}
from ..targeting import {{ type }}
from ..targeting import {{ type }} # noqa
{%- endif %}
{%- endfor%}

Expand Down

0 comments on commit 6242712

Please sign in to comment.