Skip to content

Commit 3c9748d

Browse files
committed
bpo-39366: Remove xpath() and xgtitle() methods of NNTP.
1 parent 45cf5db commit 3c9748d

File tree

4 files changed

+4
-65
lines changed

4 files changed

+4
-65
lines changed

Doc/library/nntplib.rst

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -542,33 +542,6 @@ them have been superseded by newer commands in :rfc:`3977`.
542542
if available.
543543

544544

545-
.. method:: NNTP.xpath(id)
546-
547-
Return a pair ``(resp, path)``, where *path* is the directory path to the
548-
article with message ID *id*. Most of the time, this extension is not
549-
enabled by NNTP server administrators.
550-
551-
.. deprecated:: 3.3
552-
The XPATH extension is not actively used.
553-
554-
555-
.. XXX deprecated:
556-
557-
.. method:: NNTP.xgtitle(name, *, file=None)
558-
559-
Process an ``XGTITLE`` command, returning a pair ``(response, list)``, where
560-
*list* is a list of tuples containing ``(name, title)``. If the *file* parameter
561-
is supplied, then the output of the ``XGTITLE`` command is stored in a file.
562-
If *file* is a string, then the method will open a file with that name, write
563-
to it then close it. If *file* is a :term:`file object`, then it will start
564-
calling :meth:`write` on it to store the lines of the command output. If *file*
565-
is supplied, then the returned *list* is an empty list. This is an optional NNTP
566-
extension, and may not be supported by all servers.
567-
568-
:rfc:`2980` says "It is suggested that this extension be deprecated". Use
569-
:meth:`descriptions` or :meth:`description` instead.
570-
571-
572545
Utility functions
573546
-----------------
574547

Doc/whatsnew/3.9.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ Deprecated
352352

353353
Removed
354354
=======
355+
* :class:`nntplib.NNTP`: ``xpath()`` and ``xgtitle()`` methods have been removed.
356+
Deprecated since Python 3.3. (Contributed by Dong-hee Na in :issue:`39366`.)
355357

356358
* :class:`array.array`: ``tostring()`` and ``fromstring()`` methods have been
357359
removed. They were aliases to ``tobytes()`` and ``frombytes()``, deprecated

Lib/nntplib.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -834,44 +834,6 @@ def over(self, message_spec, *, file=None):
834834
fmt = self._getoverviewfmt()
835835
return resp, _parse_overview(lines, fmt)
836836

837-
def xgtitle(self, group, *, file=None):
838-
"""Process an XGTITLE command (optional server extension) Arguments:
839-
- group: group name wildcard (i.e. news.*)
840-
Returns:
841-
- resp: server response if successful
842-
- list: list of (name,title) strings"""
843-
warnings.warn("The XGTITLE extension is not actively used, "
844-
"use descriptions() instead",
845-
DeprecationWarning, 2)
846-
line_pat = re.compile('^([^ \t]+)[ \t]+(.*)$')
847-
resp, raw_lines = self._longcmdstring('XGTITLE ' + group, file)
848-
lines = []
849-
for raw_line in raw_lines:
850-
match = line_pat.search(raw_line.strip())
851-
if match:
852-
lines.append(match.group(1, 2))
853-
return resp, lines
854-
855-
def xpath(self, id):
856-
"""Process an XPATH command (optional server extension) Arguments:
857-
- id: Message id of article
858-
Returns:
859-
resp: server response if successful
860-
path: directory path to article
861-
"""
862-
warnings.warn("The XPATH extension is not actively used",
863-
DeprecationWarning, 2)
864-
865-
resp = self._shortcmd('XPATH {0}'.format(id))
866-
if not resp.startswith('223'):
867-
raise NNTPReplyError(resp)
868-
try:
869-
[resp_num, path] = resp.split()
870-
except ValueError:
871-
raise NNTPReplyError(resp) from None
872-
else:
873-
return resp, path
874-
875837
def date(self):
876838
"""Process the DATE command.
877839
Returns:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:class:`nntplib.NNTP`: ``xpath()`` and ``xgtitle()`` methods have been
2+
removed.

0 commit comments

Comments
 (0)