Skip to content

Commit 3945666

Browse files
harjothkharaclaude
andcommitted
gh-151945: Address review — sentence-case headers, plain language, markup
Apply Hugo's review feedback for Doc/library/http.cookiejar.rst: - Use sentence case for the four "... Objects" section headers. - Replace the Latin abbreviations "ie."/"eg." with "that is"/"for example" per the devguide simple-language guidance. - Use ``None`` literal markup instead of :const:`None`. - Reference the removed method as :meth:`!get_origin_req_host` to match the surrounding formatting. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent eecbef2 commit 3945666

1 file changed

Lines changed: 34 additions & 34 deletions

File tree

Doc/library/http.cookiejar.rst

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ introduced with RFC 2965.
2626
.. note::
2727

2828
The various named parameters found in :mailheader:`Set-Cookie` and
29-
:mailheader:`Set-Cookie2` headers (eg. ``domain`` and ``expires``) are
30-
conventionally referred to as :dfn:`attributes`. To distinguish them from
31-
Python attributes, the documentation for this module uses the term
29+
:mailheader:`Set-Cookie2` headers (for example, ``domain`` and ``expires``)
30+
are conventionally referred to as :dfn:`attributes`. To distinguish them
31+
from Python attributes, the documentation for this module uses the term
3232
:dfn:`cookie-attribute` instead.
3333

3434

@@ -85,15 +85,15 @@ The following classes are provided:
8585

8686
Constructor arguments should be passed as keyword arguments only.
8787
*blocked_domains* is a sequence of domain names that we never accept cookies
88-
from, nor return cookies to. *allowed_domains* if not :const:`None`, this is a
88+
from, nor return cookies to. *allowed_domains* if not ``None``, this is a
8989
sequence of the only domains for which we accept and return cookies.
9090
*secure_protocols* is a sequence of protocols for which secure cookies can be
9191
added to. By default *https* and *wss* (secure websocket) are considered
9292
secure protocols. For all other arguments, see the documentation for
9393
:class:`CookiePolicy` and :class:`DefaultCookiePolicy` objects.
9494

9595
:class:`DefaultCookiePolicy` implements the standard accept / reject rules for
96-
Netscape and :rfc:`2965` cookies. By default, :rfc:`2109` cookies (ie. cookies
96+
Netscape and :rfc:`2965` cookies. By default, :rfc:`2109` cookies (that is, cookies
9797
received in a :mailheader:`Set-Cookie` header with a version cookie-attribute of
9898
1) are treated according to the RFC 2965 rules. However, if RFC 2965 handling
9999
is turned off or :attr:`rfc2109_as_netscape` is ``True``, RFC 2109 cookies are
@@ -141,7 +141,7 @@ The following classes are provided:
141141

142142
.. _cookie-jar-objects:
143143

144-
CookieJar and FileCookieJar Objects
144+
CookieJar and FileCookieJar objects
145145
-----------------------------------
146146

147147
:class:`CookieJar` objects support the :term:`iterator` protocol for iterating over
@@ -154,7 +154,7 @@ contained :class:`Cookie` objects.
154154

155155
Add correct :mailheader:`Cookie` header to *request*.
156156

157-
If policy allows (ie. the :attr:`~CookiePolicy.rfc2965` and
157+
If policy allows (that is, the :attr:`~CookiePolicy.rfc2965` and
158158
:attr:`~CookiePolicy.hide_cookie2` attributes of
159159
the :class:`CookieJar`'s :class:`CookiePolicy` instance are true and false
160160
respectively), the :mailheader:`Cookie2` header is also added when appropriate.
@@ -173,8 +173,8 @@ contained :class:`Cookie` objects.
173173
.. versionchanged:: 3.3
174174

175175
*request* object needs :attr:`~urllib.request.Request.origin_req_host`
176-
attribute. Dependency on a deprecated method ``get_origin_req_host`` has
177-
been removed.
176+
attribute. Dependency on a deprecated method
177+
:meth:`!get_origin_req_host` has been removed.
178178

179179

180180
.. method:: CookieJar.extract_cookies(response, request)
@@ -203,8 +203,8 @@ contained :class:`Cookie` objects.
203203
.. versionchanged:: 3.3
204204

205205
*request* object needs :attr:`~urllib.request.Request.origin_req_host`
206-
attribute. Dependency on a deprecated method ``get_origin_req_host`` has
207-
been removed.
206+
attribute. Dependency on a deprecated method
207+
:meth:`!get_origin_req_host` has been removed.
208208

209209
.. method:: CookieJar.set_policy(policy)
210210

@@ -268,7 +268,7 @@ contained :class:`Cookie` objects.
268268
*filename* is the name of file in which to save cookies. If *filename* is not
269269
specified, :attr:`~FileCookieJar.filename` is used (whose default is the
270270
value passed to the constructor, if any); if
271-
:attr:`~FileCookieJar.filename` is :const:`None`,
271+
:attr:`~FileCookieJar.filename` is ``None``,
272272
:exc:`ValueError` is raised.
273273

274274
*ignore_discard*: save even cookies set to be discarded. *ignore_expires*: save
@@ -361,7 +361,7 @@ writing.
361361

362362
.. _cookie-policy-objects:
363363

364-
CookiePolicy Objects
364+
CookiePolicy objects
365365
--------------------
366366

367367
Objects implementing the :class:`CookiePolicy` interface have the following
@@ -445,7 +445,7 @@ setting and receiving any and all cookies (this is unlikely to be useful).
445445

446446
.. _default-cookie-policy-objects:
447447

448-
DefaultCookiePolicy Objects
448+
DefaultCookiePolicy objects
449449
---------------------------
450450

451451
Implements the standard rules for accepting and returning cookies.
@@ -479,7 +479,7 @@ constructor argument, and :meth:`~DefaultCookiePolicy.blocked_domains` and
479479
:meth:`~DefaultCookiePolicy.set_blocked_domains` methods (and the corresponding
480480
argument and methods for *allowed_domains*). If you set an allowlist, you can
481481
turn it off again by
482-
setting it to :const:`None`.
482+
setting it to ``None``.
483483

484484
Domains in block or allow lists that do not start with a dot must equal the
485485
cookie domain to be matched. For example, ``"example.com"`` matches a blocklist
@@ -511,12 +511,12 @@ and ``".168.1.2"``, 192.168.1.2 is blocked, but 193.168.1.2 is not.
511511

512512
.. method:: DefaultCookiePolicy.allowed_domains()
513513

514-
Return :const:`None`, or the sequence of allowed domains (as a tuple).
514+
Return ``None``, or the sequence of allowed domains (as a tuple).
515515

516516

517517
.. method:: DefaultCookiePolicy.set_allowed_domains(allowed_domains)
518518

519-
Set the sequence of allowed domains, or :const:`None`.
519+
Set the sequence of allowed domains, or ``None``.
520520

521521

522522
.. method:: DefaultCookiePolicy.is_not_allowed(domain)
@@ -532,9 +532,9 @@ all be assigned to.
532532
.. attribute:: DefaultCookiePolicy.rfc2109_as_netscape
533533

534534
If true, request that the :class:`CookieJar` instance downgrade :rfc:`2109` cookies
535-
(ie. cookies received in a :mailheader:`Set-Cookie` header with a version
535+
(that is, cookies received in a :mailheader:`Set-Cookie` header with a version
536536
cookie-attribute of 1) to Netscape cookies by setting the version attribute of
537-
the :class:`Cookie` instance to 0. The default value is :const:`None`, in which
537+
the :class:`Cookie` instance to 0. The default value is ``None``, in which
538538
case RFC 2109 cookies are downgraded if and only if :rfc:`2965` handling is turned
539539
off. Therefore, RFC 2109 cookies are downgraded by default.
540540

@@ -587,17 +587,17 @@ both flags are set).
587587

588588
.. attribute:: DefaultCookiePolicy.DomainStrictNoDots
589589

590-
When setting cookies, the 'host prefix' must not contain a dot (eg.
590+
When setting cookies, the 'host prefix' must not contain a dot (for example,
591591
``www.foo.bar.com`` can't set a cookie for ``.bar.com``, because ``www.foo``
592592
contains a dot).
593593

594594

595595
.. attribute:: DefaultCookiePolicy.DomainStrictNonDomain
596596

597597
Cookies that did not explicitly specify a ``domain`` cookie-attribute can only
598-
be returned to a domain equal to the domain that set the cookie (eg.
599-
``spam.example.com`` won't be returned cookies from ``example.com`` that had no
600-
``domain`` cookie-attribute).
598+
be returned to a domain equal to the domain that set the cookie (for example,
599+
``spam.example.com`` won't be returned cookies from ``example.com`` that had
600+
no ``domain`` cookie-attribute).
601601

602602

603603
.. attribute:: DefaultCookiePolicy.DomainRFC2965Match
@@ -610,7 +610,7 @@ combinations of the above flags:
610610

611611
.. attribute:: DefaultCookiePolicy.DomainLiberal
612612

613-
Equivalent to 0 (ie. all of the above Netscape domain strictness flags switched
613+
Equivalent to 0 (that is, all of the above Netscape domain strictness flags switched
614614
off).
615615

616616

@@ -619,7 +619,7 @@ combinations of the above flags:
619619
Equivalent to ``DomainStrictNoDots|DomainStrictNonDomain``.
620620

621621

622-
Cookie Objects
622+
Cookie objects
623623
--------------
624624

625625
:class:`Cookie` instances have Python attributes roughly corresponding to the
@@ -637,7 +637,7 @@ internal consistency, so you should know what you're doing if you do that.
637637

638638
.. attribute:: Cookie.version
639639

640-
Integer or :const:`None`. Netscape cookies have :attr:`version` 0. :rfc:`2965` and
640+
Integer or ``None``. Netscape cookies have :attr:`version` 0. :rfc:`2965` and
641641
:rfc:`2109` cookies have a ``version`` cookie-attribute of 1. However, note that
642642
:mod:`!http.cookiejar` may 'downgrade' RFC 2109 cookies to Netscape cookies, in which
643643
case :attr:`version` is 0.
@@ -650,13 +650,13 @@ internal consistency, so you should know what you're doing if you do that.
650650

651651
.. attribute:: Cookie.value
652652

653-
Cookie value (a string), or :const:`None`.
653+
Cookie value (a string), or ``None``.
654654

655655

656656
.. attribute:: Cookie.port
657657

658-
String representing a port or a set of ports (eg. '80', or '80,8080'), or
659-
:const:`None`.
658+
String representing a port or a set of ports (for example, '80', or
659+
'80,8080'), or ``None``.
660660

661661

662662
.. attribute:: Cookie.domain
@@ -666,7 +666,7 @@ internal consistency, so you should know what you're doing if you do that.
666666

667667
.. attribute:: Cookie.path
668668

669-
Cookie path (a string, eg. ``'/acme/rocket_launchers'``).
669+
Cookie path (a string, for example, ``'/acme/rocket_launchers'``).
670670

671671

672672
.. attribute:: Cookie.secure
@@ -676,7 +676,7 @@ internal consistency, so you should know what you're doing if you do that.
676676

677677
.. attribute:: Cookie.expires
678678

679-
Integer expiry date in seconds since epoch, or :const:`None`. See also the
679+
Integer expiry date in seconds since epoch, or ``None``. See also the
680680
:meth:`is_expired` method.
681681

682682

@@ -688,18 +688,18 @@ internal consistency, so you should know what you're doing if you do that.
688688
.. attribute:: Cookie.comment
689689

690690
String comment from the server explaining the function of this cookie, or
691-
:const:`None`.
691+
``None``.
692692

693693

694694
.. attribute:: Cookie.comment_url
695695

696696
URL linking to a comment from the server explaining the function of this cookie,
697-
or :const:`None`.
697+
or ``None``.
698698

699699

700700
.. attribute:: Cookie.rfc2109
701701

702-
``True`` if this cookie was received as an :rfc:`2109` cookie (ie. the cookie
702+
``True`` if this cookie was received as an :rfc:`2109` cookie (that is, the cookie
703703
arrived in a :mailheader:`Set-Cookie` header, and the value of the Version
704704
cookie-attribute in that header was 1). This attribute is provided because
705705
:mod:`!http.cookiejar` may 'downgrade' RFC 2109 cookies to Netscape cookies, in

0 commit comments

Comments
 (0)