-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Named and type-hint supporting detection results for the python agents. #7174
Conversation
A comment if license or copyright information should be added and in which form is appreciated :) |
79322d2
to
685b393
Compare
6e7a9de
to
152ce10
Compare
152ce10
to
a57e365
Compare
0fcbd91
to
1b789de
Compare
1b789de
to
b37b764
Compare
b37b764
to
b9e41c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Daraan)
Approved, this does make thing more readable, so nothing against it. No need to add copyright or license information |
Description
When I worked with the agent functions at first I had some trouble understanding the semantics of the return types of the agent's detection functions (obstacle, traffic lights).
e.g
return (False, None, -1)
This PR adds Python <3.6 ( including Python2.7 ) compatible named tuples as return values for these two functions. Adding support for type-hints and improving semantics. Aside from the wrapping of return values into namedtuples this PR changes no functionality of the existing code.
For Python <3.6 it uses
collections.namedtuple
for Python 3.6+ it uses the typed versiontyping.NamedTuple
. Type checkers running on 3.6+ can successfully pick up the typed version even if the non-typed version is used during runtime.I think the agents are itself not Python2.7 compatible, so I think it might be overkill.
If stating that the PR is allowed to only support Python3.6+ it could be made much cleaner.
Where has this been tested?
Possible Drawbacks
Seeing None, despite adding one additional file containing the named tuples. They could be added to the BasicAgent.py themselves. In my opinion it would add unnecessary contents the agent file itself.
This change is