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
chore(pipelined): Make mypy green #12950
Conversation
Thanks for opening a PR! 💯
Howto
More infoPlease take a moment to read through the Magma project's
If this is your first Magma PR, also consider reading
|
@@ -137,7 +137,7 @@ def get_hash(s, hash_function) -> bytes: | |||
|
|||
def encode_str(s: str, encoding_type) -> str: | |||
if encoding_type == PipelineD.HEConfig.BASE64: | |||
s = codecs.encode(codecs.decode(s, 'hex'), 'base64').decode() | |||
s = codecs.encode(codecs.decode(s, 'hex'), 'base64').decode() # type: ignore |
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.
This seems to be an issue in mypy, see: python/typeshed#300
49c149f
to
0e1e2ca
Compare
0e1e2ca
to
6f4740e
Compare
@@ -204,6 +204,9 @@ py_library( | |||
py_library( | |||
name = "restart_mixin", | |||
srcs = ["restart_mixin.py"], | |||
deps = [ |
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.
Curious, why was this not needed before? I see that you added the import to restart_mixin
, but the _startup_flow_controller
was there before, right?
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.
The import from magma.pipelined.app.startup_flows import StartupFlows
was newly added
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.
I see that you added the import to
restart_mixin
My question was, why the import was not needed before.
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.
To me it looks like both lines are new?
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.
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.
but the
_startup_flow_controller
was there before
yes, but the object that contains the StartupFlows
was existing before
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.
Yes but it wasn't typed here before so the Python code didn't know what it was in the abstract superclass.
6f4740e
to
36f59e5
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.
lgtm (feel free to ignore the nit if you do not plan to do other changes). sudo tests locally green.
Fix various type issues for pipelined. - Correct a few wrong argument or variable types - Add type stubs for mixins - Ignore some false positives - Raise ValueError instead of NPE - Extract method to handle all types of error in tc_ops_pyroute2 - Add null checks in test code Signed-off-by: Sebastian Thomas <sebastian.thomas@tngtech.com>
36f59e5
to
64290b3
Compare
Fix various type issues for pipelined. - Correct a few wrong argument or variable types - Add type stubs for mixins - Ignore some false positives - Raise ValueError instead of NPE - Extract method to handle all types of error in tc_ops_pyroute2 - Add null checks in test code Signed-off-by: Sebastian Thomas <sebastian.thomas@tngtech.com>
Summary
Fix various type issues for pipelined.
Test Plan
Additional Information