jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1101188?usp=email )
Change subject: IMPR: fix spelling mistakes
......................................................................
IMPR: fix spelling mistakes
Change-Id: Iefa12241c0703dea910d6cb3baa5bc3771807564
---
M scripts/checkimages.py
M scripts/transwikiimport.py
M tests/data/xml/article-pear.xml
3 files changed, 4 insertions(+), 4 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index ca695d8..7e8e5b2 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -353,7 +353,7 @@
}
# A page where there's a list of template to consider as licenses.
-PAGE_WITH_ALOWED_TEMPLATES = {
+PAGE_WITH_ALLOWED_TEMPLATES = {
'commons': 'User:Filbot/Allowed templates',
'de': 'Benutzer:Xqbot/Lizenzvorlagen',
'it': 'Progetto:Coordinamento/Immagini/Bot/AllowedTemplates',
@@ -514,7 +514,7 @@
self.page_hidden = i18n.translate(self.site,
PAGE_WITH_HIDDEN_TEMPLATES)
self.page_allowed = i18n.translate(self.site,
- PAGE_WITH_ALOWED_TEMPLATES)
+ PAGE_WITH_ALLOWED_TEMPLATES)
self.comment = i18n.twtranslate(self.site.lang,
'checkimages-source-tag-comment')
# Adding the bot's nickname at the notification text if needed.
diff --git a/scripts/transwikiimport.py b/scripts/transwikiimport.py
index 67bcfb5..53bfc67 100755
--- a/scripts/transwikiimport.py
+++ b/scripts/transwikiimport.py
@@ -115,7 +115,7 @@
This option is quite *dangerous*. If the title of an existing page on
home wiki clashes with the title of one of the linked pages it would be
-*overritten*. The histories would be merged. (If the imported version is
+*overwritten*. The histories would be merged. (If the imported version is
newer.) Even if ``-overwrite`` is not set the linked page *can be
overwritten*.
diff --git a/tests/data/xml/article-pear.xml b/tests/data/xml/article-pear.xml
index 0ab16a6..69fce65 100644
--- a/tests/data/xml/article-pear.xml
+++ b/tests/data/xml/article-pear.xml
@@ -83,7 +83,7 @@
Pears are consumed fresh, canned, and as juice. Fermented pear juice is called [[perry]].
-[[Fruit tree propogation]]</text>
+[[Fruit tree propagation]]</text>
</revision>
<revision>
<id>188924</id>
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1101188?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Iefa12241c0703dea910d6cb3baa5bc3771807564
Gerrit-Change-Number: 1101188
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1101186?usp=email )
Change subject: doc: Fix spelling mistakes
......................................................................
doc: Fix spelling mistakes
Change-Id: I8ced196e189c827e47eec6d4678d661cd746e241
---
M HISTORY.rst
M docs/conf.py
M docs/scripts/archive.rst
M docs/scripts/outdated.rst
M pywikibot/data/sparql.py
M pywikibot/family.py
M pywikibot/page/_filepage.py
M pywikibot/page/_toolforge.py
M pywikibot/pagegenerators/_generators.py
M pywikibot/scripts/generate_family_file.py
M pywikibot/site/_upload.py
M pywikibot/tools/_deprecate.py
M scripts/CHANGELOG.rst
M scripts/category_graph.py
M scripts/checkimages.py
M scripts/maintenance/unidata.py
M scripts/transwikiimport.py
M tests/dry_api_tests.py
M tests/pagegenerators_tests.py
M tests/proofreadpage_tests.py
M tests/redirect_bot_tests.py
M tests/site_login_logout_tests.py
22 files changed, 63 insertions(+), 59 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index 2e6ba4e..4d067ad 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -722,7 +722,7 @@
* Retry for internal_api_error_DBQueryTimeoutError errors due to :phab:`T297708`
* Handle ParserError within xmlreader.XmlDump.parse() instead of raising an exception (:phab:`T306134`)
* XMLDumpOldPageGenerator is deprecated in favour of a `content` parameter (:phab:`T306134`)
-* `use_disambig` BaseBot attribute was added to hande disambig skipping
+* `use_disambig` BaseBot attribute was added to handle disambig skipping
* Deprecate RedirectPageBot and NoRedirectPageBot in favour of `use_redirects` attribute
* tools.formatter.color_format is deprecated and will be removed
* A new and easier color format was implemented; colors can be used like:
@@ -1020,7 +1020,7 @@
**Improvements and Bugfixes**
* Use different logfiles for multiple processes of the same script (:phab:`T56685`)
-* throttle.pip will be reused as soon as possbile
+* throttle.pip will be reused as soon as possibile
* terminal_interface_base.TerminalHandler is subclassed from logging.StreamHandler
* Fix iterating of SizedKeyCollection (:phab:`T282865`)
* An abstract base user interface module was added
diff --git a/docs/conf.py b/docs/conf.py
index da75c99..f1af6c8 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -480,7 +480,7 @@
napoleon_use_admonition_for_examples = True
napoleon_use_admonition_for_notes = True
napoleon_use_admonition_for_references = True
-napoleon_custom_sections = ['Advice', 'Advices', 'Hints', 'Rights', 'Tips']
+napoleon_custom_sections = ['Advice', 'Hints', 'Rights']
python_use_unqualified_type_names = True
modindex_common_prefix = ['pywikibot.scripts.']
diff --git a/docs/scripts/archive.rst b/docs/scripts/archive.rst
index 43cd347..867a081 100644
--- a/docs/scripts/archive.rst
+++ b/docs/scripts/archive.rst
@@ -2,7 +2,7 @@
Outdated core scripts
*********************
-This list contains outdated scripts from :term:`core` banch which
+This list contains outdated scripts from :term:`core` branch which
aren't supported any longer. They are deleted from repository.
.. hint::
diff --git a/docs/scripts/outdated.rst b/docs/scripts/outdated.rst
index 5e907af..4a8d2b8 100644
--- a/docs/scripts/outdated.rst
+++ b/docs/scripts/outdated.rst
@@ -2,7 +2,7 @@
Outdated compat scripts
***********************
-This list contains outdated scripts from :term:`compat` banch which
+This list contains outdated scripts from :term:`compat` branch which
haven't ported to the :term:`core` branch of Pywikibot.
Feel free to reactivate any script at any time by creating a Phabricator
diff --git a/pywikibot/data/sparql.py b/pywikibot/data/sparql.py
index 622c012..8086052 100644
--- a/pywikibot/data/sparql.py
+++ b/pywikibot/data/sparql.py
@@ -165,7 +165,7 @@
return self.last_response.json()
except JSONDecodeError:
# There is no proper error given but server returns HTML page
- # in case login isn't valid sotry to guess what the problem is
+ # in case login isn't valid so try to guess what the problem is
# and notify user instead of silently ignoring it.
# This could be made more reliable by fixing the backend.
# Note: only raise error when response starts with HTML,
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 2d62f44..094a4ea 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -1098,7 +1098,7 @@
"""A base class for a Wikimedia Wikibase Family.
- This class holds defauls for :meth:`calendarmodel`,
+ This class holds defaults for :meth:`calendarmodel`,
:meth:`default_globe` and :meth:`globes` to prevent code duplication.
.. warning:: Possibly you have to adjust the repository site in
diff --git a/pywikibot/page/_filepage.py b/pywikibot/page/_filepage.py
index 60d693e..bb4b054 100644
--- a/pywikibot/page/_filepage.py
+++ b/pywikibot/page/_filepage.py
@@ -292,18 +292,21 @@
:param source: Path or URL to the file to be uploaded.
:keyword comment: Edit summary; if this is not provided, then
- filepage.text will be used. An empty summary is not permitted.
- This may also serve as the initial page text (see below).
+ filepage.text will be used. An empty summary is not
+ permitted. This may also serve as the initial page text (see
+ below).
:keyword text: Initial page text; if this is not set, then
filepage.text will be used, or comment.
- :keyword watch: If true, add filepage to the bot user's watchlist
+ :keyword watch: If true, add filepage to the bot user's
+ watchlist
:keyword ignore_warnings: It may be a static boolean, a callable
- returning a boolean or an iterable. The callable gets a list of
- UploadError instances and the iterable should contain the warning
- codes for which an equivalent callable would return True if all
- UploadError codes are in thet list. If the result is False it'll
- not continue uploading the file and otherwise disable any warning
- and reattempt to upload the file.
+ returning a boolean or an iterable. The callable gets a list
+ of UploadError instances and the iterable should contain the
+ warning codes for which an equivalent callable would return
+ True if all UploadError codes are in that list. If the
+ result is False it'll not continue uploading the file and
+ otherwise disable any warning and reattempt to upload the
+ file.
.. note:: NOTE: If report_success is True or None it'll
raise an UploadError exception if the static boolean is
@@ -314,11 +317,12 @@
only upload in chunks, if the chunk size is positive but
lower than the file size.
:type chunk_size: int
- :keyword report_success: If the upload was successful it'll print a
- success message and if ignore_warnings is set to False it'll
- raise an UploadError if a warning occurred. If it's
- None (default) it'll be True if ignore_warnings is a bool and False
- otherwise. If it's True or None ignore_warnings must be a bool.
+ :keyword report_success: If the upload was successful it'll
+ print a success message and if ignore_warnings is set to
+ False it'll raise an UploadError if a warning occurred. If
+ it's None (default) it'll be True if ignore_warnings is a
+ bool and False otherwise. If it's True or None
+ ignore_warnings must be a bool.
:return: It returns True if the upload was successful and False
otherwise.
"""
diff --git a/pywikibot/page/_toolforge.py b/pywikibot/page/_toolforge.py
index 19a2782..3f2bbf9 100644
--- a/pywikibot/page/_toolforge.py
+++ b/pywikibot/page/_toolforge.py
@@ -214,7 +214,7 @@
chars = int(row[3].replace(',', '_'))
percent = float(row[4].rstrip('%'))
- # take into account tht data() is ordered
+ # take into account that data() is ordered
if n and rank > n or chars < min_chars or percent < min_pct:
break
diff --git a/pywikibot/pagegenerators/_generators.py b/pywikibot/pagegenerators/_generators.py
index cfd5c09..42a54c6 100644
--- a/pywikibot/pagegenerators/_generators.py
+++ b/pywikibot/pagegenerators/_generators.py
@@ -796,14 +796,14 @@
) -> Iterable[pywikibot.page.Page]:
"""Yield all pages that link to a certain URL.
- :param url: The URL to search for (with ot without the protocol prefix);
- this may include a '*' as a wildcard, only at the start of the
- hostname
+ :param url: The URL to search for (with or without the protocol
+ prefix); this may include a '*' as a wildcard, only at the start
+ of the hostname
:param namespaces: list of namespace numbers to fetch contribs from
:param total: Maximum number of pages to retrieve in total
:param site: Site for generator results
- :param protocol: Protocol to search for, likely http or https, http by
- default. Full list shown on Special:LinkSearch wikipage
+ :param protocol: Protocol to search for, likely http or https, http
+ by default. Full list shown on Special:LinkSearch wikipage.
"""
if site is None:
site = pywikibot.Site()
diff --git a/pywikibot/scripts/generate_family_file.py b/pywikibot/scripts/generate_family_file.py
index c2b2e00..8b03eff 100755
--- a/pywikibot/scripts/generate_family_file.py
+++ b/pywikibot/scripts/generate_family_file.py
@@ -73,9 +73,9 @@
only includes site of the same domain (usually for Wikimedia
sites), `N` or `n` for no and `E` or `e` if you want to edit
the collection of sites.
- :param verify: If a certificate verification failes, you may
- pass `Y` or `y` to disable certificate validaton `N` or `n`
- to keep it enabled.
+ :param verify: If a certificate verification fails, you may pass
+ `Y` or `y` to disable certificate validaton `N` or `n` to
+ keep it enabled.
"""
from pywikibot.scripts import _import_with_no_user_config
diff --git a/pywikibot/site/_upload.py b/pywikibot/site/_upload.py
index 0386764..2477d3f 100644
--- a/pywikibot/site/_upload.py
+++ b/pywikibot/site/_upload.py
@@ -46,7 +46,7 @@
returning a boolean or an iterable. The callable gets a list of
UploadError instances and the iterable should contain the warning
codes for which an equivalent callable would return True if all
- UploadError codes are in thet list. If the result is False it'll
+ UploadError codes are in that list. If the result is False it'll
not continue uploading the file and otherwise disable any warning
and reattempt to upload the file.
diff --git a/pywikibot/tools/_deprecate.py b/pywikibot/tools/_deprecate.py
index 7f7c4c0..8a05ae5 100644
--- a/pywikibot/tools/_deprecate.py
+++ b/pywikibot/tools/_deprecate.py
@@ -445,7 +445,7 @@
def deprecate_positionals(since: str = ''):
"""Decorator for methods that issues warnings for positional arguments.
- This decorator allowes positional arguments after keyword-only
+ This decorator allows positional arguments after keyword-only
argument syntax (:pep:`3102`) but throws a FutureWarning. The
decorator makes the needed argument updates before passing them to
the called function or method. This decorator may be used for a
@@ -476,7 +476,7 @@
def decorator(func):
"""Outer wrapper. Inspect the parameters of *func*.
- :param func: function or method beeing wrapped.
+ :param func: function or method being wrapped.
"""
@wraps(func)
diff --git a/scripts/CHANGELOG.rst b/scripts/CHANGELOG.rst
index df653b3..4254ddb 100644
--- a/scripts/CHANGELOG.rst
+++ b/scripts/CHANGELOG.rst
@@ -63,7 +63,7 @@
* Use :pylib:`difflib.get_close_matches()<difflib#difflib.get_close_matches>`
to find the closest image match
* Add ``-category`` option to work from given category and look for the
- lastest file deletion first(:phab:`T372206`)
+ latest file deletion first (:phab:`T372206`)
* Check whether image exists first (:phab:`T372106`)
unlink
@@ -1329,7 +1329,7 @@
general
^^^^^^^
-* Add missing commas in string contants
+* Add missing commas in string constants
4.1.0
-----
diff --git a/scripts/category_graph.py b/scripts/category_graph.py
index 77c6b01..b30655b 100755
--- a/scripts/category_graph.py
+++ b/scripts/category_graph.py
@@ -170,7 +170,7 @@
self.dot.add_edge(e)
# repeat recursively
self.scan_level(subcat, level - 1, h)
- # track graph's structure to reduse too big graph
+ # track graph's structure to reduce too big graph
self.rev[e.get_destination()].append(e.get_source())
self.fw[e.get_source()].append(e.get_destination())
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index ca695d8..855f0c0 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -1083,14 +1083,14 @@
for number, m in enumerate(SETTINGS_REGEX.finditer(page_text),
start=1):
name = str(m[1])
- find_tipe = str(m[2])
+ find_type = str(m[2])
find = str(m[3])
imagechanges = str(m[4])
summary = str(m[5])
head = str(m[6])
text = str(m[7])
mexcatched = str(m[8])
- settings = [number, name, find_tipe, find, imagechanges, summary,
+ settings = [number, name, find_type, find, imagechanges, summary,
head, text, mexcatched]
self.settings_data.append(settings)
@@ -1371,7 +1371,7 @@
# In every tuple there's a setting configuration
for tupla in self.settings_data:
name = tupla[1]
- find_tipe = tupla[2]
+ find_type = tupla[2]
find = tupla[3]
find_list = self.load(find)
imagechanges = tupla[4]
@@ -1390,7 +1390,7 @@
text = tupla[7] % self.image_name
mex_catched = tupla[8]
for k in find_list:
- if find_tipe.lower() == 'findonly':
+ if find_type.lower() == 'findonly':
search_results = re.findall(fr'{k.lower()}',
self.image_check_text.lower())
if search_results \
@@ -1403,7 +1403,7 @@
self.summary_used = summary
self.mex_used = mex_catched
break
- elif find_tipe.lower() == 'find' \
+ elif find_type.lower() == 'find' \
and re.findall(fr'{k.lower()}',
self.image_check_text.lower()):
self.some_problem = True
diff --git a/scripts/maintenance/unidata.py b/scripts/maintenance/unidata.py
index 1c77aec..f7b5b92 100755
--- a/scripts/maintenance/unidata.py
+++ b/scripts/maintenance/unidata.py
@@ -70,8 +70,8 @@
data={'text': wikilinks},
timeout=10,
).json()
- pased_text = j['parse']['text']['*']
- titles = findall(r'title="[^:]*:(.)', pased_text)
+ parsed_text = j['parse']['text']['*']
+ titles = findall(r'title="[^:]*:(.)', parsed_text)
site_excepts = {}
for i, original_char in enumerate(chars):
title_char = titles[i]
diff --git a/scripts/transwikiimport.py b/scripts/transwikiimport.py
index 67bcfb5..6aeb52e 100755
--- a/scripts/transwikiimport.py
+++ b/scripts/transwikiimport.py
@@ -60,8 +60,8 @@
-target -fullhistory -assignknownusers
-Advices
--------
+Advice
+------
The module gives access to all parameters of the API (and special page)
and is compatible to the :mod:`scripts.transferbot` script.
diff --git a/tests/dry_api_tests.py b/tests/dry_api_tests.py
index 7674625..f7a512b 100755
--- a/tests/dry_api_tests.py
+++ b/tests/dry_api_tests.py
@@ -52,12 +52,12 @@
def setUp(self):
"""Initialize the fake requests."""
super().setUp()
- self.parms = {'action': 'query',
- 'meta': 'userinfo'}
+ self.params = {'action': 'query',
+ 'meta': 'userinfo'}
self.req = CachedRequest(expiry=1, site=self.basesite,
- parameters=self.parms)
+ parameters=self.params)
self.expreq = CachedRequest(expiry=0, site=self.basesite,
- parameters=self.parms)
+ parameters=self.params)
self.diffreq = CachedRequest(
expiry=1, site=self.basesite,
parameters={'action': 'query', 'meta': 'siteinfo'})
@@ -69,14 +69,14 @@
self.deprecated_explicit = CachedRequest(
expiry=1, site=self.basesite, action='query', meta='userinfo')
self.deprecated_asterisks = CachedRequest(
- expiry=1, site=self.basesite, **self.parms)
+ expiry=1, site=self.basesite, **self.params)
def test_expiry_formats(self):
"""Test using a timedelta as expiry."""
self.assertEqual(self.req.expiry,
CachedRequest(datetime.timedelta(days=1),
site=self.basesite,
- parameters=self.parms).expiry)
+ parameters=self.params).expiry)
def test_expired(self):
"""Test if the request is expired."""
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index 374f844..d72c392 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -911,7 +911,7 @@
gf = pagegenerators.GeneratorFactory()
gf.handle_arg('-intersect')
- # check wether the generator works for both directions
+ # check whether the generator works for both directions
patterns = ['Python 3.7-dev', 'Pywikibot 7.0.dev']
for index in range(2):
with self.subTest(index=index):
@@ -919,7 +919,7 @@
gen = gf.getCombinedGenerator(gen=patterns[index - 1])
self.assertEqual(''.join(gen), 'Pyot 7.dev')
- # check wether the generator works for a very long text
+ # check whether the generator works for a very long text
patterns.append('PWB 7+ unittest developed with a very long text.')
with self.subTest(patterns=patterns):
gf.gens = patterns
diff --git a/tests/proofreadpage_tests.py b/tests/proofreadpage_tests.py
index 063b289..ab7f065 100755
--- a/tests/proofreadpage_tests.py
+++ b/tests/proofreadpage_tests.py
@@ -435,7 +435,7 @@
class BS4TestCase(TestCase):
- """Run tests which needs bs4 beeing installed."""
+ """Run tests which needs bs4 being installed."""
@classmethod
@require_modules('bs4')
diff --git a/tests/redirect_bot_tests.py b/tests/redirect_bot_tests.py
index 368aba5..9faa27a 100755
--- a/tests/redirect_bot_tests.py
+++ b/tests/redirect_bot_tests.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Tests for the redirect.py script."""
#
-# (C) Pywikibot team, 2017-2022
+# (C) Pywikibot team, 2017-2024
#
# Distributed under the terms of the MIT license.
#
@@ -59,7 +59,7 @@
w.assert_called_with('No speedy deletion template available.')
def test_with_delete_and_non_existing_sdtemplate(self):
- """Test with delete and non-exisitng sdtemplate."""
+ """Test with delete and non-existing sdtemplate."""
options = {'delete': True, 'sdtemplate': 'txt {{n|a}} txt'}
bot = RedirectTestRobot('broken', **options)
with patch.object(Page, 'exists', new=Mock(return_value=False)), \
diff --git a/tests/site_login_logout_tests.py b/tests/site_login_logout_tests.py
index beb1770..e08f392 100755
--- a/tests/site_login_logout_tests.py
+++ b/tests/site_login_logout_tests.py
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
"""Test for login and logout methods.
-These tests are separated from others because they should not be runned
-in paralled CI test tasks. Any logout could lead other parallel tests
-to fail.
+These tests are separated from others because they should not be run in
+paralled CI test tasks. Any logout could lead other parallel tests to
+fail.
"""
#
# (C) Pywikibot team, 2022-2024
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1101186?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I8ced196e189c827e47eec6d4678d661cd746e241
Gerrit-Change-Number: 1101186
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1101155?usp=email )
Change subject: IMPR: *precision* value 'millenia' is deprecated due to spelling mistake
......................................................................
IMPR: *precision* value 'millenia' is deprecated due to spelling mistake
'millennium' must be used instead (singular like for century, year etc.)
Change-Id: Ia1e3c88d7fd7cfb6f633b66a1e987fffce0c0be8
---
M pywikibot/_wbtypes.py
M tests/wbtypes_tests.py
2 files changed, 63 insertions(+), 31 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/_wbtypes.py b/pywikibot/_wbtypes.py
index 19317be..a0c0b5d 100644
--- a/pywikibot/_wbtypes.py
+++ b/pywikibot/_wbtypes.py
@@ -11,14 +11,16 @@
import json
import math
import re
+from collections.abc import Mapping
from decimal import Decimal
from typing import TYPE_CHECKING, Any
import pywikibot
from pywikibot import exceptions
+from pywikibot.backports import Iterator
from pywikibot.logging import warning
from pywikibot.time import Timestamp
-from pywikibot.tools import remove_last_args
+from pywikibot.tools import issue_deprecation_warning, remove_last_args
if TYPE_CHECKING:
@@ -289,6 +291,43 @@
return pywikibot.ItemPage.from_entity_uri(repo, self.entity, lazy_load)
+class _Precision(Mapping):
+
+ """Wrapper for WbTime.PRECISION to deprecate 'millenia' key."""
+
+ PRECISION = {
+ '1000000000': 0,
+ '100000000': 1,
+ '10000000': 2,
+ '1000000': 3,
+ '100000': 4,
+ '10000': 5,
+ 'millennium': 6,
+ 'century': 7,
+ 'decade': 8,
+ 'year': 9,
+ 'month': 10,
+ 'day': 11,
+ 'hour': 12,
+ 'minute': 13,
+ 'second': 14,
+ }
+
+ def __getitem__(self, key) -> int:
+ if key == 'millenia':
+ issue_deprecation_warning(
+ f'{key!r} key for precision', "'millennium'", since='10.0.0')
+ return self.PRECISION['millennium']
+
+ return self.PRECISION[key]
+
+ def __iter__(self) -> Iterator[int]:
+ return iter(self.PRECISION)
+
+ def __len__(self) -> int:
+ return len(self.PRECISION)
+
+
class WbTime(WbRepresentation):
"""A Wikibase time representation.
@@ -304,22 +343,7 @@
:class:`pywikibot.Timestamp` and :meth:`fromTimestamp`.
"""
- PRECISION = {'1000000000': 0,
- '100000000': 1,
- '10000000': 2,
- '1000000': 3,
- '100000': 4,
- '10000': 5,
- 'millenia': 6,
- 'century': 7,
- 'decade': 8,
- 'year': 9,
- 'month': 10,
- 'day': 11,
- 'hour': 12,
- 'minute': 13,
- 'second': 14
- }
+ PRECISION = _Precision()
FORMATSTR = '{0:+012d}-{1:02d}-{2:02d}T{3:02d}:{4:02d}:{5:02d}Z'
@@ -378,21 +402,30 @@
the equality operator will return false if the timezone is
different.
- :param year: The year as a signed integer of between 1 and 16 digits.
+ .. deprecated:: 10.0
+ *precision* value 'millenia' is deprecated; 'millennium' must
+ be used instead.
+
+ :param year: The year as a signed integer of between 1 and 16
+ digits.
:param month: Month of the timestamp, if it exists.
:param day: Day of the timestamp, if it exists.
:param hour: Hour of the timestamp, if it exists.
:param minute: Minute of the timestamp, if it exists.
:param second: Second of the timestamp, if it exists.
- :param precision: The unit of the precision of the time.
- :param before: Number of units after the given time it could be, if
- uncertain. The unit is given by the precision.
- :param after: Number of units before the given time it could be, if
- uncertain. The unit is given by the precision.
+ :param precision: The unit of the precision of the time. Must be
+ either an int in range 0 - 14 or one of '1000000000',
+ '100000000', '10000000', '1000000', '100000', '10000',
+ 'millennium', 'century', 'decade', 'year', month', 'day',
+ 'hour', 'minute' or 'second'.
+ :param before: Number of units after the given time it could be,
+ if uncertain. The unit is given by the precision.
+ :param after: Number of units before the given time it could be,
+ if uncertain. The unit is given by the precision.
:param timezone: Timezone information in minutes.
:param calendarmodel: URI identifying the calendar model.
- :param site: The Wikibase site. If not provided, retrieves the data
- repository from the default site from user-config.py.
+ :param site: The Wikibase site. If not provided, retrieves the
+ data repository from the default site from user-config.py.
Only used if calendarmodel is not given.
"""
if year is None:
@@ -441,7 +474,6 @@
and precision in self.PRECISION.values()):
self.precision = precision
elif precision in self.PRECISION:
- assert isinstance(precision, str)
self.precision = self.PRECISION[precision]
else:
raise ValueError(f'Invalid precision: "{precision}"')
@@ -647,7 +679,7 @@
# so we don't need to do anything complicated like the other
# examples.
year = round(year / power_of_10) * power_of_10
- elif self.precision == self.PRECISION['millenia']:
+ elif self.precision == self.PRECISION['millennium']:
# Similar situation with centuries
year_float = year / 1000
if year_float < 0:
diff --git a/tests/wbtypes_tests.py b/tests/wbtypes_tests.py
index 1a83216..dc672a9 100755
--- a/tests/wbtypes_tests.py
+++ b/tests/wbtypes_tests.py
@@ -258,7 +258,7 @@
# some aliases here
decade = pywikibot.WbTime.PRECISION['decade']
century = pywikibot.WbTime.PRECISION['century']
- millenia = pywikibot.WbTime.PRECISION['millenia']
+ millennium = pywikibot.WbTime.PRECISION['millennium']
t = pywikibot.WbTime(site=repo, year=2010, month=1, day=1, hour=12,
minute=43, second=12)
t2 = pywikibot.WbTime(site=repo, year=2010, month=1, day=1, hour=12,
@@ -287,7 +287,7 @@
precision=century)
t10 = pywikibot.WbTime(site=repo, year=2010, month=1, day=1, hour=12,
minute=43, second=12,
- precision=millenia)
+ precision=millennium)
t11 = pywikibot.WbTime(site=repo, year=2010, month=1, day=1, hour=12,
minute=43, second=12, timezone=-300,
precision=pywikibot.WbTime.PRECISION['day'])
@@ -324,10 +324,10 @@
precision=century).normalize())
self.assertEqual(t10.normalize(),
pywikibot.WbTime(site=repo, year=3000,
- precision=millenia))
+ precision=millennium))
self.assertEqual(t10.normalize(),
pywikibot.WbTime(site=repo, year=2010,
- precision=millenia).normalize())
+ precision=millennium).normalize())
t11_normalized = t11.normalize()
t12_normalized = t12.normalize()
self.assertEqual(t11_normalized.timezone, 0)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1101155?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ia1e3c88d7fd7cfb6f633b66a1e987fffce0c0be8
Gerrit-Change-Number: 1101155
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1101152?usp=email )
Change subject: doc: fix spelling mistakes
......................................................................
doc: fix spelling mistakes
Change-Id: I270f79e25fbcb8f7045f6a893305aa7a461c0c5e
---
M HISTORY.rst
M docs/api_ref/pywikibot.pagegenerators.rst
M docs/api_ref/pywikibot.site.rst
M docs/library_usage.rst
M docs/licenses.rst
M pywikibot/bot.py
M pywikibot/config.py
M pywikibot/cosmetic_changes.py
M pywikibot/data/api/_generators.py
M pywikibot/data/api/_paraminfo.py
M pywikibot/data/api/_requests.py
M pywikibot/data/superset.py
M pywikibot/editor.py
M pywikibot/family.py
M pywikibot/page/_basepage.py
M pywikibot/page/_filepage.py
M pywikibot/page/_wikibase.py
M pywikibot/pagegenerators/_factory.py
M pywikibot/pagegenerators/_generators.py
M pywikibot/scripts/login.py
M pywikibot/scripts/wrapper.py
M pywikibot/site/_apisite.py
M pywikibot/site/_datasite.py
M pywikibot/site/_extensions.py
M pywikibot/site/_generators.py
M pywikibot/site/_namespace.py
M pywikibot/site/_siteinfo.py
M pywikibot/tools/_deprecate.py
M pywikibot/tools/chars.py
M pywikibot/userinterfaces/terminal_interface_base.py
M pywikibot/version.py
M scripts/CHANGELOG.rst
M scripts/README.rst
M scripts/__init__.py
M scripts/category_redirect.py
M scripts/commons_information.py
M scripts/create_isbn_edition.py
M scripts/delete.py
M scripts/delinker.py
M scripts/fixing_redirects.py
M scripts/interwiki.py
M scripts/maintenance/addwikis.py
M scripts/maintenance/make_i18n_dict.py
M scripts/solve_disambiguation.py
M scripts/touch.py
M scripts/weblinkchecker.py
M scripts/welcome.py
M tests/add_text_tests.py
M tests/http_tests.py
M tests/i18n_tests.py
M tests/page_tests.py
M tests/pagegenerators_tests.py
M tests/script_tests.py
M tests/site_generators_tests.py
M tests/site_tests.py
M tests/siteinfo_tests.py
M tests/sparql_tests.py
M tests/superset_tests.py
M tests/tools_tests.py
M tests/upload_tests.py
M tests/version_tests.py
M tests/wbtypes_tests.py
M tests/wikibase_edit_tests.py
63 files changed, 112 insertions(+), 110 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/HISTORY.rst b/HISTORY.rst
index b0a5618..2e6ba4e 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -52,7 +52,7 @@
-----
*05 October 2024*
-* Ignore :exc:`ValueError` durig upcast of :class:`FilePage<pywikibot.page.FilePage>` due to invalid file extension
+* Ignore :exc:`ValueError` during upcast of :class:`FilePage<pywikibot.page.FilePage>` due to invalid file extension
(:phab:`T367777`, :phab:`T376452`)
* Provide an entry point to connect foreign scripts with pwb wapper (:phab:`T139143`, :phab:`T139144`)
* Show a warning message for a deleted or unknown :class:`Claim<pywikibot.Claim>` type (:phab:`T374676`)
@@ -118,7 +118,7 @@
* No longer wait in :meth:`data.api.Request._http_request` for ``ImportError`` and ``NameError``
* Replace ``requests.utils.urlparse`` with ``urllib.parse.urlparse`` in
:func:`comms.http.get_authentication` (:phab:`T367649`)
-* Show an appropiate message if ``requests_oauthlib`` package is required but missing (:phab:`T353387`)
+* Show an appropriate message if ``requests_oauthlib`` package is required but missing (:phab:`T353387`)
* Retry ``DBUnexpectedError`` in :meth:`data.api.Request._internal_api_error` (:phab:`T367383`)
* Duplicated entries found in :mod:`pywikibot` were removed
* Pass ``None`` instead of an empty string as *expiry* argument in
@@ -167,7 +167,7 @@
* Circumvent problems with *unique* and *prefix* parameters in :meth:`Site.alllinks()
<pywikibot.site._generators.GeneratorsMixin.alllinks>` (:phab:`T359427`)
-* Detect nighly version file with :func:`version.getversion_nightly` (:phab:`T362492`)
+* Detect nightly version file with :func:`version.getversion_nightly` (:phab:`T362492`)
* :mod:`version`.github_svn_rev2hash() was removed; it was no longer functional (:phab:`T362484`)
* SVN support has been dropped; ``.svnprops`` property settings was removed (:phab:`T362484`)
* Skip process that requires login to logout (:phab:`T326614`)
@@ -754,7 +754,7 @@
* Add FilePage.file_is_used property to determine whether a file is used on a site
* Add support for guwwiki and shnwikivoyage (:phab:`T303762`, :phab:`T302799`)
-* TextExtracts support was aded (:phab:`T72682`)
+* TextExtracts support was added (:phab:`T72682`)
* Unused `get_redirect` parameter of Page.getOldVersion() has been dropped
* Provide BasePage.get_parsed_page() as a public method
* Provide BuiltinNamespace.canonical_namespaces() with BuiltinNamespace IntEnum
@@ -1224,7 +1224,7 @@
* Property.getType() method has been removed
* Family.server_time() method was removed; it is still available from Site object (:phab:`T89451`)
* All HttpRequest parameters except of charset has been dropped (:phab:`T265206`)
-* A lot of methods and properties of HttpRequest are deprecated in favour of requests.Resonse attributes
+* A lot of methods and properties of HttpRequest are deprecated in favour of requests.Response attributes
(:phab:`T265206`)
* Method and properties of HttpRequest are delegated to requests.Response object (:phab:`T265206`)
* comms.threadedhttp.HttpRequest.raw was replaced by HttpRequest.content property (:phab:`T265206`)
@@ -1311,12 +1311,12 @@
* Accept only valid names in generate_family_file.py (:phab:`T265328`, :phab:`T265353`)
* New plural.plural_rule() function returns a rule for a given language
* Replace deprecated urllib.request.URLopener with http.fetch (:phab:`T255575`)
-* OptionHandler/BaseBot options are accessable as OptionHandler.opt attributes or keyword item
+* OptionHandler/BaseBot options are accessible as OptionHandler.opt attributes or keyword item
(see also :phab:`T264721`)
* pywikibot.setAction() function was removed
* A namedtuple is the result of textlib.extract_sections()
* Prevent circular imports in config2.py and http.py (:phab:`T264500`)
-* version.get_module_version() is deprecated and gives no meaningfull result
+* version.get_module_version() is deprecated and gives no meaningful result
* Fix version.get_module_filename() and update log lines (:phab:`T264235`)
* Re-enable printing log header (:phab:`T264235`)
* Fix result of :func:`tools.itertools.intersect_generators` (:phab:`T263947`)
@@ -1493,7 +1493,7 @@
* Raise ServerError also if connection to PetScan timeouts
* pagegenerators.py no longer supports 'oursql' or 'MySQLdb'. It now solely supports PyMySQL
(:phab:`T243154`, :phab:`T89976`)
-* Disfunctional Family.versionnumber() method was removed
+* Dysfunctional Family.versionnumber() method was removed
* Refactor login functionality (:phab:`T137805`, :phab:`T224712`, :phab:`T248767`, :phab:`T248768`, :phab:`T248945`)
* Bugfixes and improvements
* Localisation updates
@@ -1507,7 +1507,7 @@
* Refactor data attributes of Wikibase entities (:phab:`T233406`)
* Functions dealing with stars list are desupported and may be removed
* Use path's stem of script filename within pwb.py wrapper (:phab:`T248372`)
-* Disfunctional cgi_interface.py was removed (:phab:`T248292`, :phab:`T248250`, :phab:`T193978`)
+* Dysfunctional cgi_interface.py was removed (:phab:`T248292`, :phab:`T248250`, :phab:`T193978`)
* Fix logout on MW < 1.24 (:phab:`T214009`)
* Fixed TypeError in getFileVersionHistoryTable method (:phab:`T248266`)
* Outdated secure connection overrides were removed (:phab:`T247668`)
@@ -1920,7 +1920,7 @@
* Clean up issue with _WbDataPage (:phab:`T166362`)
* Re-enable xml for WikiStats with py2 (:phab:`T165830`)
* Solve httplib.IncompleteRead exception in eventstreams (:phab:`T168535`)
-* Only force input_choise if self.always is given (:phab:`T161483`)
+* Only force input_choice if self.always is given (:phab:`T161483`)
* Add colon when replacing category and file weblink (:phab:`T127745`)
* API Request: set uiprop only when ensuring 'userinfo' in meta (:phab:`T169202`)
@@ -1938,7 +1938,7 @@
* Implement pywikibot support for adding thanks to normal revisions (:phab:`T135409`)
* Implement server side event client EventStreams (:phab:`T158943`)
* new pagegenerators filter option -titleregexnot
-* Add exception for -namepace option (:phab:`T167580`)
+* Add exception for -namespace option (:phab:`T167580`)
* InteractiveReplace: Allow no replacements by default
* Encode default globe in family file
* Add on to pywikibot support for thanking normal revisions (:phab:`T135409`)
diff --git a/docs/api_ref/pywikibot.pagegenerators.rst b/docs/api_ref/pywikibot.pagegenerators.rst
index 0967fd7..1835892 100644
--- a/docs/api_ref/pywikibot.pagegenerators.rst
+++ b/docs/api_ref/pywikibot.pagegenerators.rst
@@ -9,7 +9,7 @@
==================================================================
.. automodule:: pagegenerators._factory
- :synopsis: GeneratorFactory module wich handles pagegenerators options
+ :synopsis: GeneratorFactory module which handles pagegenerators options
:mod:`pagegenerators.\_filters` --- Filter Functions
====================================================
diff --git a/docs/api_ref/pywikibot.site.rst b/docs/api_ref/pywikibot.site.rst
index 1d8b3a2..7a34f79 100644
--- a/docs/api_ref/pywikibot.site.rst
+++ b/docs/api_ref/pywikibot.site.rst
@@ -94,7 +94,7 @@
.. automodule:: pywikibot.site._apisite
.. automodule:: pywikibot.site._extensions
- :synopsis: Objects representing API interface to MediaWiki site extenstions
+ :synopsis: Objects representing API interface to MediaWiki site extensions
.. automodule:: pywikibot.site._generators
:synopsis: Objects representing API generators to MediaWiki site
diff --git a/docs/library_usage.rst b/docs/library_usage.rst
index 6afb89e..344f46d 100644
--- a/docs/library_usage.rst
+++ b/docs/library_usage.rst
@@ -72,7 +72,7 @@
:class:`pywikibot.Page` object from
:attr:`generator<bot.BaseBot.generator>`.
:15: All bot options which are passed to the bot class when
- instantiating it are accessable via
+ instantiating it are accessible via
:class:`opt attribute<bot.OptionHandler>`. ``opt.always``,
``opt.text`` and ``opt.summary`` are all available options for this
bot class.
diff --git a/docs/licenses.rst b/docs/licenses.rst
index ad8f9c5..6233662 100644
--- a/docs/licenses.rst
+++ b/docs/licenses.rst
@@ -11,7 +11,7 @@
protected as a trademark. Parts of :mod:`memento<data.memento>` module
is licenced under the `BSD`_ open source software license. The
:func:`get_close_matches_ratio()<diff.get_close_matches_ratio>` function
-off the :mod:`diff` module incorporates code from Pyton software which
+off the :mod:`diff` module incorporates code from Python software which
is licenced under `PSF`_ license.
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 952848e..e3a7b62 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -686,7 +686,7 @@
>>> local_args # doctest: +SKIP
[]
>>> local_args = pywikibot.handle_args(['-simulate', '-myoption'])
- >>> local_args # global optons are handled, show the remaining
+ >>> local_args # global options are handled, show the remaining
['-myoption']
>>> for arg in local_args: pass # do whatever is wanted with local_args
diff --git a/pywikibot/config.py b/pywikibot/config.py
index c208945..cabc17c 100644
--- a/pywikibot/config.py
+++ b/pywikibot/config.py
@@ -538,7 +538,7 @@
# scripts are displayed or if only one is found, it will be started.
# There are some configuration values to change the behavior
#
-# pwb_close_matches: the maximum number of simular scripts to be found
+# pwb_close_matches: the maximum number of similar scripts to be found
pwb_close_matches = 10 # must be greater than 0
# pwb_cut_off: similarity of scripts to be found
pwb_cut_off = 0.7 # must be a float in the range [0, 1]
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index 76fdeef..4bf1fdc 100644
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -700,7 +700,7 @@
# - used intentionally in navigation bar templates on w:de
160, # Non-breaking space ( )
# - not supported by Firefox textareas
- 173, # Soft-hypen (­) - enable editing
+ 173, # Soft-hyphen (­) - enable editing
8206, # Left-to-right mark (<r;)
8207, # Right-to-left mark (&rtl;)
]
@@ -927,7 +927,7 @@
return text
def fixHtml(self, text: str) -> str:
- """Relace html markups with wikitext markups."""
+ """Replace html markups with wikitext markups."""
def replace_header(match: Match[str]) -> str:
"""Create a header string for replacing."""
depth = int(match[1])
diff --git a/pywikibot/data/api/_generators.py b/pywikibot/data/api/_generators.py
index fdf941a..f48459d 100644
--- a/pywikibot/data/api/_generators.py
+++ b/pywikibot/data/api/_generators.py
@@ -728,7 +728,7 @@
.. versionchanged:: 9.5
No longer raise :exc:`exceptions.UnsupportedPageError` but
- return a generic :class:`pywikibot.Page` obect. The exception
+ return a generic :class:`pywikibot.Page` object. The exception
is raised when getting the content for example.
.. versionchanged:: 9.6
Upcast to :class:`page.FilePage` if *pagedata* has
diff --git a/pywikibot/data/api/_paraminfo.py b/pywikibot/data/api/_paraminfo.py
index b4d7788..d15f41c 100644
--- a/pywikibot/data/api/_paraminfo.py
+++ b/pywikibot/data/api/_paraminfo.py
@@ -362,7 +362,7 @@
return None
if len(param_data) != 1:
- raise RuntimeError(f'parameter data length is eiter empty or not '
+ raise RuntimeError(f'parameter data length is either empty or not '
f'unique.\n{param_data}')
return param_data[0]
diff --git a/pywikibot/data/api/_requests.py b/pywikibot/data/api/_requests.py
index d0893f6..5a0bc9b 100644
--- a/pywikibot/data/api/_requests.py
+++ b/pywikibot/data/api/_requests.py
@@ -719,7 +719,7 @@
"""Return a dict from requests.Response.
.. versionchanged:: 8.2
- show a warning to add a ``protocoll()`` method to the family
+ show a warning to add a ``protocol()`` method to the family
file if suitable.
:param response: a requests.Response object
@@ -808,7 +808,7 @@
"""Handle warnings; return True to retry request, False to resume.
.. versionchanged:: 7.2
- Return True to retry the current request and Falso to resume.
+ Return True to retry the current request and False to resume.
:meta public:
"""
@@ -1121,7 +1121,7 @@
continue
if code == 'urlshortener-blocked': # T244062
- # add additional informations to error dict
+ # add additional information to error dict
error['current site'] = self.site
if self.site.user():
error['current user'] = self.site.user()
@@ -1187,7 +1187,7 @@
.. versionchanged:: 8.0
return a `pathlib.Path` object.
.. versionchanged:: 9.0
- remove Python main version from directoy name
+ remove Python main version from directory name
:return: base directory path for cache entries
diff --git a/pywikibot/data/superset.py b/pywikibot/data/superset.py
index 7fd0e14..c02d582 100644
--- a/pywikibot/data/superset.py
+++ b/pywikibot/data/superset.py
@@ -87,7 +87,7 @@
url = f'{self.superset_url}/login/mediawiki?next='
self.last_response = http.fetch(url)
- # Test if uset has been succesfully logged in
+ # Test if uset has been successfully logged in
url = f'{self.superset_url}/api/v1/me/'
self.last_response = http.fetch(url)
diff --git a/pywikibot/editor.py b/pywikibot/editor.py
index ec42bdd..d965b4d 100644
--- a/pywikibot/editor.py
+++ b/pywikibot/editor.py
@@ -1,6 +1,6 @@
"""Text editor class for your favourite editor.
-.. note:: This module uses :mod:`userinterfaces.gui` and has depedencies
+.. note:: This module uses :mod:`userinterfaces.gui` and has dependencies
from other partially external modules.
"""
#
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 43d569d..2d62f44 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -290,7 +290,7 @@
**Examples:**
Allowing linking *to* ``pt`` 102 namespace from any other lang 0
- namepace is:
+ namespace is:
.. code-block:: Python
@@ -1075,7 +1075,7 @@
return 'DataSite'
def entity_sources(self, code: str) -> dict[str, tuple[str, str]]:
- """Provide reopsitory site information for entity types.
+ """Provide repository site information for entity types.
The result must be structured as follows:
diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index 8210f17..9b907b6 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -549,7 +549,7 @@
def text(self) -> str:
"""Return the current (edited) wikitext, loading it if necessary.
- This property should be prefered over :meth:`get`. If the page
+ This property should be preferred over :meth:`get`. If the page
does not exist, an empty string will be returned. For a redirect
it returns the redirect page content and does not raise an
:exc:`exceptions.IsRedirectPageError` exception.
diff --git a/pywikibot/page/_filepage.py b/pywikibot/page/_filepage.py
index 3e3fd88..60d693e 100644
--- a/pywikibot/page/_filepage.py
+++ b/pywikibot/page/_filepage.py
@@ -350,7 +350,7 @@
Pywikibot_MW_gear_icon.svg was downloaded.
- Download a thumnail:
+ Download a thumbnail:
>>> file.download(url_param='120px')
True
diff --git a/pywikibot/page/_wikibase.py b/pywikibot/page/_wikibase.py
index 4324705..34d198d 100644
--- a/pywikibot/page/_wikibase.py
+++ b/pywikibot/page/_wikibase.py
@@ -2500,7 +2500,7 @@
}
-# Add LexemeSnese to the class attribute "types" after its declaration.
+# Add LexemeSense to the class attribute "types" after its declaration.
Property.types['wikibase-sense'] = LexemeSense
diff --git a/pywikibot/pagegenerators/_factory.py b/pywikibot/pagegenerators/_factory.py
index b611047..73b9a13 100644
--- a/pywikibot/pagegenerators/_factory.py
+++ b/pywikibot/pagegenerators/_factory.py
@@ -1,4 +1,4 @@
-"""GeneratorFactory module wich handles pagegenerators options."""
+"""GeneratorFactory module which handles pagegenerators options."""
#
# (C) Pywikibot team, 2008-2024
#
diff --git a/pywikibot/pagegenerators/_generators.py b/pywikibot/pagegenerators/_generators.py
index 3a2efb9..cfd5c09 100644
--- a/pywikibot/pagegenerators/_generators.py
+++ b/pywikibot/pagegenerators/_generators.py
@@ -211,7 +211,7 @@
:param site: Site for generator results.
:param namespaces: namespace to retrieve pages from
- :param total: Maxmium number of pages to retrieve in total
+ :param total: Maximum number of pages to retrieve in total
"""
# API does not (yet) have a newpages function, so this tries to duplicate
# it by filtering the recentchanges output
diff --git a/pywikibot/scripts/login.py b/pywikibot/scripts/login.py
index e47f01f..3cc1bf8 100755
--- a/pywikibot/scripts/login.py
+++ b/pywikibot/scripts/login.py
@@ -23,7 +23,7 @@
.. note:: the global account must exist already before
using this.
--async Run the bot in parallel tasks, only usefull together with
+-async Run the bot in parallel tasks, only useful together with
``-all`` option
.. hint:: Use :ref:`global options` ``-code``, ``-family`` or ``-site``
@@ -131,7 +131,7 @@
logout = False
oauth = False
autocreate = False
- asyncronous = False
+ asynchronous = False
unknown_args = []
for arg in pywikibot.handle_args(args):
if arg == '-all':
@@ -143,7 +143,7 @@
elif arg == '-autocreate':
autocreate = True
elif arg == '-async':
- asyncronous = True
+ asynchronous = True
else:
unknown_args.append(arg)
@@ -157,11 +157,11 @@
namedict = {site.family.name: {site.code: None}}
params = oauth, logout, autocreate
- context = ThreadPoolExecutor if asyncronous else nullcontext
+ context = ThreadPoolExecutor if asynchronous else nullcontext
with context() as executor:
for family_name in namedict:
for lang in namedict[family_name]:
- if asyncronous:
+ if asynchronous:
executor.submit(login_one_site, lang, family_name, *params)
else:
login_one_site(lang, family_name, *params)
diff --git a/pywikibot/scripts/wrapper.py b/pywikibot/scripts/wrapper.py
index 6a9796e..a9bfc8f 100755
--- a/pywikibot/scripts/wrapper.py
+++ b/pywikibot/scripts/wrapper.py
@@ -250,7 +250,7 @@
if dependency.startswith('packaging'):
# Ignore these dependencies because ImportError is raised in an
# early state when they are imported in backports. They are already
- # used at this point. This is a workaound for toolforge where some
+ # used at this point. This is a workaround for toolforge where some
# modules are not installed as a site-package.
# TODO: Check imports from external source
continue
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 81c3a85..ea1de97 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -639,7 +639,7 @@
>>> 'anon' in site.userinfo
True
- **Usefull alternatives to userinfo property**
+ **Useful alternatives to userinfo property**
- :meth:`has_group` to verify the group membership
- :meth:`has_right` to verify that the user has a given right
@@ -1726,7 +1726,7 @@
'a9f...0a0+\\'
>>> token = site.get_tokens(['unknown']) # try an invalid token
... # doctest: +SKIP
- ... # invalid token names shows a warnig and the key is not in result
+ ... # invalid token names shows a warning and the key is not in result
...
WARNING: API warning (tokens) of unknown format:
... {'warnings': 'Unrecognized value for parameter "type": foo'}
@@ -2045,7 +2045,7 @@
page requires solving a captcha
:raises CascadeLockedPageError: The page is protected with
protection cascade
- :raises EditConflictError: an edit confict occurred
+ :raises EditConflictError: an edit conflict occurred
:raises Error: No text to be saved or API editing not enabled on
site or user is not authorized to edit, create pages or
create image redirects on site or bot is not logged in and
diff --git a/pywikibot/site/_datasite.py b/pywikibot/site/_datasite.py
index 5d61f1b..f07684e 100644
--- a/pywikibot/site/_datasite.py
+++ b/pywikibot/site/_datasite.py
@@ -164,7 +164,7 @@
return None
def tabular_data_repository(self):
- """Return Site object for the tabular-datas repository e.g. commons."""
+ """Return Site object for the tabular-data repository e.g. commons."""
url = self.siteinfo['general'].get(
'wikibase-tabulardatastoragebaseurl')
if url:
diff --git a/pywikibot/site/_extensions.py b/pywikibot/site/_extensions.py
index 4b6243a..22872fa 100644
--- a/pywikibot/site/_extensions.py
+++ b/pywikibot/site/_extensions.py
@@ -1,4 +1,4 @@
-"""Objects representing API interface to MediaWiki site extenstions."""
+"""Objects representing API interface to MediaWiki site extensions."""
#
# (C) Pywikibot team, 2008-2024
#
@@ -357,7 +357,7 @@
.. deprecated:: 9.4.0
Structured Discussions extension formerly known as Flow
- extenstion is not maintained and will be removed. Users are
+ extension is not maintained and will be removed. Users are
encouraged to stop using it. (:phab:`T371180`)
.. seealso:: :mod:`flow`
"""
@@ -389,7 +389,7 @@
.. deprecated:: 9.4.0
Structured Discussions extension formerly known as Flow
- extenstion is not maintained and will be removed. Users are
+ extension is not maintained and will be removed. Users are
encouraged to stop using it. (:phab:`T371180`)
.. seealso:: :mod:`flow`
"""
diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index b4ff377..ecbd871 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -960,7 +960,7 @@
the specified type.
:param protect_level: only yield pages that have protection at
this level; can only be used if protect_type is specified.
- :param reverse: if True, iterate in reverse Unicode lexigraphic
+ :param reverse: if True, iterate in reverse Unicode lexicographic
order (default: iterate in forward order).
:param content: if True, load the current content of each
iterated page (default False).
@@ -1103,7 +1103,7 @@
:param start: Start at this category title (category need not exist).
:param prefix: Only yield categories starting with this string.
- :param reverse: if True, iterate in reverse Unicode lexigraphic
+ :param reverse: if True, iterate in reverse Unicode lexicographic
order (default: iterate in forward order)
:param content: if True, load the current content of each iterated page
(default False); note that this means the contents of the category
@@ -1191,7 +1191,7 @@
:param prefix: only iterate titles starting with this substring
:param minsize: only iterate images of at least this many bytes
:param maxsize: only iterate images of no more than this many bytes
- :param reverse: if True, iterate in reverse lexigraphic order
+ :param reverse: if True, iterate in reverse lexicographic order
:param sha1: only iterate image (it is theoretically possible there
could be more than one) with this sha1 hash
:param sha1base36: same as sha1 but in base 36
@@ -1226,13 +1226,13 @@
) -> Iterable[dict[str, Any]]:
"""Iterate archived files.
- Yields dict of file archive informations.
+ Yields dict of file archive information.
.. seealso:: :api:`filearchive`
:param start: start at this title (name need not exist)
:param end: end at this title (name need not exist)
- :param reverse: if True, iterate in reverse lexigraphic order
+ :param reverse: if True, iterate in reverse lexicographic order
:param total: maximum number of pages to retrieve in total
:keyword prefix: only iterate titles starting with this substring
:keyword sha1: only iterate image with this sha1 hash
diff --git a/pywikibot/site/_namespace.py b/pywikibot/site/_namespace.py
index dd282cb..bac3f83 100644
--- a/pywikibot/site/_namespace.py
+++ b/pywikibot/site/_namespace.py
@@ -165,7 +165,7 @@
return self._contains_lowercase_name(name.lower())
def __bool__(self) -> bool:
- """Obtain boolean method for Namepace class.
+ """Obtain boolean method for Namespace class.
This method is implemented to be independent from __len__ method.
diff --git a/pywikibot/site/_siteinfo.py b/pywikibot/site/_siteinfo.py
index b720aab..b04dab4 100644
--- a/pywikibot/site/_siteinfo.py
+++ b/pywikibot/site/_siteinfo.py
@@ -94,7 +94,7 @@
All properties which the site doesn't
support contain the default value. Because pre-1.12 no data was
returned when a property doesn't exists, it queries each property
- independetly if a property is invalid.
+ independently if a property is invalid.
.. seealso:: :api:Siteinfo
diff --git a/pywikibot/tools/_deprecate.py b/pywikibot/tools/_deprecate.py
index c1e6512..7f7c4c0 100644
--- a/pywikibot/tools/_deprecate.py
+++ b/pywikibot/tools/_deprecate.py
@@ -483,7 +483,7 @@
def wrapper(*args: Any, **kwargs: Any) -> Any:
"""Throws the warning and makes the argument fixing.
- :param args: args passed to the decorated functoin or method
+ :param args: args passed to the decorated function or method
:param kwargs: kwargs passed to the decorated function or
method
:return: the value returned by the decorated function or
diff --git a/pywikibot/tools/chars.py b/pywikibot/tools/chars.py
index de011c0..08d50e2 100644
--- a/pywikibot/tools/chars.py
+++ b/pywikibot/tools/chars.py
@@ -94,7 +94,7 @@
Uses the first encoding that doesn't cause an error. Raises the
first exception if all encodings fails.
- For a single *encodings* string this function is equvalent to
+ For a single *encodings* string this function is equivalent to
:samp:`urllib.parse.unquote(title, encodings, errors='strict')`
.. versionchanged:: 8.4
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py b/pywikibot/userinterfaces/terminal_interface_base.py
index 4c8df5a..e95a793 100644
--- a/pywikibot/userinterfaces/terminal_interface_base.py
+++ b/pywikibot/userinterfaces/terminal_interface_base.py
@@ -507,7 +507,7 @@
"""Ask the user to select one entry from a list of entries.
:param question: The question, without trailing whitespace.
- :param answers: A sequence of options to be choosen.
+ :param answers: A sequence of options to be chosen.
:param default: The default answer if no was entered. None to require
an answer.
:param force: Automatically use the default.
diff --git a/pywikibot/version.py b/pywikibot/version.py
index 4078314..33e941d 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -181,7 +181,7 @@
"""Get version info for a nightly release.
.. hint::
- the version informations of the nightly dump is stored in the
+ the version information of the nightly dump is stored in the
``version`` file within the ``pywikibot`` folder.
:param path: directory of the uncompressed nightly.
diff --git a/scripts/CHANGELOG.rst b/scripts/CHANGELOG.rst
index 3472219..df653b3 100644
--- a/scripts/CHANGELOG.rst
+++ b/scripts/CHANGELOG.rst
@@ -534,7 +534,7 @@
checkimages
^^^^^^^^^^^
-* Use page_from_repository() method to read categoried from wikibase
+* Use page_from_repository() method to read categorized from wikibase
* Use ``itertools.zip_longest`` to find the most important image
dataextend
@@ -618,7 +618,7 @@
blockpageschecker
^^^^^^^^^^^^^^^^^
-* Use different edit comments when adding, changeing or removing
+* Use different edit comments when adding, changing or removing
templates (:phab:`T291345`)
* Derive CheckerBot from ConfigParserBot (:phab:`T57106`)
* Derive CheckerBot from CurrentPageBot (:phab:`T196851`,
@@ -798,7 +798,7 @@
template
^^^^^^^^
-* Do not try to initialze generator twice in TemplateRobot
+* Do not try to initialize generator twice in TemplateRobot
(:phab:`T284534`)
update_script
@@ -809,7 +809,7 @@
version
^^^^^^^
-* Show all mandatory dependecies
+* Show all mandatory dependencies
6.3.0
-----
@@ -910,7 +910,7 @@
* Catch urllib3.LocationParseError and skip link (:phab:`T280356`)
* L10N updates
-* Avoid dupliate reference names (:phab:`T278040`)
+* Avoid duplicate reference names (:phab:`T278040`)
solve_disambiguation
^^^^^^^^^^^^^^^^^^^^
@@ -967,7 +967,7 @@
maintenance
^^^^^^^^^^^
-* Add a preload_sites.py script to preload site informations
+* Add a preload_sites.py script to preload site information
(:phab:`T226157`)
reflinks
diff --git a/scripts/README.rst b/scripts/README.rst
index 978a6cd..6d9a38d 100644
--- a/scripts/README.rst
+++ b/scripts/README.rst
@@ -87,7 +87,7 @@
+--------------------------+---------------------------------------------------------+
| delete.py | This script can be used to delete pages en masse. |
+--------------------------+---------------------------------------------------------+
-| delinker.py | Delink file references of deleted images. |
+| delinker.py | Unlink file references of deleted images. |
+--------------------------+---------------------------------------------------------+
| djvutext.py | Extracts OCR text from djvu files and uploads onto |
| | pages in the "Page" namespace on Wikisource. |
diff --git a/scripts/__init__.py b/scripts/__init__.py
index be4eaa2..8651d5a 100644
--- a/scripts/__init__.py
+++ b/scripts/__init__.py
@@ -15,7 +15,7 @@
The advantages of pwb.py wrapper script are:
-- check for framework and script depedencies and show a warning if a
+- check for framework and script dependencies and show a warning if a
package is missing or outdated or if the Python release does not fit
- check whether user config file (user-config.py) is available and ask
to create it by starting the generate_user_files.py script
diff --git a/scripts/category_redirect.py b/scripts/category_redirect.py
index aadb8bf..99bae63 100755
--- a/scripts/category_redirect.py
+++ b/scripts/category_redirect.py
@@ -83,7 +83,7 @@
CategoryRedirectBot is a ConfigParserBot
.. versionchanged:: 9.0
- A logentry is writen to <userpage>/category_edit_requests if a
+ A logentry is written to <userpage>/category_edit_requests if a
page cannot be moved
"""
diff --git a/scripts/commons_information.py b/scripts/commons_information.py
index 794408a..67bdca9 100755
--- a/scripts/commons_information.py
+++ b/scripts/commons_information.py
@@ -6,7 +6,7 @@
``description`` field should provide brief but complete information
about the image. The description format should use Language templates
like ``{{En}}`` or ``{{De}}`` to specify the language of the description.
-This script adds these langage templates if missing. For example the
+This script adds these language templates if missing. For example the
description of
.. code-block:: wikitext
@@ -17,7 +17,7 @@
| Other fields =
}}
-will be analyzed as ``en`` language by ~100 % accurancy and the bot
+will be analyzed as ``en`` language by ~100 % accuracy and the bot
replaces its content by
.. code-block:: wikitext
@@ -100,7 +100,7 @@
}
def __init__(self, **kwargs) -> None:
- """Initialzer."""
+ """Initializer."""
super().__init__(**kwargs)
lang_tmp_cat = pywikibot.Category(self.site, self.lang_tmp_cat)
self.lang_tmps = {t.title(with_ns=False).lower()
@@ -279,7 +279,7 @@
edited = True
unhandled = []
- # now process hte template
+ # now process the template
if self.process_desc_template(node):
edited = True
else:
diff --git a/scripts/create_isbn_edition.py b/scripts/create_isbn_edition.py
index a802484..f000c03 100755
--- a/scripts/create_isbn_edition.py
+++ b/scripts/create_isbn_edition.py
@@ -197,7 +197,7 @@
missing are e.g.: place of publication, number of pages
* Some digital libraries have more registrations than others.
* Some digital libraries have data quality problems.
- * Not all ISBN atttributes have data values (authors, publisher,
+ * Not all ISBN attributes have data values (authors, publisher,
date of publication), language can be missing at the digital
library.
* How to add still more digital libraries?
@@ -221,7 +221,7 @@
have P243)
P8383: Goodreads identification code for work 13957943; should
only have P2969)
- * ERROR: an HTTP error has ocurred e.g. (503) Service Unavailable
+ * ERROR: an HTTP error has occurred e.g. (503) Service Unavailable
* error: externally-managed-environment
``isbnlib-kb`` cannot be installed via :code:`pip install` command.
@@ -976,7 +976,7 @@
qnumber_list = get_item_with_prop_value(ISBNPROP, isbn_fmtd)
qnumber_list.update(get_item_with_prop_value(ISBNPROP, isbn_number))
- # Get addional data from the digital library
+ # Get additional data from the digital library
# This could fail with
# ISBNLibHTTPError('403 Are you making many requests?')
# Handle ISBN classification
@@ -1511,7 +1511,7 @@
Add source reference when creating the item:
(digital library instance, retrieval date)
Create or amend items or claims:
- Number the authors in order of appearence
+ Number the authors in order of appearance
Check data consistency
Correct data quality problems:
OCLC Work ID for Written work
diff --git a/scripts/delete.py b/scripts/delete.py
index 05b4e3c..1458e21 100755
--- a/scripts/delete.py
+++ b/scripts/delete.py
@@ -109,7 +109,7 @@
return self._ref_table
def namespaces_with_ref_to_page(self, namespaces=None) -> set[Namespace]:
- """Check if current page has links from pages in namepaces.
+ """Check if current page has links from pages in namespaces.
If namespaces is None, all namespaces are checked.
Returns a set with namespaces where a ref to page is present.
diff --git a/scripts/delinker.py b/scripts/delinker.py
index aa23d20..939602c 100755
--- a/scripts/delinker.py
+++ b/scripts/delinker.py
@@ -31,7 +31,7 @@
change to that settings file below the [delinker] section like.
.. versionadded:: 7.2
- This script is completely rewriten from compat branch.
+ This script is completely rewritten from compat branch.
.. versionchanged:: 9.4
*-category* option was added.
"""
diff --git a/scripts/fixing_redirects.py b/scripts/fixing_redirects.py
index a505c4e..d327621 100755
--- a/scripts/fixing_redirects.py
+++ b/scripts/fixing_redirects.py
@@ -8,7 +8,7 @@
-featured Run over featured pages (for some Wikimedia wikis only)
-overwrite Usually only the link is changed ([[Foo]] -> [[Bar|Foo]]).
- This parameters sets the script to completly overwrite the
+ This parameters sets the script to completely overwrite the
link text ([[Foo]] -> [[Bar]]).
-ignoremoves Do not try to solve deleted pages after page move.
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index bb298a3..b19e0d1 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -2389,7 +2389,7 @@
pywikibot.exception()
dump.write_dump(bot.dump_titles, append)
else:
- pywikibot.info('Script terminated sucessfully.')
+ pywikibot.info('Script terminated successfully.')
finally:
dump.delete_dumps()
diff --git a/scripts/maintenance/addwikis.py b/scripts/maintenance/addwikis.py
index 2519341..2c6eb67 100755
--- a/scripts/maintenance/addwikis.py
+++ b/scripts/maintenance/addwikis.py
@@ -45,7 +45,8 @@
new_codes = set()
for wiki in list(wikis):
if wiki in original:
- pywikibot.warning(f'{wiki!r} is alread in Family.codes; ignoring.')
+ pywikibot.warning(
+ f'{wiki!r} is already in Family.codes; ignoring.')
else:
new_codes.add(wiki)
diff --git a/scripts/maintenance/make_i18n_dict.py b/scripts/maintenance/make_i18n_dict.py
index b8f361c..d55c3cf 100755
--- a/scripts/maintenance/make_i18n_dict.py
+++ b/scripts/maintenance/make_i18n_dict.py
@@ -16,7 +16,7 @@
>>> bot = i18nBot('<scriptname>', '<msg dict1>', '<msg dict2>', '<msg dict3>')
If you want to rename the message index use keyword arguments. This may be
-mixed with preleading positonal arguments:
+mixed with preleading positional arguments:
>>> bot = i18nBot('<scriptname>', '<msg dict1>', the_other_msg='<msg dict2>')
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 3da88c5..fe9a3fe 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -228,7 +228,7 @@
'Wikipedia:Disambiguation pages with links',
'Wikipedia:Multiple-place names \\([A-Z]\\)',
'Wikipedia:Non-unique personal name',
- "User:Jerzy/Disambiguation Pages i've Editted",
+ "User:Jerzy/Disambiguation Pages I've edited",
'User:Gareth Owen/inprogress',
'TLAs from [A-Z][A-Z][A-Z] to [A-Z][A-Z][A-Z]',
'List of all two-letter combinations',
@@ -809,7 +809,7 @@
while True:
m = self.linkR.search(text, pos=curpos)
if not m:
- # No additinal link found
+ # No additional link found
if n_links == 0:
# No remaining links to change for this disambiguation
# title.
diff --git a/scripts/touch.py b/scripts/touch.py
index 2793c36..a38d210 100755
--- a/scripts/touch.py
+++ b/scripts/touch.py
@@ -92,7 +92,7 @@
Enable batch purge using :meth:`APISite.purgepages()
<pywikibot.site._apisite.APISite.purgepages>`
"""
- # We can have mutiple sites, save pages and cache rate limit
+ # We can have multiple sites, save pages and cache rate limit
self.pages[page.site].append(page)
self.limit.setdefault(page.site, page.site.ratelimit('purge'))
self.purgepages()
diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py
index daaa880..05c061f 100755
--- a/scripts/weblinkchecker.py
+++ b/scripts/weblinkchecker.py
@@ -281,7 +281,7 @@
for the same host. Calculate the delay to start the run.
:param name: The key for the hosts class attribute
- :return: The calulated delay to start the run
+ :return: The calculated delay to start the run
"""
now = time.monotonic()
with cls.lock:
diff --git a/scripts/welcome.py b/scripts/welcome.py
index 4d86298..f607abb 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -163,7 +163,7 @@
add it. If also you think that a word isn't so international, feel free
to delete it.
-However, there is a dinamic-wikipage to load that badwords of your
+However, there is a dynamic-wikipage to load that badwords of your
project or you can add them directly in the source code that you are
using without adding or deleting.
diff --git a/tests/add_text_tests.py b/tests/add_text_tests.py
index 276c416..bab5a14 100755
--- a/tests/add_text_tests.py
+++ b/tests/add_text_tests.py
@@ -89,7 +89,7 @@
@patch('pywikibot.input')
@patch('pywikibot.handle_args', Mock(side_effect=lambda args: args))
def test_argument_prompt(self, input_mock):
- """Reqest an argument that requres a prompt."""
+ """Request an argument that requires a prompt."""
input_mock.return_value = 'hello world'
args = parse(['-text'], self.generator_factory)
diff --git a/tests/http_tests.py b/tests/http_tests.py
index f94250f..95261f6 100755
--- a/tests/http_tests.py
+++ b/tests/http_tests.py
@@ -278,7 +278,7 @@
use_fake_user_agent='ARBITRARY')
self.assertEqual(r.request.headers['user-agent'], 'ARBITRARY')
- def test_empty_valu(self):
+ def test_empty_value(self):
"""Test fake_user_agent with empty value."""
with self.assertRaisesRegex(ValueError,
'Invalid parameter: use_fake_user_agent'):
diff --git a/tests/i18n_tests.py b/tests/i18n_tests.py
index 528e734..f226913 100755
--- a/tests/i18n_tests.py
+++ b/tests/i18n_tests.py
@@ -56,7 +56,7 @@
def test_translate_commons(self):
"""Test localization with xdict for commons.
- Test whether the localzation is found either with the Site object
+ Test whether the localization is found either with the Site object
or with the site code.
"""
site = Site('commons')
@@ -313,7 +313,7 @@
"""Test i18n.input fallback via pwb."""
expect = i18n.twtranslate(self.alt_code, self.message, fallback=False)
result = self.execute(args=['listpages', '-cat'],
- data_in='non-existant-category\r\n')
+ data_in='non-existent-category\r\n')
self.assertIn(expect, result['stderr'])
diff --git a/tests/page_tests.py b/tests/page_tests.py
index 30bb9b1..b2cb091 100755
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -653,7 +653,7 @@
cached = True
def test_coordinates(self):
- """Test ``Page.coodinates`` method."""
+ """Test ``Page.coordinates`` method."""
page = pywikibot.Page(self.site, 'Berlin')
with self.subTest(primary_only=False):
coords = page.coordinates()
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index c7cee26..374f844 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -1618,7 +1618,7 @@
pagegenerators.NewpagesPageGenerator(site=site, total=10)])
def test_intersect_newpages_and_recentchanges(self):
- """Test intersection betweem newpages and recentchanges."""
+ """Test intersection between newpages and recentchanges."""
site = self.get_site()
self.assertEqualItertools(
[pagegenerators.NewpagesPageGenerator(site=site, total=50),
diff --git a/tests/script_tests.py b/tests/script_tests.py
index 065cdb6..2e73361 100755
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -22,7 +22,7 @@
ci_test_run = os.environ.get('PYWIKIBOT_TEST_RUNNING', '0') == '1'
scripts_path = join_root_path('scripts')
-# login scritpt should be the first to test
+# login script should be the first to test
framework_scripts = ['login', 'shell']
# These dependencies are not always the package name which is in setup.py.
diff --git a/tests/site_generators_tests.py b/tests/site_generators_tests.py
index 3f17ffc..99a80a3 100755
--- a/tests/site_generators_tests.py
+++ b/tests/site_generators_tests.py
@@ -1141,7 +1141,8 @@
self.skipTest(
f'gsrsearch returned timeout on site {mysite}:\n{e!r}')
if e.code == 'gsrsearch-text-disabled':
- self.skipTest(f'gsrsearch is diabled on site {mysite}:\n{e!r}')
+ self.skipTest(
+ 'gsrsearch is disabled on site {mysite}:\n{e!r}')
raise
def test_search_where_title(self):
diff --git a/tests/site_tests.py b/tests/site_tests.py
index e95633e..ffbb300 100755
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -339,7 +339,7 @@
'nosuchright'):
self.assertIsInstance(mysite.has_right(rgt), bool)
- def test_deprected_methods(self):
+ def test_deprecated_methods(self):
"""Test deprecated user related methods."""
mysite = self.get_site()
self.assertIsInstance(mysite.messages(), bool)
diff --git a/tests/siteinfo_tests.py b/tests/siteinfo_tests.py
index cc8b8e8..9e3034b 100755
--- a/tests/siteinfo_tests.py
+++ b/tests/siteinfo_tests.py
@@ -32,7 +32,7 @@
def test_siteinfo(self):
"""Test the siteinfo property."""
- # general enteries
+ # general entries
mysite = self.get_site()
self.assertIsInstance(mysite.siteinfo['timeoffset'], (int, float))
self.assertTrue(-12 * 60 <= mysite.siteinfo['timeoffset'] <= +14 * 60)
diff --git a/tests/sparql_tests.py b/tests/sparql_tests.py
index 243ad7b..943382a 100755
--- a/tests/sparql_tests.py
+++ b/tests/sparql_tests.py
@@ -192,7 +192,7 @@
family = 'commons'
code = 'commons'
- def testLoginAndOauthPermisson(self):
+ def testLoginAndOauthPermission(self):
"""Commons Query Service Login and Oauth permission."""
# Define the SPARQL query
query = 'SELECT ?a ?b WHERE { ?a wdt:P9478 ?b } LIMIT 4'
diff --git a/tests/superset_tests.py b/tests/superset_tests.py
index 6712c85..105f5b7 100755
--- a/tests/superset_tests.py
+++ b/tests/superset_tests.py
@@ -54,7 +54,7 @@
family = 'meta'
code = 'meta'
- def test_login_and_oauth_permisson(self):
+ def test_login_and_oauth_permission(self):
"""Superset login and queries."""
sql = 'SELECT page_id, page_title FROM page LIMIT 2;'
site = self.get_site()
diff --git a/tests/tools_tests.py b/tests/tools_tests.py
index bfcc5e5..2e483b1 100755
--- a/tests/tools_tests.py
+++ b/tests/tools_tests.py
@@ -99,7 +99,7 @@
"""Test open_archive with lzma compressor in the standard library."""
self.assertEqual(
self._get_content(self.base_file + '.lzma'), self.original_content)
- # Legacy LZMA container formet has no magic, skipping
+ # Legacy LZMA container format has no magic, skipping
# use_extension=False test here
self.assertEqual(
self._get_content(self.base_file + '.xz'), self.original_content)
@@ -1042,7 +1042,7 @@
self.assertEqual(self.foo.bar, 'bar')
self.assertEqual(self.foo.read, 1)
- def test_cached_with_paramters(self):
+ def test_cached_with_parameters(self):
"""Test for cached decorator with parameters."""
msg = '"cached" decorator must be used without arguments'
with self.assertRaisesRegex(TypeError, msg):
diff --git a/tests/upload_tests.py b/tests/upload_tests.py
index 8e90d05..524f29d 100755
--- a/tests/upload_tests.py
+++ b/tests/upload_tests.py
@@ -115,7 +115,7 @@
self._test_continue_filekey(1024)
@unittest.expectedFailure # T367321
- def test_sha1_missmatch(self):
+ def test_sha1_mismatch(self):
"""Test trying to continue with a different file."""
self._init_upload(1024)
with self.assertRaises(ValueError) as cm:
@@ -128,7 +128,7 @@
self._verify_stash()
@unittest.expectedFailure # T367316
- def test_offset_missmatch(self):
+ def test_offset_mismatch(self):
"""Test trying to continue with a different offset."""
self._init_upload(1024)
self._offset = 0
diff --git a/tests/version_tests.py b/tests/version_tests.py
index 6da5b5d..9cbdf01 100755
--- a/tests/version_tests.py
+++ b/tests/version_tests.py
@@ -18,7 +18,7 @@
class LocalVersionTestCase(TestCase):
- """Test local version infomation."""
+ """Test local version information."""
net = False
@@ -44,7 +44,7 @@
class RemoteVersionTestCase(TestCase):
- """Test remote version infomation."""
+ """Test remote version information."""
net = True
diff --git a/tests/wbtypes_tests.py b/tests/wbtypes_tests.py
index dff7846..1a83216 100755
--- a/tests/wbtypes_tests.py
+++ b/tests/wbtypes_tests.py
@@ -878,8 +878,8 @@
pywikibot.WbGeoShape('A string', self.get_repo())
def test_WbGeoShape_error_on_non_exitant_page(self):
- """Test WbGeoShape error handling of a non-existant page."""
- page = Page(self.commons, 'Non-existant page... really')
+ """Test WbGeoShape error handling of a non-existent page."""
+ page = Page(self.commons, 'Non-existent page... really')
regex = r'^Page \[\[.+?\]\] must exist\.$'
with self.assertRaisesRegex(ValueError, regex):
pywikibot.WbGeoShape(page, self.get_repo())
@@ -953,8 +953,8 @@
pywikibot.WbTabularData('A string', self.get_repo())
def test_WbTabularData_error_on_non_exitant_page(self):
- """Test WbTabularData error handling of a non-existant page."""
- page = Page(self.commons, 'Non-existant page... really')
+ """Test WbTabularData error handling of a non-existent page."""
+ page = Page(self.commons, 'Non-existent page... really')
regex = r'^Page \[\[.+?\]\] must exist\.$'
with self.assertRaisesRegex(ValueError, regex):
pywikibot.WbTabularData(page, self.get_repo())
diff --git a/tests/wikibase_edit_tests.py b/tests/wikibase_edit_tests.py
index aa1ef5e..9a52c31 100755
--- a/tests/wikibase_edit_tests.py
+++ b/tests/wikibase_edit_tests.py
@@ -2,7 +2,7 @@
"""Tests for editing Wikibase items.
Tests which should fail should instead be in the TestWikibaseSaveTest
-class in edit_failiure_tests.py
+class in edit_failure_tests.py
"""
#
# (C) Pywikibot team, 2014-2024
@@ -128,7 +128,7 @@
item.editEntity(data)
@unittest.expectedFailure # T367324
- def test_edit_entity_propogation(self):
+ def test_edit_entity_propagation(self):
"""Test that ``ItemPage.editEntity`` propagates changes to claims."""
testsite = self.get_repo()
item = pywikibot.ItemPage(testsite)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1101152?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I270f79e25fbcb8f7045f6a893305aa7a461c0c5e
Gerrit-Change-Number: 1101152
Gerrit-PatchSet: 5
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1101145?usp=email )
Change subject: IMPR: simplify site_detect.py
......................................................................
IMPR: simplify site_detect.py
decrease nested flow statements in MWSite.__init__()
Change-Id: I339e0c2a8c67505bc07ab7fe9a986607564189a4
---
M pywikibot/site_detect.py
1 file changed, 12 insertions(+), 11 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site_detect.py b/pywikibot/site_detect.py
index 728f9e2..8613f88 100644
--- a/pywikibot/site_detect.py
+++ b/pywikibot/site_detect.py
@@ -41,10 +41,11 @@
def __init__(self, fromurl, **kwargs) -> None:
"""Initializer.
- :raises pywikibot.exceptions.ServerError: a server error occurred
- while loading the site
+ :raises pywikibot.exceptions.ServerError: a server error
+ occurred while loading the site
:raises Timeout: a timeout occurred while loading the site
- :raises RuntimeError: Version not found or version less than 1.27
+ :raises RuntimeError: Version not found or version less than
+ 1.27
"""
fromurl = removesuffix(fromurl, '$1')
@@ -85,17 +86,17 @@
raise RuntimeError(f'Unsupported version: {self.version}')
if not self.articlepath:
- if self.private_wiki:
- if self.api != self.fromurl and self.private_wiki:
- self.articlepath = self.fromurl.rsplit('/', 1)[0] + '/$1'
- else:
- raise RuntimeError(
- 'Unable to determine articlepath because the wiki is '
- 'private. Use the Main Page URL instead of the API.')
- else:
+ if not self.private_wiki:
raise RuntimeError(
f'Unable to determine articlepath: {self.fromurl}')
+ if self.api == self.fromurl:
+ raise RuntimeError(
+ 'Unable to determine articlepath because the wiki is '
+ 'private. Use the Main Page URL instead of the API.')
+
+ self.articlepath = self.fromurl.rsplit('/', 1)[0] + '/$1'
+
def __repr__(self) -> str:
return f'{type(self).__name__}("{self.fromurl}")'
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1101145?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I339e0c2a8c67505bc07ab7fe9a986607564189a4
Gerrit-Change-Number: 1101145
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot