Skip to content

♻️ Code cleanup and refactoring for using static type hints#1645

Open
krish918 wants to merge 23 commits intoopen-edge-platform:mainfrom
krish918:code-cleanup
Open

♻️ Code cleanup and refactoring for using static type hints#1645
krish918 wants to merge 23 commits intoopen-edge-platform:mainfrom
krish918:code-cleanup

Conversation

@krish918
Copy link
Contributor

@krish918 krish918 commented Feb 4, 2026

Description

  • This PR introduces pre-commit-config file for smart route planner.
  • Adds SPDX license headers in all files.
  • Removed all commented codes for intersection blocking and gamification.
  • Removed some more game_mode footprints and config files.
  • Added static type hints at all relevant places in codes (mostly function signatures, return type, variable declarations etc.).
  • Updates for shell script based on shellcheck validation and linting.
  • Added various cleanup, formatting and linting updates based on PEP8 using pre-commit Ruff hook.
  • Removed Polymorphic design for RouteStatusInterface, which all Route Optimizers implement - as it is hard to decide which class needs to be instantiated statically. This implementation is replaced by a new factory, which still gives the required derived class based on provided optimizer_type, but now it returns a callable based on base abstract class.

Fixes # (issue)
NA

Any Newly Introduced Dependencies

NA

How Has This Been Tested?

Verified by deploying as per documentations and performing manual functional tests.

Checklist:

  • I agree to use the APACHE-2.0 license for my code changes.
  • I have not introduced any 3rd party components incompatible with APACHE-2.0.
  • I have not included any company confidential information, trade secret, password or security token.
  • I have performed a self-review of my code.

- Updated REGISTRY_URL to REGISTRY
- updated Docker dir; changed directory for compose file
- added PROJECT_NAME and updated docker compose commands to use it
- minor cleanups in script.sh

Signed-off-by: Krishna Murti <[email protected]>
- Updated High traffic threshold to be 10 - for consistency across the components
- Removed some comments and fixed typehints

Signed-off-by: Krishna Murti <[email protected]>
- Removed game mode toggling logic, component and related icons on map from UI
- Updated agent state model to remove fields related to blocked_routes and valid/invalid routes
- Commented out more code from agent planner's real-time updates tool - related to gamification and route blocking/coloring
- Updated game_data parameters from RouetService Logic and typehints updates

Signed-off-by: Krishna Murti <[email protected]>
 - for removing game setup, removed blocked_routes property and related impl. from RouteService class

Signed-off-by: Krishna Murti <[email protected]>
- added quotes around variable interpolations in setup script
- Updated docs for new script options like --setup and --stop

Signed-off-by: Krishna Murti <[email protected]>
- updated lock file based on updates done for security alerts
- Updated config to use localhost in host url
- Removed the unused name field

Signed-off-by: Krishna Murti <[email protected]>
- Also removed a method for adding game icons in maps based on game.json in MapCreator

Signed-off-by: Krishna Murti <[email protected]>
…ting, type checking etc.

- pre-commit config targets only the route-planner-agent

Signed-off-by: Krishna Murti <[email protected]>
- separated variable export from vraibale setting when using a comamnd to set a variable
	- so that return value of setting the variable is not masked by export command itself
- Added checks for command execution while executing it, instead of checking value of $? on next line.

Signed-off-by: Krishna Murti <[email protected]>
…y hook

- Linting and formatting changes added to test_logging file

Signed-off-by: Krishna Murti <[email protected]>
- Created new factory for StaticRouteOptimizers which returns a Callable based on given optimizer name
- Minor formatting edits
- Added type hints in function signatures and return types

Signed-off-by: Krishna Murti <[email protected]>
- Updated indentation of pre-commit-config file for content to look less compact

Signed-off-by: Krishna Murti <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants