1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
3 NAMEBASE= python-rfc3987
7 SDESC[v11]= Parsing and validation of URIs and IRIs (3.11)
8 SDESC[v12]= Parsing and validation of URIs and IRIs (3.12)
9 HOMEPAGE= https://pypi.python.org/pypi/rfc3987
10 CONTACT= Python_Automaton[python@ironwolf.systems]
13 SITES[main]= PYPIWHL/65/d4/f7407c3d15d5ac779c3dd34fbbc6ea2090f77bd7dd12f207ccf881551208
14 DISTFILE[1]= rfc3987-1.3.8-py2.py3-none-any.whl:main
19 OPTIONS_AVAILABLE= PY311 PY312
20 OPTIONS_STANDARD= none
21 VOPTS[v11]= PY311=ON PY312=OFF
22 VOPTS[v12]= PY311=OFF PY312=ON
24 DISTNAME= rfc3987-1.3.8.dist-info
28 [PY311].USES_ON= python:v11,wheel
30 [PY312].USES_ON= python:v12,wheel
32 [FILE:3592:descriptions/desc.single]
33 This module provides regular expressions according to `RFC 3986 "Uniform
34 Resource Identifier (URI): Generic Syntax"
35 <http://tools.ietf.org/html/rfc3986>`_ and `RFC 3987 "Internationalized
36 Resource Identifiers (IRIs)" <http://tools.ietf.org/html/rfc3987>`_, and
37 utilities for composition and relative resolution of references.
42 **match** (string, rule='IRI_reference')
43 Convenience function for checking if `string` matches a specific rule.
45 Returns a match object or None::
47 >>> assert match('%C7X', 'pct_encoded') is None
48 >>> assert match('%C7', 'pct_encoded')
49 >>> assert match('%c7', 'pct_encoded')
51 **parse** (string, rule='IRI_reference')
52 Parses `string` according to `rule` into a dict of subcomponents.
54 If `rule` is None, parse an IRI_reference [without validation
57 If regex_ is available, any rule is supported; with re_, `rule` must be
58 'IRI_reference' or some special case thereof ('IRI', 'absolute_IRI',
59 'irelative_ref', 'irelative_part', 'URI_reference', 'URI',
61 'relative_ref', 'relative_part'). ::
63 >>> d = parse('http://tools.ietf.org/html/rfc3986#appendix-A',
65 >>> assert all([ d['scheme'] == 'http',
66 ... d['authority'] == 'tools.ietf.org',
67 ... d['path'] == '/html/rfc3986',
68 ... d['query'] == None,
69 ... d['fragment'] == 'appendix-A'])
71 **compose** (\*\*parts)
72 Returns an URI composed_ from named parts.
74 .. _composed: http://tools.ietf.org/html/rfc3986#section-5.3
76 **resolve** (base, uriref, strict=True, return_parts=False)
77 Resolves_ an `URI reference` relative to a `base` URI.
81 >>> base = resolve.test_cases_base
82 >>> for relative, resolved in resolve.test_cases.items():
83 ... assert resolve(base, relative) == resolved
85 If `return_parts` is True, returns a dict of named parts instead of
90 >>> assert resolve('urn:rootless', '../../name') == 'urn:name'
91 >>> assert resolve('urn:root/less', '../../name') == 'urn:/name'
92 >>> assert resolve('http://a/b', 'http:g') == 'http:g'
93 >>> assert resolve('http://a/b', 'http:g', strict=False) ==
96 .. _Resolves: http://tools.ietf.org/html/rfc3986#section-5.2
99 A dict of regular expressions with useful group names.
100 Compilable (with regex_ only) without need for any particular
104 **[bmp_][u]patterns[_no_names]**
105 Alternative versions of `patterns`.
106 [u]nicode strings without group names for the re_ module.
107 BMP only for narrow builds.
109 **get_compiled_pattern** (rule, flags=0)
110 Returns a compiled pattern object for a rule name or template string.
112 Usage for validation::
114 >>> uri = get_compiled_pattern('^%(URI)s$')
116 uri.match('http://tools.ietf.org/html/rfc3986#appendix-A')
118 get_compiled_pattern('^%(relative_ref)s$').match('#f#g')
119 >>> from unicodedata import lookup
120 >>> smp = 'urn:' + lookup('OLD ITALIC LETTER A') # U+00010300
121 >>> assert not uri.match(smp)
122 >>> m = get_compiled_pattern('^%(IRI)s$').match(smp)
124 On narrow builds, non-BMP characters are (incorrectly) excluded::
126 >>> assert NARROW_BUILD == (not m)
128 For parsing, some subcomponents are captured in named groups (*only if*
129 regex_ is available, otherwise see `parse`)::
132 uri.match('http://tools.ietf.org/html/rfc3986#appendix-A')
136 10702b1e51e5658843460b189b185c0366d2cf4cff716f13111b0ea9fd2dce53 13377 rfc3987-1.3.8-py2.py3-none-any.whl