Conversation
- Fixed 170 mypy strict mode errors across 23 source files - Added explicit type annotations for all callback functions - Fixed Optional[str] handling in mqtt_client.py - Added int() casts for AWS IoT packet_id returns - Reorganized CLI into modular package structure - Moved imports to correct modules (MqttConnectionConfig, PeriodicRequestType) - Fixed unreachable code and duplicate definitions - All 35 tests passing - Updated copilot instructions with communication preferences
- Remove unused variable in mqtt_client.py - Fix line length issues (split long lines) - Remove unused import (Protocol) - Format with ruff
…ensitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ensitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…sensitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ensitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…sensitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…sensitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
- Removed import of topic_has_mac which doesn't exist in mqtt_utils - Simplified logging to just use redact_topic everywhere - All mypy and linting checks now pass
…sensitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes all 170 mypy strict mode errors across 23 source files by adding comprehensive type annotations, reorganizing code structure, and eliminating dead code. The changes maintain backward compatibility while significantly improving type safety.
Key changes:
- Added explicit return type annotations (-> None) to callback functions
- Fixed Callable type parameters with complete signatures
- Reorganized CLI into modular package (cli/init.py, cli/main.py, etc.)
- Created new utility modules: mqtt_utils.py, encoding.py, utils.py
- Split monolithic mqtt_client.py into focused components
Reviewed Changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_utils.py | New test file for log_performance decorator utility |
| tests/test_command_queue.py | Updated import path for QueuedCommand after refactoring |
| tests/test_api_helpers.py | Updated imports to use new encoding module |
| test_api_connectivity.py | New API connectivity test script |
| src/nwp500/utils.py | New utility module with log_performance decorator |
| src/nwp500/py.typed | Added PEP 561 marker for type checking support |
| src/nwp500/mqtt_utils.py | Extracted MQTT utilities (redaction, config, types) |
| src/nwp500/mqtt_subscriptions.py | Extracted subscription management logic |
| src/nwp500/mqtt_reconnection.py | Extracted reconnection handler logic |
| src/nwp500/mqtt_periodic.py | Extracted periodic request manager |
| src/nwp500/mqtt_device_control.py | Extracted device control commands |
| src/nwp500/mqtt_connection.py | Extracted connection management |
| src/nwp500/mqtt_command_queue.py | Extracted command queue management |
| src/nwp500/mqtt_client.py | Refactored to delegate to specialized components |
| src/nwp500/models.py | Improved field conversions with metadata approach |
| src/nwp500/events.py | Enhanced type annotations and frozen dataclass |
| src/nwp500/encoding.py | New module for encoding/decoding utilities |
| src/nwp500/constants.py | Converted to IntEnum with backward compatibility |
| src/nwp500/cli/* | Reorganized into modular package structure |
| src/nwp500/init.py | Updated exports for new module structure |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
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
Fixed all 170 mypy strict mode errors across 23 source files
Changes Made
Type Annotations
Code Structure
Bug Fixes
Testing
Files Modified
Verification