-
Notifications
You must be signed in to change notification settings - Fork 196
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
Annotate Network and check usage of it runtime #513
Annotate Network and check usage of it runtime #513
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #513 +/- ##
==========================================
- Coverage 68.78% 67.82% -0.97%
==========================================
Files 26 26
Lines 3117 3173 +56
Branches 526 551 +25
==========================================
+ Hits 2144 2152 +8
- Misses 835 865 +30
- Partials 138 156 +18
|
I'm not sure if sprinkling the code with a lot of |
Other alternatives is to mute the error with |
self.network = network | ||
self.network: Network = network |
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.
Isn't this deduced implicitly from the parameter type?
self.network = network | ||
self.network: Optional[Network] = network |
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.
Same here, this seems duplicated.
I agree that all these conditionals and RuntimeErrors are a bit distracting and verbose. Adding an assertion seems less intrusive and can be switched off to save runtime costs. Other than that, the most basic question is, why should the |
Superseded by #525. |
With reference to #511 this PR properly annotates all uses of
Network
and adds runtime checks for the usage ofNetwork
instances. In very many classesself.network
isOptional[Network]
with defaultNone
and thus a runtime check is needed for it being set properly.