mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-30 02:31:40 +00:00
photonlibpy: Fix some type check failures (#1548)
This fixes a variety of type check failures raised by both mypy and pyright. See #1548
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional
|
||||
from typing import TYPE_CHECKING, ClassVar, Optional
|
||||
|
||||
from .multiTargetPNPResult import MultiTargetPNPResult
|
||||
from .photonTrackedTarget import PhotonTrackedTarget
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .. import generated
|
||||
|
||||
|
||||
@dataclass
|
||||
class PhotonPipelineMetadata:
|
||||
@@ -17,7 +20,7 @@ class PhotonPipelineMetadata:
|
||||
|
||||
timeSinceLastPong: int = -1
|
||||
|
||||
photonStruct: "PhotonPipelineMetadataSerde" = None
|
||||
photonStruct: ClassVar["generated.PhotonPipelineMetadataSerde"]
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -57,7 +60,7 @@ class PhotonPipelineResult:
|
||||
def hasTargets(self) -> bool:
|
||||
return len(self.targets) > 0
|
||||
|
||||
def getBestTarget(self) -> PhotonTrackedTarget:
|
||||
def getBestTarget(self) -> Optional[PhotonTrackedTarget]:
|
||||
"""
|
||||
Returns the best target in this pipeline result. If there are no targets, this method will
|
||||
return null. The best target is determined by the target sort mode in the PhotonVision UI.
|
||||
@@ -66,4 +69,4 @@ class PhotonPipelineResult:
|
||||
return None
|
||||
return self.getTargets()[0]
|
||||
|
||||
photonStruct: "PhotonPipelineResultSerde" = None
|
||||
photonStruct: ClassVar["generated.PhotonPipelineResultSerde"]
|
||||
|
||||
Reference in New Issue
Block a user