-
Notifications
You must be signed in to change notification settings - Fork 110
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 check ert.gui #8160
Type check ert.gui #8160
Conversation
c58acf6
to
faeebf8
Compare
84ac680
to
3ce383f
Compare
2c764b7
to
44ff307
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8160 +/- ##
==========================================
- Coverage 87.18% 87.11% -0.07%
==========================================
Files 381 381
Lines 23669 23757 +88
Branches 619 630 +11
==========================================
+ Hits 20635 20696 +61
- Misses 2953 2988 +35
+ Partials 81 73 -8 ☔ View full report in Codecov by Sentry. |
def setText(self, a0: Optional[str]) -> None: | ||
self.hidePlaceHolder() | ||
|
||
QLineEdit.setText(self, string) | ||
QLineEdit.setText(self, a0) | ||
|
||
if len(str(string)) == 0 and not self.hasFocus(): | ||
if len(str(a0)) == 0 and not self.hasFocus(): |
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.
Should this have been 'text' instead, since this is not an event?
text : Optional[str]
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 setText function in QLineEdit names the first parameter a0
and sets the type to Optional[str]
, so that is what we have to use.
if (viewport := self.viewport()) is not None: | ||
viewport.setMouseTracking(True) |
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.
Why the walrus operator here? We don't need viewport
later on?
if self.viewport():
self.viewport().setMouseTracking(True)
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.
Because two calls to self.viewport() could first return None
and then something else. We kind of know this is a getter, but mypy
doesn't care.
if self._running_workflow_dialog is not None: | ||
self._running_workflow_dialog.disableCloseButton() |
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.
More compact?
if self._running_workflow_dialog:
self._running_workflow_dialog.disableCloseButton()
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, but I think its best to avoid messing with __bool__
for now.
|
||
def runWorkflow(self) -> None: | ||
assert self._workflow_runner is not None |
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.
Why not assert it simply? Is that not the same?
assert self._workflow_runner
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.
Just in case __bool__
is overriden somewhere, I would prefer to keep it the way it is.
horizontal_header = self.horizontalHeader() | ||
assert horizontal_header is not None | ||
horizontal_header.setSectionResizeMode(QHeaderView.ResizeToContents) |
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.
why save this as a variable?
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.
So that we can assert that it is None. Although self.horizontlHeader()
is intented to be a property, it is called as a function so two subsequent calls could first return the horizontal header and next return None
.
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.
Need slight changes, but great work! 🎉
a6d81f7
to
093c501
Compare
093c501
to
a70084c
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.
Mighty fine sir! 🎩
a70084c
to
e4bcfbb
Compare
When applicable