jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/673510 )
Change subject: [code] Fix code quality issues
......................................................................
[code] Fix code quality issues
I ran the DeepSource static analyzer on the forked copy of this repo and
found some interesting code quality issues. This PR fixes a few of them.
Changes proposed in this pull request:
- Remove duplicate elements during set declaration
- Remove implicit object from the base class
- Use 'sys.exit()' calls
Patch supplied from PR37
Change-Id: I1f3f05065e65928318cf41f5b109ed83fddbdbbf
---
M pywikibot/families/wikipedia_family.py
M pywikibot/logentries.py
M pywikibot/pagegenerators.py
M pywikibot/xmlreader.py
M scripts/archive/editarticle.py
M scripts/archive/patrol.py
6 files changed, 9 insertions(+), 9 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/families/wikipedia_family.py
b/pywikibot/families/wikipedia_family.py
index 5ef6105..3a84e0d 100644
--- a/pywikibot/families/wikipedia_family.py
+++ b/pywikibot/families/wikipedia_family.py
@@ -144,10 +144,10 @@
# Languages that used to be coded in iso-8859-1
latin1old = {
- 'af', 'bs', 'co', 'cs', 'da',
'de', 'en', 'es', 'es', 'et', 'eu',
'fi',
- 'fr', 'fy', 'ga', 'gl', 'ia',
'id', 'it', 'la', 'lt', 'lv', 'mi',
'mr',
- 'na', 'nds', 'nl', 'no', 'pt',
'simple', 'sl', 'sv', 'sw', 'test',
- 'tt', 'uk', 'vi', 'vo'
+ 'af', 'bs', 'co', 'cs', 'da',
'de', 'en', 'es', 'et', 'eu', 'fi',
'fr',
+ 'fy', 'ga', 'gl', 'ia', 'id',
'it', 'la', 'lt', 'lv', 'mi', 'mr',
'na',
+ 'nds', 'nl', 'no', 'pt', 'simple',
'sl', 'sv', 'sw', 'test', 'tt',
+ 'uk', 'vi', 'vo'
}
# Subpages for documentation.
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py
index db2bf37..e6b922f 100644
--- a/pywikibot/logentries.py
+++ b/pywikibot/logentries.py
@@ -361,7 +361,7 @@
return 'auto' in self._params and self._params['auto'] != 0
-class LogEntryFactory(object):
+class LogEntryFactory:
"""
LogEntry Factory.
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 56ac03a..228e89d 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -2629,7 +2629,7 @@
pywikibot.error('ERROR: generator GoogleSearchPageGenerator '
"depends on package 'google'.\n"
'To install, please run: pip install google.')
- exit(1)
+ sys.exit(1)
pywikibot.warning('Please read
http://www.google.com/accounts/TOS')
yield from google.search(query)
diff --git a/pywikibot/xmlreader.py b/pywikibot/xmlreader.py
index 4d46347..3e9579d 100644
--- a/pywikibot/xmlreader.py
+++ b/pywikibot/xmlreader.py
@@ -44,7 +44,7 @@
return editRestriction, moveRestriction
-class XmlEntry(object):
+class XmlEntry:
"""Represent a page."""
diff --git a/scripts/archive/editarticle.py b/scripts/archive/editarticle.py
index c61eba0..f3a4121 100755
--- a/scripts/archive/editarticle.py
+++ b/scripts/archive/editarticle.py
@@ -40,7 +40,7 @@
from pywikibot.editor import TextEditor
-class ArticleEditor(object):
+class ArticleEditor:
"""Edit a wiki page."""
diff --git a/scripts/archive/patrol.py b/scripts/archive/patrol.py
index 1f3ee74..4843f8d 100755
--- a/scripts/archive/patrol.py
+++ b/scripts/archive/patrol.py
@@ -352,7 +352,7 @@
.format(title(as_link=True)))
-class LinkedPagesRule(object):
+class LinkedPagesRule:
"""Matches of page site title and linked pages
title."""
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/673510
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I1f3f05065e65928318cf41f5b109ed83fddbdbbf
Gerrit-Change-Number: 673510
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged