Skip to content

Commit 8e1f26e

Browse files
verhovskymiss-islington
authored andcommitted
Minor doc fixes in urllib.parse (GH-17745)
1 parent d0c92e8 commit 8e1f26e

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

Doc/library/urllib.parse.rst

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ or on combining URL components into a URL string.
4242
Parse a URL into six components, returning a 6-item :term:`named tuple`. This
4343
corresponds to the general structure of a URL:
4444
``scheme://netloc/path;parameters?query#fragment``.
45-
Each tuple item is a string, possibly empty. The components are not broken up in
46-
smaller parts (for example, the network location is a single string), and %
45+
Each tuple item is a string, possibly empty. The components are not broken up
46+
into smaller parts (for example, the network location is a single string), and %
4747
escapes are not expanded. The delimiters as shown above are not part of the
4848
result, except for a leading slash in the *path* component, which is retained if
4949
present. For example:
@@ -328,22 +328,22 @@ or on combining URL components into a URL string.
328328

329329
.. note::
330330

331-
If *url* is an absolute URL (that is, starting with ``//`` or ``scheme://``),
332-
the *url*'s host name and/or scheme will be present in the result. For example:
331+
If *url* is an absolute URL (that is, it starts with ``//`` or ``scheme://``),
332+
the *url*'s hostname and/or scheme will be present in the result. For example:
333333

334-
.. doctest::
334+
.. doctest::
335335

336-
>>> urljoin('http://www.cwi.nl/%7Eguido/Python.html',
337-
... '//www.python.org/%7Eguido')
338-
'http://www.python.org/%7Eguido'
336+
>>> urljoin('http://www.cwi.nl/%7Eguido/Python.html',
337+
... '//www.python.org/%7Eguido')
338+
'http://www.python.org/%7Eguido'
339339

340-
If you do not want that behavior, preprocess the *url* with :func:`urlsplit` and
341-
:func:`urlunsplit`, removing possible *scheme* and *netloc* parts.
340+
If you do not want that behavior, preprocess the *url* with :func:`urlsplit` and
341+
:func:`urlunsplit`, removing possible *scheme* and *netloc* parts.
342342

343343

344344
.. versionchanged:: 3.5
345345

346-
Behaviour updated to match the semantics defined in :rfc:`3986`.
346+
Behavior updated to match the semantics defined in :rfc:`3986`.
347347

348348

349349
.. function:: urldefrag(url)
@@ -521,11 +521,11 @@ task isn't already covered by the URL parsing functions above.
521521

522522
Replace special characters in *string* using the ``%xx`` escape. Letters,
523523
digits, and the characters ``'_.-~'`` are never quoted. By default, this
524-
function is intended for quoting the path section of URL. The optional *safe*
525-
parameter specifies additional ASCII characters that should not be quoted
526-
--- its default value is ``'/'``.
524+
function is intended for quoting the path section of a URL. The optional
525+
*safe* parameter specifies additional ASCII characters that should not be
526+
quoted --- its default value is ``'/'``.
527527

528-
*string* may be either a :class:`str` or a :class:`bytes`.
528+
*string* may be either a :class:`str` or a :class:`bytes` object.
529529

530530
.. versionchanged:: 3.7
531531
Moved from :rfc:`2396` to :rfc:`3986` for quoting URL strings. "~" is now
@@ -547,7 +547,7 @@ task isn't already covered by the URL parsing functions above.
547547

548548
.. function:: quote_plus(string, safe='', encoding=None, errors=None)
549549

550-
Like :func:`quote`, but also replace spaces by plus signs, as required for
550+
Like :func:`quote`, but also replace spaces with plus signs, as required for
551551
quoting HTML form values when building up a query string to go into a URL.
552552
Plus signs in the original string are escaped unless they are included in
553553
*safe*. It also does not have *safe* default to ``'/'``.
@@ -566,12 +566,12 @@ task isn't already covered by the URL parsing functions above.
566566

567567
.. function:: unquote(string, encoding='utf-8', errors='replace')
568568

569-
Replace ``%xx`` escapes by their single-character equivalent.
569+
Replace ``%xx`` escapes with their single-character equivalent.
570570
The optional *encoding* and *errors* parameters specify how to decode
571571
percent-encoded sequences into Unicode characters, as accepted by the
572572
:meth:`bytes.decode` method.
573573

574-
*string* may be either a :class:`str` or a :class:`bytes`.
574+
*string* may be either a :class:`str` or a :class:`bytes` object.
575575

576576
*encoding* defaults to ``'utf-8'``.
577577
*errors* defaults to ``'replace'``, meaning invalid sequences are replaced
@@ -587,8 +587,8 @@ task isn't already covered by the URL parsing functions above.
587587

588588
.. function:: unquote_plus(string, encoding='utf-8', errors='replace')
589589

590-
Like :func:`unquote`, but also replace plus signs by spaces, as required for
591-
unquoting HTML form values.
590+
Like :func:`unquote`, but also replace plus signs with spaces, as required
591+
for unquoting HTML form values.
592592

593593
*string* must be a :class:`str`.
594594

@@ -597,10 +597,10 @@ task isn't already covered by the URL parsing functions above.
597597

598598
.. function:: unquote_to_bytes(string)
599599

600-
Replace ``%xx`` escapes by their single-octet equivalent, and return a
600+
Replace ``%xx`` escapes with their single-octet equivalent, and return a
601601
:class:`bytes` object.
602602

603-
*string* may be either a :class:`str` or a :class:`bytes`.
603+
*string* may be either a :class:`str` or a :class:`bytes` object.
604604

605605
If it is a :class:`str`, unescaped non-ASCII characters in *string*
606606
are encoded into UTF-8 bytes.
@@ -631,7 +631,7 @@ task isn't already covered by the URL parsing functions above.
631631
When a sequence of two-element tuples is used as the *query*
632632
argument, the first element of each tuple is a key and the second is a
633633
value. The value element in itself can be a sequence and in that case, if
634-
the optional parameter *doseq* is evaluates to ``True``, individual
634+
the optional parameter *doseq* evaluates to ``True``, individual
635635
``key=value`` pairs separated by ``'&'`` are generated for each element of
636636
the value sequence for the key. The order of parameters in the encoded
637637
string will match the order of parameter tuples in the sequence.
@@ -643,11 +643,12 @@ task isn't already covered by the URL parsing functions above.
643643
To reverse this encoding process, :func:`parse_qs` and :func:`parse_qsl` are
644644
provided in this module to parse query strings into Python data structures.
645645

646-
Refer to :ref:`urllib examples <urllib-examples>` to find out how urlencode
647-
method can be used for generating query string for a URL or data for POST.
646+
Refer to :ref:`urllib examples <urllib-examples>` to find out how the
647+
:func:`urllib.parse.urlencode` method can be used for generating the query
648+
string of a URL or data for a POST request.
648649

649650
.. versionchanged:: 3.2
650-
Query parameter supports bytes and string objects.
651+
*query* supports bytes and string objects.
651652

652653
.. versionadded:: 3.5
653654
*quote_via* parameter.

0 commit comments

Comments
 (0)