-
Notifications
You must be signed in to change notification settings - Fork 158
Improve type checking #679
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
Conversation
|
The test indeed failed, and the run time is indeed around 1 or 2 seconds: |
|
If the test is failing, could you set this PR to draft until you have a working version? Edit: I'm not sure how possible it would be to introduce a test that would fail on merge... It looks like whatever's causing the type errors to happen need to be fixed alongside this PR |
|
@methylDragon : Sorry about that, I should have made it draft. I just wanted to address @clalancette 's concerns quickly. I will convert to draft, and try to fix the type issues, please hold on 🙏 |
- Declare the type of a dictionary - Add missing return - Annoyingly the return type of get_entity is a union of all possible types. Ideally, get_entity would return the same type as what's passed in by allowed_data_types (and possibly string) but that would require some advanced type wrangling to achieve template-like functionality. For now, use casts where necessary.
- Touchup process_targeted_events and shutdown_process to accept a ExecuteLocal instead of ExecuteProcess - Still an issue surrounding OnExit - Many minor fixes
Just change the input type
Mostly casts around get attribute
|
@methylDragon : First of all sorry for the long delay. I got really busy in work stuff, then went on holidays. I'm resuming work on this, and one sticky method has been the
Thank you! |
The overloads allow us to properly distinguish between: - Data type passed or not passed (returns str) - Optional set to true or false (returns Optional[T] or T) Also remove the now redundant casts.
1110881 to
9f070d4
Compare
- Event handlers - Boolean substitutions
|
Another few questions:
|
|
@adityapande-1995 @methylDragon @wjwwood @clalancette : any comments / remarks on the above points? |
|
@adityapande-1995 @methylDragon @wjwwood @clalancette : Sorry to bother everyone, but could someone take a quick look at the above remarks? Then I can resume work on this PR |
|
Hey @haudren-woven , sorry for dropping this, and thanks again for all the hard work! Unfortunately, I don't think I have the necessary context/experience with the launch frontend to give definitive answers for this, but I can give it a shot... (though I think @wjwwood would have more of the necessary context) Data Type
I think in this case, let's expand the list of allowable types to what's actually being used in source. Consider the usage of data_type for get_attrs for the If either So in this case I think it would be reasonable to allow for can_be_str
Consider the other available docstrings for
I think in no cases do we want to convert a single list entity into a string in its entirety. So I think we want The reason for this is to think about how the Entities are expected to be used (parsed entities to be manipulated programatically). If we convert a list entity into a string, then it'd require a re-parse, which I don't think is what the intended use is. I might be wrong about this though. Also: Ideally we'd end up documenting the optional
I think this is correct. I will respond to the later post soon. |
OnProcessExit
That... sounds like a subtle type bug. I'm not sure what way to best resolve it. Coroutines
Again, I'm not sure I have all the context, but I'd be in favor of fixing the docs/annotations to match how each function is currently being used (especially if it's a widespread pattern.) some_actions_type
I would be in favor of a rename (and a file move as well.) |
|
Thank you very much for the thoughtful answers! I will proceed with these, but it might take a little while... Please hold on 🙏 |
Heyyy no worries about this! Take your time! |
Do not change public API just yet
- Fixup some quotes and line lengths - Many orders needed to be reordered
|
@methylDragon 32fa4cc should have fixed the CI errors :) |
:O No it's there as a rosdep, maybe you have to update your rosdep |
|
I meant it doesn't seem to be a key inside the |
OH! I think you're meant to call |
|
Just three more lint errors! |
|
Oh no... I'm sorry I really need to learn how to run the linters locally... |
1 similar comment
|
Oh no... I'm sorry I really need to learn how to run the linters locally... |
|
Should be better now :) |
|
Seems to have failed due to random connection dropping...
|
|
I'm not sure why mypy is finding errors on windows: https://ci.ros2.org/job/ci_windows/18774/testReport/junit/launch.test/test_mypy/test_mypy/ |
|
I see what's going on: This means that these statements are protected by a guard that mypy does not recognize... |
This check is recognized by mypy properly!
|
@methylDragon : Seems to have passed on my machine using I also noticed that |
|
Hum two test failures on Windows, but they don't seem super related 🤔 I'll have a closer look but are any flaky tests known? |
|
Okay, I'm just gonna say that they're unrelated flaky tests that are failing, since its a different set of test failures now 😬 Merging!! Thanks for the incredible work! 🚀 |
|
@Mergifyio backport humble |
✅ Backports have been created
|
(cherry picked from commit 06dc66b) # Conflicts: # launch/launch/logging/__init__.py # launch/launch/substitutions/launch_log_dir.py # launch/launch/substitutions/python_expression.py # launch/launch/substitutions/this_launch_file.py # launch/launch/substitutions/this_launch_file_dir.py
This is still a work in progress, but following @clalancette 's comments on #676 , I made this PR to:
Note that we will probably need to tweak the mypy configuration a little bit, since currently non-typed imports are treated as errors.