-
Notifications
You must be signed in to change notification settings - Fork 8
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
Type hint and validate Instance and Solution dictionaries #100
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #100 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 16 18 +2
Lines 261 282 +21
=========================================
+ Hits 261 282 +21
☔ View full report in Codecov by Sentry. |
|
||
for section in sections: | ||
section, data = parse_section(section, instance) | ||
instance[section] = data | ||
instance[section] = data # 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.
TypedDict requires string literals, but since I don't know what kinds of section are parsed I need to ignore this.
I'm not sure if it even makes sense to use a TypedDict if I ignore this line.
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.
It's OK. Even though this line is no longer checked, the returned instance is assumed to be of type Instance
, which used by mypy to do static type checking.
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 if we do this, we also need to validate that the instance indeed follows the types as specified in Instance
.
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.
Maybe we can use pydantic
for this?
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.
Make a new validate
module that validates the instance and solution outputs according to VRPLIB.
Not continuing with this. |
Closes #99.
TODO
validate-typing
)validate
module that validates the instance and solution outputs according to VRPLIB.