summaryrefslogtreecommitdiff
path: root/devdocs/python~3.12/library%2Fstringprep.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/python~3.12/library%2Fstringprep.html
new repository
Diffstat (limited to 'devdocs/python~3.12/library%2Fstringprep.html')
-rw-r--r--devdocs/python~3.12/library%2Fstringprep.html63
1 files changed, 63 insertions, 0 deletions
diff --git a/devdocs/python~3.12/library%2Fstringprep.html b/devdocs/python~3.12/library%2Fstringprep.html
new file mode 100644
index 00000000..9f300696
--- /dev/null
+++ b/devdocs/python~3.12/library%2Fstringprep.html
@@ -0,0 +1,63 @@
+ <span id="stringprep-internet-string-preparation"></span><h1>stringprep — Internet String Preparation</h1> <p><strong>Source code:</strong> <a class="reference external" href="https://github.com/python/cpython/tree/3.12/Lib/stringprep.py">Lib/stringprep.py</a></p> <p>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.</p> <p><span class="target" id="index-0"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc3454.html"><strong>RFC 3454</strong></a> 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 <code>stringprep</code> procedure are part of the profile. One example of a <code>stringprep</code> profile is <code>nameprep</code>, which is used for internationalized domain names.</p> <p>The module <a class="reference internal" href="#module-stringprep" title="stringprep: String preparation, as per RFC 3453"><code>stringprep</code></a> only exposes the tables from <span class="target" id="index-1"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc3454.html"><strong>RFC 3454</strong></a>. As these tables would be very large to represent as dictionaries or lists, the module uses the Unicode character database internally. The module source code itself was generated using the <code>mkstringprep.py</code> utility.</p> <p>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, <a class="reference internal" href="#module-stringprep" title="stringprep: String preparation, as per RFC 3453"><code>stringprep</code></a> provides the “characteristic function”, i.e. a function that returns <code>True</code> 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.</p> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_a1">
+<code>stringprep.in_table_a1(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableA.1 (Unassigned code points in Unicode 3.2).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_b1">
+<code>stringprep.in_table_b1(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableB.1 (Commonly mapped to nothing).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.map_table_b2">
+<code>stringprep.map_table_b2(code)</code> </dt> <dd>
+<p>Return the mapped value for <em>code</em> according to tableB.2 (Mapping for case-folding used with NFKC).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.map_table_b3">
+<code>stringprep.map_table_b3(code)</code> </dt> <dd>
+<p>Return the mapped value for <em>code</em> according to tableB.3 (Mapping for case-folding used with no normalization).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_c11">
+<code>stringprep.in_table_c11(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableC.1.1 (ASCII space characters).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_c12">
+<code>stringprep.in_table_c12(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableC.1.2 (Non-ASCII space characters).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_c11_c12">
+<code>stringprep.in_table_c11_c12(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableC.1 (Space characters, union of C.1.1 and C.1.2).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_c21">
+<code>stringprep.in_table_c21(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableC.2.1 (ASCII control characters).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_c22">
+<code>stringprep.in_table_c22(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableC.2.2 (Non-ASCII control characters).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_c21_c22">
+<code>stringprep.in_table_c21_c22(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableC.2 (Control characters, union of C.2.1 and C.2.2).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_c3">
+<code>stringprep.in_table_c3(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableC.3 (Private use).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_c4">
+<code>stringprep.in_table_c4(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableC.4 (Non-character code points).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_c5">
+<code>stringprep.in_table_c5(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableC.5 (Surrogate codes).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_c6">
+<code>stringprep.in_table_c6(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableC.6 (Inappropriate for plain text).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_c7">
+<code>stringprep.in_table_c7(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableC.7 (Inappropriate for canonical representation).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_c8">
+<code>stringprep.in_table_c8(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableC.8 (Change display properties or are deprecated).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_c9">
+<code>stringprep.in_table_c9(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableC.9 (Tagging characters).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_d1">
+<code>stringprep.in_table_d1(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableD.1 (Characters with bidirectional property “R” or “AL”).</p> </dd>
+</dl> <dl class="py function"> <dt class="sig sig-object py" id="stringprep.in_table_d2">
+<code>stringprep.in_table_d2(code)</code> </dt> <dd>
+<p>Determine whether <em>code</em> is in tableD.2 (Characters with bidirectional property “L”).</p> </dd>
+</dl> <div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 2001&ndash;2023 Python Software Foundation<br>Licensed under the PSF License.<br>
+ <a href="https://docs.python.org/3.12/library/stringprep.html" class="_attribution-link">https://docs.python.org/3.12/library/stringprep.html</a>
+ </p>
+</div>