-
Notifications
You must be signed in to change notification settings - Fork 40
Fix type checker errors (0 errors) #880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add pandas-stubs for better DataFrame type inference. Fix type errors in core data files: - point_data.py: Numba type ignores, scipy butter signature - point_data_bundle.py: Use field(init=False) for computed fields, @cached_property for caching, explicit type annotations - persistence.py: Fix _list_to_array dtype signature, explicit None checks - legacy_stereocal_paired_pose_network.py: Document normalized coordinate pattern for stereoCalibrate Key patterns established: - field(init=False) for computed dataclass fields - @cached_property over manual object.__setattr__ caching - Explicit None checks for type narrowing - Well-documented type ignores for valid edge cases - .to_numpy() over .values for better inference Refs #879
- motion_trial: Add runtime arg inspection for tracker instantiation, fix dict type syntax, use getattr for optional wireframe - reprojection: Add None guards for intrinsics, use np.zeros(5) for zero distortion instead of None - intrinsic_calibrator: Guard against None frame_packet.points - charuco: Use cv2.bitwise_not(), np.asarray() for MatLike conversion, fix getChessboardCorners typo - capture_volume: Fix optional type annotations, add extrinsic guards - quality_controller: Use .to_numpy(), handle empty arrays, add charuco guard Refs #879
- Fix type annotation syntax in tracker.py (list[T], dict[K, V]) - Add return type to metarig_mapped property for override compatibility - Use NDArray[Any] in PointPacket for flexible dtype support - Add default args to get_points() across all trackers - Add type ignores for incomplete mediapipe stubs - Use cv2.bitwise_not() instead of ~ operator - Add explicit None guards for tuple unpacking Refs #879
- controller.py: Add assert guards for capture_volume access in methods - export.py: Assert isinstance for pandas get_loc return type - set_origin_functions.py: Use np.asarray() for OpenCV MatLike, rewrite mean_vec - pose_network_builder.py: Cast numpy floats to Python floats - paired_pose_network.py: Assert best_cameras_config not None - synchronizer.py: Add early return guard for dropped frames
- recorded_stream.py: Add | None to optional params, assert for milestones - video_recorder.py: Type ignore for cv2.VideoWriter_fourcc stubs - packets.py: Change frame type to NDArray[Any] | None for flexibility - sync_packet_triangulator.py: Add | None to optional camera_array param - triangulation.py: Add | None to optional camera param
- post_processor.py: Type ignores for tracker_enum.value() calls - blender_tools.py: Type annotation for pandas Series from np.sqrt - intrinsic_stream_manager.py: Assert isinstance for CharucoTracker - synchronized_stream_manager.py: Fix tracker.name access in conditional
- capture_volume_visualizer.py: Assert capture_volume exists, early return guards - capture_volume_widget.py: Assert capture_volume after load - camera_mesh.py: Assertions for matrix/rotation/translation, type ignore for QFont - playback_triangulation_widget.py: Fix Path | None syntax, motion_trial guards - post_processing_widget.py: Assertions for active_folder - extrinsic_playback_widget.py: None guards for sync_packet and frame_packet - log_widget.py: Fix message: str | None = None syntax - intrinsic_calibration_dev_view.py: None check for frame - frame_dictionary_emitter.py: Fix dict type annotation - playback_frame_emitter.py: Conditional for tracker.get_connected_points() - geometry_builders.py: Add matrix to guard, fix return type to dict[str, Any] - playback_view_model.py: Use .to_numpy(), np.asarray() for isin
- test_calibration_equivalence.py: Assert translations not None before subtraction - test_intrinsic_calibrator.py: Assert error not None, fix __main__ with TemporaryDirectory - test_motion_trial.py: Assert tracker not None - test_paired_pose_network.py: Fix possibly unbound variable in error handling - test_persistence_roundtrip.py: Add loaded_cam assertions before array comparisons - test_point_data.py: Type ignore for pandera.errors stub limitation - test_point_data_bundle.py: Use .to_numpy() instead of .values, type ignores for .iloc - test_pose_network_builder.py: Assert rotation/translation not None
- __init__.py: Type ignores for PySide6 monkey-patching (pyqtgraph compat)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #879 by fixing all basedpyright type checker errors.
Results: 363 errors → 0 errors across 6 phases
.to_numpy()for pandasFix patterns used
assert x is not Nonefor precondition violations (bugs)if x is None: returnfor valid runtime states.to_numpy()instead of.valuesfor better pandas type inference# type: ignore[code]with comments for library stub limitationsisinstance()assertions for runtime type narrowingTest plan
uv run basedpyright- 0 errorsxvfb-run uv run pytest -n auto- 100 tests passedCloses #879