Skip to content
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

HITL: Add typing annotations to AppService #1802

Merged
merged 4 commits into from
Feb 10, 2024
Merged

Conversation

0mdc
Copy link
Contributor

@0mdc 0mdc commented Feb 9, 2024

Motivation and Context

The AppService object acts a dependency injection container for HITL components. Its dependencies are opaque and difficult to track.
This changeset adds type annotations to this object.

How Has This Been Tested

Pre-commit and local run.

Types of changes

  • [Refactoring] Large changes to the code that improve its functionality or performance

Checklist

  • My code follows the code style of this project.
  • I have updated the documentation if required.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes if required.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Feb 9, 2024
from habitat_hitl.environment.controllers.controller_abc import GuiController
from habitat_hitl.environment.episode_helper import EpisodeHelper
from habitat_sim.gfx import DebugLineRender


# Helpers to provide to AppState classes, provided by the underlying SandboxDriver
class AppService:
def __init__(
self,
config,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May want to do this to force the arguments to be always keywords. The docs generator will pick that up and show in the output as well.

Suggested change
config,
*, config,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat trick! Thank you!

Copy link
Contributor

@eundersander eundersander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with Mosra, otherwise LGTM!

@0mdc 0mdc merged commit 963fef0 into main Feb 10, 2024
3 checks passed
@0mdc 0mdc deleted the hitl-add-service-typing branch February 10, 2024 19:29
henrysamer pushed a commit that referenced this pull request Feb 21, 2024
* Add type annotations to app_service.

* Propagate AppService type annotations to the apps.

* Move displaced comment.

* Force keyword argument usage in AppService constructior.
dannymcy pushed a commit to dannymcy/habitat-lab that referenced this pull request Jul 8, 2024
* Add type annotations to app_service.

* Propagate AppService type annotations to the apps.

* Move displaced comment.

* Force keyword argument usage in AppService constructior.
HHYHRHY pushed a commit to SgtVincent/EMOS that referenced this pull request Aug 31, 2024
* Add type annotations to app_service.

* Propagate AppService type annotations to the apps.

* Move displaced comment.

* Force keyword argument usage in AppService constructior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants