jenkins-bot merged this change.
[FIX] Fix comparison of str, bytes and int literal with ==/!=
Caught this recently;
* 08:33:23 ./pywikibot/tools/__init__.py:1865: use ==/!= to compare
str, bytes, and int literals
* 08:33:23 ./pywikibot/pagegenerators.py:1203: use ==/!= to compare
str, bytes, and int literals
while reviewing change: I8a3ea71150938a502f91c1d29f5e2ee0dbc7d10d.
This is unrelated to the change but seems like a call for concern?
Failures are caused by the use of the keyword "is" instead of "==" or
"!=".
Change-Id: I8883786e5e5b148a73cfa436436b7384f5fa4bcf
---
M pywikibot/pagegenerators.py
M pywikibot/tools/__init__.py
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 9555c39..227cc41 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -1200,7 +1200,7 @@
def _int_none(v):
"""Return None if v is None or '' else return int(v)."""
- return v if (v is None or v is '') else int(v)
+ return v if (v is None or v == '') else int(v)
@deprecated('Site.allpages()', since='20180512')
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 6888440..7aa8a31 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -1862,7 +1862,7 @@
target_module = target.__module__
if target_module and target_module[-1] != '.':
target_module += '.'
- if source_module is '.':
+ if source_module == '.':
source_module = target_module
elif source_module and source_module[-1] != '.':
source_module += '.'
To view, visit change 486729. To unsubscribe, or for help writing mail filters, visit settings.