Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944929 )
Change subject: [doc] Adjust documentation length
......................................................................
[doc] Adjust documentation length
Change-Id: Ia0e9c33c943f3e96849d2168ea2193ef7fe17b5a
---
M pywikibot/tools/__init__.py
M tests/tools_tests.py
2 files changed, 61 insertions(+), 47 deletions(-)
Approvals:
Xqt: Verified; Looks good to me, approved
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index a2a7802..1661611 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -164,8 +164,8 @@
"""A decorator/context manager that temporarily suppresses warnings.
- Those suppressed warnings that do not match the parameters will be raised
- shown upon exit.
+ Those suppressed warnings that do not match the parameters will be
+ raised shown upon exit.
.. versionadded:: 3.0
"""
@@ -181,13 +181,14 @@
The parameter semantics are similar to those of
`warnings.filterwarnings`.
- :param message: A string containing a regular expression that the start
- of the warning message must match. (case-insensitive)
- :param category: A class (a subclass of Warning) of which the warning
- category must be a subclass in order to match.
+ :param message: A string containing a regular expression that
+ the start of the warning message must match.
+ (case-insensitive)
+ :param category: A class (a subclass of Warning) of which the
+ warning category must be a subclass in order to match.
:type category: type
- :param filename: A string containing a regular expression that the
- start of the path to the warning module must match.
+ :param filename: A string containing a regular expression that
+ the start of the path to the warning module must match.
(case-sensitive)
"""
self.message_match = re.compile(message, re.I).match
@@ -424,16 +425,16 @@
"""
Version object to allow comparing 'wmf' versions with normal ones.
- The version mainly consist of digits separated by periods. After that is a
- suffix which may only be 'wmf<number>', 'alpha', 'beta<number>' or
- '-rc.<number>' (the - and . are optional). They are considered from old to
- new in that order with a version number without suffix is considered the
- newest. This secondary difference is stored in an internal _dev_version
- attribute.
+ The version mainly consist of digits separated by periods. After
+ that is a suffix which may only be 'wmf<number>', 'alpha',
+ 'beta<number>' or '-rc.<number>' (the - and . are optional). They
+ are considered from old to new in that order with a version number
+ without suffix is considered the newest. This secondary difference
+ is stored in an internal _dev_version attribute.
- Two versions are equal if their normal version and dev version are equal. A
- version is greater if the normal version or dev version is greater. For
- example::
+ Two versions are equal if their normal version and dev version are
+ equal. A version is greater if the normal version or dev version is
+ greater. For example::
1.34 < 1.34.1 < 1.35wmf1 < 1.35alpha < 1.35beta1 < 1.35beta2
< 1.35-rc-1 < 1.35-rc.2 < 1.35
@@ -533,8 +534,8 @@
"""
Return self when called.
- When '_own_desc' is defined it'll also issue a deprecation warning using
- issue_deprecation_warning('Calling ' + _own_desc, 'it directly').
+ When '_own_desc' is defined it'll also issue a deprecation warning
+ using issue_deprecation_warning('Calling ' + _own_desc, 'it directly').
.. versionadded:: 3.0
.. deprecated:: 6.2
@@ -570,33 +571,37 @@
"""
Open a file and uncompress it if needed.
- This function supports bzip2, gzip, 7zip, lzma, and xz as compression
- containers. It uses the packages available in the standard library for
- bzip2, gzip, lzma, and xz so they are always available. 7zip is only
- available when a 7za program is available and only supports reading
- from it.
+ This function supports bzip2, gzip, 7zip, lzma, and xz as
+ compression containers. It uses the packages available in the
+ standard library for bzip2, gzip, lzma, and xz so they are always
+ available. 7zip is only available when a 7za program is available
+ and only supports reading from it.
- The compression is either selected via the magic number or file ending.
+ The compression is either selected via the magic number or file
+ ending.
.. versionadded:: 3.0
:param filename: The filename.
- :param use_extension: Use the file extension instead of the magic number
- to determine the type of compression (default True). Must be True when
- writing or appending.
- :param mode: The mode in which the file should be opened. It may either be
- 'r', 'rb', 'a', 'ab', 'w' or 'wb'. All modes open the file in binary
- mode. It defaults to 'rb'.
+ :param use_extension: Use the file extension instead of the magic
+ number to determine the type of compression (default True). Must
+ be True when writing or appending.
+ :param mode: The mode in which the file should be opened. It may
+ either be 'r', 'rb', 'a', 'ab', 'w' or 'wb'. All modes open the
+ file in binary mode. It defaults to 'rb'.
:raises ValueError: When 7za is not available or the opening mode is
unknown or it tries to write a 7z archive.
- :raises FileNotFoundError: When the filename doesn't exist and it tries
- to read from it or it tries to determine the compression algorithm.
- :raises OSError: When it's not a 7z archive but the file extension is 7z.
- It is also raised by bz2 when its content is invalid. gzip does not
- immediately raise that error but only on reading it.
+ :raises FileNotFoundError: When the filename doesn't exist and it
+ tries to read from it or it tries to determine the compression
+ algorithm.
+ :raises OSError: When it's not a 7z archive but the file extension
+ is 7z. It is also raised by bz2 when its content is invalid.
+ gzip does not immediately raise that error but only on reading
+ it.
:raises lzma.LZMAError: When error occurs during compression or
decompression or when initializing the state with lzma or xz.
- :return: A file-like object returning the uncompressed data in binary mode.
+ :return: A file-like object returning the uncompressed data in
+ binary mode.
:rtype: file-like object
"""
# extension_map maps magic_number to extension.
@@ -671,8 +676,9 @@
"""
Return a merged dict and make sure that the original dicts keys are unique.
- The positional arguments are the dictionaries to be merged. It is also
- possible to define an additional dict using the keyword arguments.
+ The positional arguments are the dictionaries to be merged. It is
+ also possible to define an additional dict using the keyword
+ arguments.
.. versionadded:: 3.0
"""
diff --git a/tests/tools_tests.py b/tests/tools_tests.py
index 15471ac..8da9e24 100755
--- a/tests/tools_tests.py
+++ b/tests/tools_tests.py
@@ -37,13 +37,12 @@
class OpenArchiveTestCase(TestCase):
- """
- Unit test class for tools.
+ """Unit test class for tools.
- The tests for open_archive requires that article-pyrus.xml* contain all
- the same content after extraction. The content itself is not important.
- The file article-pyrus.xml_invalid.7z is not a valid 7z file and
- open_archive will fail extracting it using 7za.
+ The tests for open_archive requires that article-pyrus.xml* contain
+ all the same content after extraction. The content itself is not
+ important. The file article-pyrus.xml_invalid.7z is not a valid 7z
+ file and open_archive will fail extracting it using 7za.
"""
net = False
@@ -610,8 +609,8 @@
r"""Test calculator of sha of a file.
- There are two possible hash values for each test. The second one is for
- files with Windows line endings (\r\n).
+ There are two possible hash values for each test. The second one is
+ for files with Windows line endings (\r\n).
"""
net = False
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944929
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: Ia0e9c33c943f3e96849d2168ea2193ef7fe17b5a
Gerrit-Change-Number: 944929
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944842 )
Change subject: [doc] Show a warning for Pillow dependency of gui module
......................................................................
[doc] Show a warning for Pillow dependency of gui module
Bug: T341198
Change-Id: I6bf4cfa65f33e91d1754d663e57208d34bab012a
---
M pywikibot/editor.py
M pywikibot/userinterfaces/gui.py
2 files changed, 28 insertions(+), 8 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/editor.py b/pywikibot/editor.py
index 9a20282..f3b47ee 100644
--- a/pywikibot/editor.py
+++ b/pywikibot/editor.py
@@ -1,6 +1,10 @@
-"""Text editor class for your favourite editor."""
+"""Text editor class for your favourite editor.
+
+.. note:: This module uses :mod:`userinterfaces.gui` and has depedencies
+ from other partially external modules.
+"""
#
-# (C) Pywikibot team, 2004-2022
+# (C) Pywikibot team, 2004-2023
#
# Distributed under the terms of the MIT license.
#
diff --git a/pywikibot/userinterfaces/gui.py b/pywikibot/userinterfaces/gui.py
index 22b2e7a..1eff547 100644
--- a/pywikibot/userinterfaces/gui.py
+++ b/pywikibot/userinterfaces/gui.py
@@ -2,7 +2,15 @@
Useful for editing the contents of an article.
-.. note:: idlelib and tkinter modules are required
+.. note:: idlelib, tkinter and pillow modules are required.
+
+.. warning::
+ With Pillow 10 no wheels for 32-bit Python on Windows are supported.
+ This was made for Python 3.12 compatibility. Either you have to
+ update your Python using a 64-bit version or you have to
+ :command:`pip install "pillow < 10.0.0"`.
+
+.. seealso:: :mod:`editor`
"""
#
# (C) Pywikibot team, 2003-2023
@@ -46,14 +54,12 @@
"""A text widget with some editing enhancements.
- A lot of code here is copied or adapted from the idlelib/EditorWindow.py
- file in the standard Python distribution.
-
+ A lot of code here is copied or adapted from the
+ idlelib/EditorWindow.py file in the standard Python distribution.
"""
def __init__(self, master=None, **kwargs) -> None:
- """
- Initializer.
+ """Initializer.
Get default settings from user's IDLE configuration.
"""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944842
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: I6bf4cfa65f33e91d1754d663e57208d34bab012a
Gerrit-Change-Number: 944842
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged