jenkins-bot submitted this change.

View Change


Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[cleanup] remove deprecated code

Change-Id: I8300508be0c50cd1fac184b19908e3bd34aaf51c
---
M pywikibot/__init__.py
M pywikibot/bot_choice.py
M ROADMAP.rst
M pywikibot/tools/itertools.py
M pywikibot/page/__init__.py
M pywikibot/tools/formatter.py
6 files changed, 23 insertions(+), 100 deletions(-)

diff --git a/ROADMAP.rst b/ROADMAP.rst
index fc1f35a..c95ddc6 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -14,6 +14,13 @@
Breaking changes and code cleanups
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

+* *output* OutputOption without *out* property is no longer supported with :class:`pywikibot.OutputProxyOption`
+* ``OutputOption.output()`` method was removed
+* ``ContextOption.output_range()`` and ``HighlightContextOption.output_range()`` methods were removed
+* ``page.url2unicode()`` function was removed in favour of :func:`tools.chars.url2string`
+* *iterables* of :func:`tools.itertools.intersect_generators` must not be given as a single list or tuple;
+ either consecutive iterables must be used or '*' to unpack
+* *allow_duplicates* parameter of :func:`tools.itertools.intersect_generators` must be given as keyword argument
* Infinite rotating file handler with ``config.logfilesize`` of -1 is no longer supported
* ``Throttle.multiplydelay`` attribute was removed
* Python 3.6 support was dropped (:phab:`T347026`
@@ -69,12 +76,6 @@
Will be removed in Pywikibot 9
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

-* 6.5.0: OutputOption.output() method will be removed in favour of OutputOption.out property
-* 6.4.0: 'allow_duplicates' parameter of :func:`tools.itertools.intersect_generators` as positional argument is deprecated, use keyword argument instead
-* 6.4.0: 'iterables' of :func:`tools.itertools.intersect_generators` given as a list or tuple is deprecated, either use consecutive iterables or use '*' to unpack
-* 6.2.0: outputter of OutputProxyOption without out property is deprecated
-* 6.2.0: ContextOption.output_range() and HighlightContextOption.output_range() are deprecated
* 6.2.0: Error messages with '%' style is deprecated in favour for str.format() style
-* 6.2.0: page.url2unicode() function is deprecated in favour of tools.chars.url2string()
* 6.2.0: SequenceOutputter.format_list() is deprecated in favour of 'out' property
* 6.0.0: config.register_family_file() is deprecated
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 6781927..93778ab 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -87,8 +87,8 @@
'LexemeSense', 'Link', 'log', 'MediaInfo', 'output', 'Page',
'page_put_queue', 'PropertyPage', 'showDiff', 'show_help', 'Site',
'SiteLink', 'sleep', 'stdout', 'stopme', 'Timestamp', 'translate', 'ui',
- 'url2unicode', 'User', 'warning', 'WbGeoShape', 'WbMonolingualText',
- 'WbQuantity', 'WbTabularData', 'WbTime', 'WbUnknown', 'WikidataBot',
+ 'User', 'warning', 'WbGeoShape', 'WbMonolingualText', 'WbQuantity',
+ 'WbTabularData', 'WbTime', 'WbUnknown', 'WikidataBot',
)

# argvu is set by pywikibot.bot when it's imported
@@ -278,7 +278,6 @@
SiteLink,
User,
html2unicode,
- url2unicode,
)


diff --git a/pywikibot/bot_choice.py b/pywikibot/bot_choice.py
index 882f2b1..cc79ef8 100644
--- a/pywikibot/bot_choice.py
+++ b/pywikibot/bot_choice.py
@@ -13,7 +13,6 @@

import pywikibot
from pywikibot.backports import Iterable, Sequence
-from pywikibot.tools import deprecated, issue_deprecation_warning


class Option(ABC):
@@ -135,17 +134,6 @@
"""
return ''

- @deprecated('pywikibot.info(OutputOption.out)', since='6.5')
- def output(self) -> None:
- """Output string.
-
- .. deprecated:: 6.5
- This method was replaced by :attr:`out` property and is no
- no longer used by the
- :py:mod:`userinterfaces <pywikibot.userinterfaces>` system.
- """
- pywikibot.info(self.out)
-

class StandardOption(Option):

@@ -197,12 +185,6 @@
@property
def out(self) -> str:
"""Return the contents."""
- if not hasattr(self._outputter, 'out'): # pragma: no cover
- issue_deprecation_warning('{} without "out" property'
- .format(self.__class__.__name__),
- since='6.2.0')
- self._outputter.output()
- return ''
return self._outputter.out


@@ -268,11 +250,6 @@
end = min(len(self.text), self.end + self.context)
return self.text[start:end]

- @deprecated('pywikibot.info(ContextOption.out)', since='6.2.0')
- def output_range(self, start: int, end: int) -> None:
- """DEPRECATED. Output a section from the text."""
- pywikibot.info(self.text[start:end])
-

class Choice(StandardOption):

@@ -598,20 +575,6 @@
self.text[self.end:end],
color=self.color)

- @deprecated('pywikibot.info(HighlightContextOption.out)', since='6.2.0')
- def output_range(self, start: int, end: int) -> None:
- """Show normal context with a highlighted center region.
-
- .. deprecated:: 6.2
- use :attr:`out` instead.
- """
- text = '{}<<{color}>>{}<<default>>{}'.format(
- self.text[start:self.start],
- self.text[self.start:self.end],
- self.text[self.end:end],
- color=self.color)
- pywikibot.info(text)
-

class UnhandledAnswer(Exception): # noqa: N818

diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index 33fe142c..f5191b5 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -28,8 +28,6 @@
WikibasePage,
)
from pywikibot.site import BaseSite as _BaseSite
-from pywikibot.tools import deprecated, issue_deprecation_warning
-from pywikibot.tools.chars import url2string as _url2string


__all__ = (
@@ -54,7 +52,6 @@
'MediaInfo',
'Revision',
'html2unicode',
- 'url2unicode',
)

PageSourceType = Union[
@@ -62,31 +59,3 @@
_BaseSite,
Page,
]
-
-
-@deprecated('pywikibot.tools.chars.url2string', since='6.2.0')
-def url2unicode(title: str, encodings='utf-8') -> str:
- """Convert URL-encoded text to unicode using several encoding.
-
- Uses the first encoding that doesn't cause an error.
-
- .. deprecated:: 6.2
- Use :func:`tools.chars.url2string` instead.
-
- :param title: URL-encoded character data to convert
- :param encodings: Encodings to attempt to use during conversion.
- :type encodings: str, list or Site
-
- :raise UnicodeError: Could not convert using any encoding.
- """
- if isinstance(encodings, _BaseSite):
- # use all possible encodings from Site object
- encodings = encodings.encodings()
- issue_deprecation_warning(
- 'Passing BaseSite object to encodings parameter',
- 'BaseSite.encodings()',
- depth=1,
- since='6.2.0'
- )
-
- return _url2string(title, encodings)
diff --git a/pywikibot/tools/formatter.py b/pywikibot/tools/formatter.py
index 548d72e..7008347 100644
--- a/pywikibot/tools/formatter.py
+++ b/pywikibot/tools/formatter.py
@@ -42,11 +42,6 @@
super().__init__()
self.sequence = sequence

- @deprecated('out', since='6.2.0')
- def format_list(self):
- """DEPRECATED: Create the text with one item on each line."""
- return self.out
-
@property
def out(self):
"""Create the text with one item on each line."""
diff --git a/pywikibot/tools/itertools.py b/pywikibot/tools/itertools.py
index 36bf588..e3679bb 100644
--- a/pywikibot/tools/itertools.py
+++ b/pywikibot/tools/itertools.py
@@ -18,7 +18,7 @@

from pywikibot.backports import Generator, batched
from pywikibot.logging import debug
-from pywikibot.tools import deprecated, issue_deprecation_warning
+from pywikibot.tools import deprecated


__all__ = (
@@ -124,31 +124,18 @@

.. deprecated:: 6.4
``allow_duplicates`` as positional argument,
- ``iterables`` as list type
+ ``iterables`` as list or tuple type

.. versionchanged:: 7.0
Reimplemented without threads which is up to 10'000 times faster

+ .. versionchanged:: 9.0
+ Iterable elements may consist of lists or tuples
+
:param iterables: page generators
:param allow_duplicates: optional keyword argument to allow duplicates
if present in all generators
"""
- # 'allow_duplicates' must be given as keyword argument
- if iterables and iterables[-1] in (True, False):
- allow_duplicates = iterables[-1]
- iterables = iterables[:-1]
- issue_deprecation_warning("'allow_duplicates' as positional argument",
- 'keyword argument "allow_duplicates={}"'
- .format(allow_duplicates),
- since='6.4.0')
-
- # iterables must not be given as tuple or list
- if len(iterables) == 1 and isinstance(iterables[0], (list, tuple)):
- iterables = iterables[0]
- issue_deprecation_warning("'iterables' as list type",
- "consecutive iterables or use '*' to unpack",
- since='6.4.0')
-
if not iterables:
return


To view, visit change 980822. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I8300508be0c50cd1fac184b19908e3bd34aaf51c
Gerrit-Change-Number: 980822
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged