1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
3 NAMEBASE= python-rfc3987
6 VARIANTS= py27 py35 py36
7 SDESC[py35]= Parsing and validation of URIs (RFC 3986) (PY 35)
8 SDESC[py36]= Parsing and validation of URIs (RFC 3986) (PY 36)
9 SDESC[py27]= Parsing and validation of URIs (RFC 3986) (PY 27)
10 HOMEPAGE= https://pypi.python.org/pypi/rfc3987
11 CONTACT= Python_Automaton[python@ironwolf.systems]
14 SITES[main]= PYPI/r/rfc3987
15 DISTFILE[1]= rfc3987-1.3.7.tar.gz:main
21 OPTIONS_AVAILABLE= PY27 PY35 PY36
22 OPTIONS_STANDARD= none
23 VOPTS[py35]= PY27=OFF PY35=ON PY36=OFF
24 VOPTS[py36]= PY27=OFF PY35=OFF PY36=ON
25 VOPTS[py27]= PY27=ON PY35=OFF PY36=OFF
27 DISTNAME= rfc3987-1.3.7
31 [PY35].USES_ON= python:py35
33 [PY36].USES_ON= python:py36
35 [PY27].USES_ON= python:py27
37 [FILE:3620:descriptions/desc.single]
38 This module provides regular expressions according to `RFC 3986 "Uniform
39 Resource Identifier (URI): Generic Syntax"
40 <http://tools.ietf.org/html/rfc3986>`_ and `RFC 3987 "Internationalized
41 Resource Identifiers (IRIs)" <http://tools.ietf.org/html/rfc3987>`_, and
42 utilities for composition and relative resolution of references.
48 **match** (string, rule='IRI_reference')
49 Convenience function for checking if `string` matches a specific rule.
51 Returns a match object or None::
53 >>> assert match('%C7X', 'pct_encoded') is None
54 >>> assert match('%C7', 'pct_encoded')
55 >>> assert match('%c7', 'pct_encoded')
59 **parse** (string, rule='IRI_reference')
60 Parses `string` according to `rule` into a dict of subcomponents.
62 If `rule` is None, parse an IRI_reference `without validation
63 <http://tools.ietf.org/html/rfc3986#appendix-B>`_.
65 If regex_ is available, any rule is supported; with re_, `rule` must be
66 'IRI_reference' or some special case thereof ('IRI', 'absolute_IRI',
67 'irelative_ref', 'irelative_part', 'URI_reference', 'URI',
69 'relative_ref', 'relative_part'). ::
71 >>> d = parse('http://tools.ietf.org/html/rfc3986#appendix-A',
73 >>> assert all([ d['scheme'] == 'http',
74 ... d['authority'] == 'tools.ietf.org',
75 ... d['path'] == '/html/rfc3986',
76 ... d['query'] == None,
77 ... d['fragment'] == 'appendix-A' ])
81 **compose** (\*\*parts)
82 Returns an URI composed_ from named parts.
84 .. _composed: http://tools.ietf.org/html/rfc3986#section-5.3
87 **resolve** (base, uriref, strict=True, return_parts=False)
88 Resolves_ an `URI reference` relative to a `base` URI.
90 `Test cases <http://tools.ietf.org/html/rfc3986#section-5.4>`_::
92 >>> base = resolve.test_cases_base
93 >>> for relative, resolved in resolve.test_cases.items():
94 ... assert resolve(base, relative) == resolved
96 If `return_parts` is True, returns a dict of named parts instead of
101 >>> assert resolve('urn:rootless', '../../name') == 'urn:name'
102 >>> assert resolve('urn:root/less', '../../name') == 'urn:/name'
103 >>> assert resolve('http://a/b', 'http:g') == 'http:g'
104 >>> assert resolve('http://a/b', 'http:g', strict=False) ==
107 .. _Resolves: http://tools.ietf.org/html/rfc3986#section-5.2
112 A dict of regular expressions with useful group names.
113 Compilable (with regex_ only) without need for any particular
117 **[bmp_][u]patterns[_no_names]**
118 Alternative versions of `patterns`.
119 [u]nicode strings without group names for the re_ module.
120 BMP only for narrow builds.
122 **get_compiled_pattern** (rule, flags=0)
123 Returns a compiled pattern object for a rule name or template string.
125 Usage for validation::
127 >>> uri = get_compiled_pattern('^%(URI)s$')
129 uri.match('http://tools.ietf.org/html/rfc3986#appendix-A')
131 get_compiled_pattern('^%(relative_ref)s$').match('#f#g')
132 >>> from unicodedata import lookup
133 >>> smp = 'urn:' + lookup('OLD ITALIC LETTER A') # U+00010300
134 >>> assert not uri.match(smp)
135 >>> m = get_compiled_pattern('^%(IRI)s$').match(smp)
137 On narrow builds, non-BMP characters are (incorrectly) excluded::
139 >>> assert NARROW_BUILD == (not m)
141 For parsing, some subcomponents are captured in named groups (*only if*
142 regex_ is available, otherwise see `parse`)::
146 91a7826b0a26c246a5a91bef09c2c0809c713a689be689b9571e78a13f6557a4 20701 rfc3987-1.3.7.tar.gz