Remove all usage of python2_3.py#1939
Conversation
Technically these functions were exported at the top level of the library, this removes them without warning... If we want to we can bring them back for there, but I honestly don't think its needed, as we are py3 only now and have been for multiple releases. This may introduce a number of 'useless cast' or similar but those were always happening anyway This PR brought to you by sed
|
Nice! On mobile so only skimmed a small portion of the diff. Saw some cases assigned |
|
literally all I did was |
|
my only comment is regarding the unnecessary casts... besides that, this LGTM. |
pyqtgraph/widgets/ComboBox.py
Outdated
| if self._ignoreIndexChange: | ||
| return | ||
| self._chosenText = asUnicode(self.currentText()) | ||
| self._chosenText = str(self.currentText()) |
There was a problem hiding this comment.
QComboBox::currentText() can remove str casting
pyqtgraph/widgets/ComboBox.py
Outdated
| pass | ||
| if data is None: | ||
| return asUnicode(self.itemText(ind)) | ||
| return str(self.itemText(ind)) |
There was a problem hiding this comment.
QComboBox::itemText(index) returns a string as well, so we can remove the casting here too
pyqtgraph/widgets/TableWidget.py
Outdated
|
|
||
| for c in columns: | ||
| row.append(asUnicode(self.horizontalHeaderItem(c).text())) | ||
| row.append(str(self.horizontalHeaderItem(c).text())) |
There was a problem hiding this comment.
QTableWidgetIem::text returns a string, so we can ditch the casting here as well
tests/widgets/test_spinbox.py
Outdated
|
|
||
| assert sb.value() == value | ||
| assert pg.asUnicode(sb.text()) == expected_text | ||
| assert str(sb.text()) == expected_text |
There was a problem hiding this comment.
QSpinBox::text returns str type as well.
|
Alright, I think I'm done 😬 had to do a lot of doc lookups for the Qt stuff.... so thankful for Dash docs letting me lookup the stuff insta-fast. |
|
@ksunden thanks for the PR, this LGTM, merging! |
| w.value = lambda: asUnicode(w.text()) | ||
| w.setValue = lambda v: w.setText(asUnicode(v)) | ||
| w.value = w.text | ||
| w.setValue = w.setText |
There was a problem hiding this comment.
The new definition of _interpretValue() in 1919 should handle a call to setValue(10), but this would also work with item.widget.setValue(10)
There was a problem hiding this comment.
Eh, the widget should inherently function as a text setter, so I'm fine with leaving it as w.setValue = w.setText.
There was a problem hiding this comment.
Feel free to correct things in #1919 as you see fit, again, sorry for the trouble!
Our PR count is low enough we're getting more aggressive about small changes in lots of the library... this is going to keep happening until we effectively zero out the PR queue :( again, sorry for the headache!
Technically these functions were exported at the top level of the library, this removes them without warning... If we want to we can bring them back for there and add deprecation warnigns, but I honestly don't think its needed, as we are py3 only now and have been for multiple releases.
This may introduce a number of 'useless cast' or similar but those were always happening anyway
This PR brought to you by
sed