Skip to content

Commit 4d44cf8

Browse files
Deploy preview for PR 1226 🛫
1 parent 9f0ca22 commit 4d44cf8

584 files changed

Lines changed: 699 additions & 632 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pr-preview/pr-1226/_sources/library/gettext.rst.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ class-based API instead.
5454

5555

5656
.. index:: single: _ (underscore); gettext
57-
.. function:: gettext(message)
57+
.. function:: gettext(message, /)
5858

5959
Return the localized translation of *message*, based on the current global
6060
domain, language, and locale directory. This function is usually aliased as
6161
:func:`!_` in the local namespace (see examples below).
6262

6363

64-
.. function:: dgettext(domain, message)
64+
.. function:: dgettext(domain, message, /)
6565

6666
Like :func:`.gettext`, but look the message up in the specified *domain*.
6767

6868

69-
.. function:: ngettext(singular, plural, n)
69+
.. function:: ngettext(singular, plural, n, /)
7070

7171
Like :func:`.gettext`, but consider plural forms. If a translation is found,
7272
apply the plural formula to *n*, and return the resulting message (some
@@ -81,15 +81,15 @@ class-based API instead.
8181
formulas for a variety of languages.
8282

8383

84-
.. function:: dngettext(domain, singular, plural, n)
84+
.. function:: dngettext(domain, singular, plural, n, /)
8585

8686
Like :func:`ngettext`, but look the message up in the specified *domain*.
8787

8888

89-
.. function:: pgettext(context, message)
90-
.. function:: dpgettext(domain, context, message)
91-
.. function:: npgettext(context, singular, plural, n)
92-
.. function:: dnpgettext(domain, context, singular, plural, n)
89+
.. function:: pgettext(context, message, /)
90+
.. function:: dpgettext(domain, context, message, /)
91+
.. function:: npgettext(context, singular, plural, n, /)
92+
.. function:: dnpgettext(domain, context, singular, plural, n, /)
9393

9494
Similar to the corresponding functions without the ``p`` in the prefix (that
9595
is, :func:`gettext`, :func:`dgettext`, :func:`ngettext`, :func:`dngettext`),
@@ -226,28 +226,28 @@ are the methods of :class:`!NullTranslations`:
226226
translation for a given message.
227227

228228

229-
.. method:: gettext(message)
229+
.. method:: gettext(message, /)
230230

231231
If a fallback has been set, forward :meth:`!gettext` to the fallback.
232232
Otherwise, return *message*. Overridden in derived classes.
233233

234234

235-
.. method:: ngettext(singular, plural, n)
235+
.. method:: ngettext(singular, plural, n, /)
236236

237237
If a fallback has been set, forward :meth:`!ngettext` to the fallback.
238238
Otherwise, return *singular* if *n* is 1; return *plural* otherwise.
239239
Overridden in derived classes.
240240

241241

242-
.. method:: pgettext(context, message)
242+
.. method:: pgettext(context, message, /)
243243

244244
If a fallback has been set, forward :meth:`pgettext` to the fallback.
245245
Otherwise, return the translated message. Overridden in derived classes.
246246

247247
.. versionadded:: 3.8
248248

249249

250-
.. method:: npgettext(context, singular, plural, n)
250+
.. method:: npgettext(context, singular, plural, n, /)
251251

252252
If a fallback has been set, forward :meth:`npgettext` to the fallback.
253253
Otherwise, return the translated message. Overridden in derived classes.
@@ -325,7 +325,7 @@ unexpected, or if other problems occur while reading the file, instantiating a
325325

326326
The following methods are overridden from the base class implementation:
327327

328-
.. method:: gettext(message)
328+
.. method:: gettext(message, /)
329329

330330
Look up the *message* id in the catalog and return the corresponding message
331331
string, as a Unicode string. If there is no entry in the catalog for the
@@ -334,7 +334,7 @@ unexpected, or if other problems occur while reading the file, instantiating a
334334
*message* id is returned.
335335

336336

337-
.. method:: ngettext(singular, plural, n)
337+
.. method:: ngettext(singular, plural, n, /)
338338

339339
Do a plural-forms lookup of a message id. *singular* is used as the message id
340340
for purposes of lookup in the catalog, while *n* is used to determine which
@@ -355,7 +355,7 @@ unexpected, or if other problems occur while reading the file, instantiating a
355355
n) % {'num': n}
356356

357357

358-
.. method:: pgettext(context, message)
358+
.. method:: pgettext(context, message, /)
359359

360360
Look up the *context* and *message* id in the catalog and return the
361361
corresponding message string, as a Unicode string. If there is no
@@ -366,7 +366,7 @@ unexpected, or if other problems occur while reading the file, instantiating a
366366
.. versionadded:: 3.8
367367

368368

369-
.. method:: npgettext(context, singular, plural, n)
369+
.. method:: npgettext(context, singular, plural, n, /)
370370

371371
Do a plural-forms lookup of a message id. *singular* is used as the
372372
message id for purposes of lookup in the catalog, while *n* is used to

pr-preview/pr-1226/_sources/library/stdtypes.rst.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2612,7 +2612,9 @@ expression support in the :mod:`re` module).
26122612
:func:`re.split`). Splitting an empty string with a specified separator
26132613
returns ``['']``.
26142614

2615-
For example::
2615+
For example:
2616+
2617+
.. doctest::
26162618

26172619
>>> '1,2,3'.split(',')
26182620
['1', '2', '3']
@@ -2630,7 +2632,9 @@ expression support in the :mod:`re` module).
26302632
string or a string consisting of just whitespace with a ``None`` separator
26312633
returns ``[]``.
26322634

2633-
For example::
2635+
For example:
2636+
2637+
.. doctest::
26342638

26352639
>>> '1 2 3'.split()
26362640
['1', '2', '3']
@@ -2642,7 +2646,9 @@ expression support in the :mod:`re` module).
26422646
If *sep* is not specified or is ``None`` and *maxsplit* is ``0``, only
26432647
leading runs of consecutive whitespace are considered.
26442648

2645-
For example::
2649+
For example:
2650+
2651+
.. doctest::
26462652

26472653
>>> "".split(None, 0)
26482654
[]
@@ -2651,7 +2657,7 @@ expression support in the :mod:`re` module).
26512657
>>> " foo ".split(maxsplit=0)
26522658
['foo ']
26532659

2654-
See also :meth:`join`.
2660+
See also :meth:`join` and :meth:`rsplit`.
26552661

26562662

26572663
.. index::

pr-preview/pr-1226/_sources/using/windows.rst.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,12 @@ customization.
457457
Python runtimes, or false to prevent it.
458458
By default, true.
459459

460+
* - ``shebang_templates``
461+
- (none)
462+
- Mapping from shebang line template to alternative command, such as
463+
``py -V:<tag>`` or a substitute string.
464+
See :ref:`pymanager-shebang` for more details.
465+
460466
* - ``log_level``
461467
- ``PYMANAGER_VERBOSE``, ``PYMANAGER_DEBUG``
462468
- Set the default level of output (0-50).
@@ -570,6 +576,30 @@ which the path to the script and any additional arguments will be appended.
570576
This functionality may be disabled by the ``shebang_can_run_anything``
571577
configuration option.
572578

579+
Since version 26.3 of the Python install manager, custom shebang templates may
580+
be added to your configuration file. Add the ``shebang_templates`` object with
581+
one member for each template (the string to match) and the command to use when
582+
the template is matched. Most commands should be ``py -V:<tag>`` (or ``pyw``) to
583+
launch one of your installed runtimes. The ``py -3.<version>`` form is also
584+
allowed, as is a plain ``py`` to launch the default. No other arguments are
585+
supported.
586+
587+
.. code:: json5
588+
589+
{
590+
"shebang_templates": {
591+
"/usr/bin/python": "py",
592+
"/usr/bin/my_custom_python": "py -V:MyCustomPython/3"
593+
}
594+
}
595+
596+
If the substitute command is not ``py`` or ``pyw``, it will be written back into
597+
the shebang and regular handling continues. If launching arbitrary executables
598+
is permitted, then providing a full path will allow you to redirect from Python
599+
to any executable. The template should match either the entire line (ignoring
600+
leading and trailing whitespace), or up to the first space in the shebang line.
601+
602+
573603
.. note::
574604

575605
The behaviour of shebangs in the Python install manager is subtly different

pr-preview/pr-1226/about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ <h3>導航</h3>
356356
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
357357
<br>
358358
<br>
359-
最後更新於 6月 04, 2026 (00:55 UTC)。
359+
最後更新於 6月 05, 2026 (00:48 UTC)。
360360

361361
<a href="/bugs.html">發現 bug</a>
362362

pr-preview/pr-1226/bugs.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ <h2>說明文件的錯誤<a class="headerlink" href="#documentation-bugs" title=
250250
</section>
251251
<section id="getting-started-contributing-to-python-yourself">
252252
<span id="contributing-to-python"></span><h2>開始讓自己貢獻 Python<a class="headerlink" href="#getting-started-contributing-to-python-yourself" title="連結到這個標頭"></a></h2>
253-
<p>除了只是回報你所發現的錯誤之外,同樣也歡迎你提交修正它們的修補程式 (patch)。你可以在 <a class="reference external" href="https://devguide.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果你有任何問題,<a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">核心導師郵寄清單</a>是一個友善的地方,你可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
253+
<p>除了只是回報你所發現的錯誤之外,同樣也歡迎你提交修正它們的修補程式 (patch)。你可以在 <a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果你有任何問題,<a class="reference external" href="https://devguide.python.org/">核心導師郵寄清單</a>是一個友善的地方,你可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
254254
</section>
255255
</section>
256256

@@ -393,7 +393,7 @@ <h3>導航</h3>
393393
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
394394
<br>
395395
<br>
396-
最後更新於 6月 04, 2026 (00:55 UTC)。
396+
最後更新於 6月 05, 2026 (00:48 UTC)。
397397

398398
<a href="/bugs.html">發現 bug</a>
399399

pr-preview/pr-1226/c-api/abstract.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ <h3>導航</h3>
365365
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
366366
<br>
367367
<br>
368-
最後更新於 6月 04, 2026 (00:55 UTC)。
368+
最後更新於 6月 05, 2026 (00:48 UTC)。
369369

370370
<a href="/bugs.html">發現 bug</a>
371371

pr-preview/pr-1226/c-api/allocation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ <h3>導航</h3>
577577
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
578578
<br>
579579
<br>
580-
最後更新於 6月 04, 2026 (00:55 UTC)。
580+
最後更新於 6月 05, 2026 (00:48 UTC)。
581581

582582
<a href="/bugs.html">發現 bug</a>
583583

pr-preview/pr-1226/c-api/apiabiversion.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ <h3>導航</h3>
514514
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
515515
<br>
516516
<br>
517-
最後更新於 6月 04, 2026 (00:55 UTC)。
517+
最後更新於 6月 05, 2026 (00:48 UTC)。
518518

519519
<a href="/bugs.html">發現 bug</a>
520520

pr-preview/pr-1226/c-api/arg.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ <h3>導航</h3>
996996
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
997997
<br>
998998
<br>
999-
最後更新於 6月 04, 2026 (00:55 UTC)。
999+
最後更新於 6月 05, 2026 (00:48 UTC)。
10001000

10011001
<a href="/bugs.html">發現 bug</a>
10021002

pr-preview/pr-1226/c-api/bool.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ <h3>導航</h3>
376376
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
377377
<br>
378378
<br>
379-
最後更新於 6月 04, 2026 (00:55 UTC)。
379+
最後更新於 6月 05, 2026 (00:48 UTC)。
380380

381381
<a href="/bugs.html">發現 bug</a>
382382

0 commit comments

Comments
 (0)