Looks like we don't want u'' strings, but '' strings. Do one big search and replace to go to this standard. That will save us from counter productive discussions like https://gerrit.wikimedia.org/r/#/c/354719/1/scripts/newitem.py@98
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
[cleanup] remove remaining unicode literals specifiers | pywikibot/core | master | +23 -41 |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | Xover | T265640 phe-tools: Match&Split bot is not running because of python2 deprecation in pywikibot | |||
Resolved | Xqt | T213287 Drop support of Python 2.7 | |||
Resolved | Xqt | T243770 Pywikibot Python 2 compatibility (tracking) | |||
Resolved | Xqt | T165911 Get the u'' to '' string conversion over with in Pywikibot |
Event Timeline
@Xqt wrote at the mentioned page: "Anyway we shouldn't change old code for it". Why? Us will always cause problem in Python 3000.
One of the problems we have is 300+ open changesets. If we change u'' to '' now, a lot of these sets will need a manual rebase. That's a pain to do. So we should probably do this in small chunks for parts we don't have a lot of conflicting changes.
Then a better piece of advice would be "Remove u only from scripts with no pending changes", wouldn't it? I think a patch only removing us can be revised on express lane.
Not, they don't. The u'' prefix has been allowed since Python 3.3, which was released in 2012. Official support for Python 3.2 was dropped in Feb 2016. There is absolutely no reason to remove them, apart from 'it looks nicer'.
I think it is not necessary to replace all u'' with '' in our code but we should do it when a line will be changed due to out development guidelines [1]; u'' prefix on strings is meaningless due to __future__.unicode_literals. Well py3.0 and py3.1 isn't compatible with u prefix but I guess there are other problems too to get them running and keep py2.7 compatibility.
Anyway I am not against cleaning up this prefix even some changesets must be rebased if they have related changes on such strings. This may have the advantage that maintained patches will get a proper focus.
[1] https://www.mediawiki.org/wiki/Manual:Pywikibot/Development/Guidelines
Not, they don't. The u'' prefix has been allowed since Python 3.3, which was released in 2012.
OK, I didn't know that.
I think we should not do that because it breaks the blame history without any reason. The prefix should removed only when a line will be changed.
+1. I personally don't care about blame history much. Making the code more visually appealing, more newcomer-friendly, and one less thing to argue about during code reviews is more important for me.
Change 590281 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [cleanup] remove remaining unicode literals specifiers
They are only in comments otherwise it would have been detected by flake8-no-u-prefixed-strings. Anyway I made a patch.
Change 590281 merged by jenkins-bot:
[pywikibot/core@master] [cleanup] remove remaining unicode literals specifiers