Debian Codegraph @

PKG-INFO

raw
1 Metadata-Version: 2.1
2 Name: lazr.uri
3 Version: 1.0.6
4 Summary: A self-contained, easily reusable library for parsing, manipulating,
5 Home-page: https://launchpad.net/lazr.uri
6 Maintainer: LAZR Developers
7 Maintainer-email: [email protected]
8 License: LGPL v3
9 Download-URL: https://launchpad.net/lazr.uri/+download
10 Description: ..
11 This file is part of lazr.uri.
12
13 lazr.uri is free software: you can redistribute it and/or modify it
14 under the terms of the GNU Lesser General Public License as published by
15 the Free Software Foundation, version 3 of the License.
16
17 lazr.uri is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20 License for more details.
21
22 You should have received a copy of the GNU Lesser General Public License
23 along with lazr.uri. If not, see <http://www.gnu.org/licenses/>.
24
25 lazr.uri
26 ********
27
28 The lazr.uri package includes code for parsing and dealing with URIs.
29
30 >>> import lazr.uri
31 >>> print('VERSION:', lazr.uri.__version__)
32 VERSION: ...
33
34 =============
35 The URI class
36 =============
37
38 >>> from lazr.uri import URI
39 >>> uri1 = URI('http://localhost/foo/bar?123')
40 >>> uri2 = URI('http://localhost/foo/bar/baz')
41 >>> uri1.contains(uri2)
42 True
43
44 These next two are equivalent, so the answer should be True, even through
45 the "outside" one is shorter than the "inside" one.
46
47 >>> uri1 = URI('http://localhost/foo/bar/')
48 >>> uri2 = URI('http://localhost/foo/bar')
49 >>> uri1.contains(uri2)
50 True
51
52 The next two are exactly the same. We consider a url to be inside itself.
53
54 >>> uri1 = URI('http://localhost/foo/bar/')
55 >>> uri2 = URI('http://localhost/foo/bar/')
56 >>> uri1.contains(uri2)
57 True
58
59 In the next case, the string of url2 starts with the string of url1. But,
60 because url2 continues within the same path step, url2 is not inside url1.
61
62 >>> uri1 = URI('http://localhost/foo/ba')
63 >>> uri2 = URI('http://localhost/foo/bar')
64 >>> uri1.contains(uri2)
65 False
66
67 Here, url2 is url1 plus an extra path step. So, url2 is inside url1.
68
69 >>> uri1 = URI('http://localhost/foo/bar/')
70 >>> uri2 = URI('http://localhost/foo/bar/baz')
71 >>> uri1.contains(uri2)
72 True
73
74 Once the URI is parsed, its parts are accessible.
75
76 >>> uri = URI('https://fish.tree:8666/blee/blah')
77 >>> uri.scheme
78 'https'
79 >>> uri.host
80 'fish.tree'
81 >>> uri.port
82 '8666'
83 >>> uri.authority
84 'fish.tree:8666'
85 >>> uri.path
86 '/blee/blah'
87
88 >>> uri = URI('https://localhost/blee/blah')
89 >>> uri.scheme
90 'https'
91 >>> uri.host
92 'localhost'
93 >>> uri.port is None
94 True
95 >>> uri.authority
96 'localhost'
97 >>> uri.path
98 '/blee/blah'
99
100 The grammar from RFC 3986 does not allow for square brackets in the
101 query component, but Section 3.4 does say how such delimeter
102 characters should be handled if found in the component.
103
104 >>> uri = URI('http://www.apple.com/store?delivery=[slow]#horse+cart')
105 >>> uri.scheme
106 'http'
107 >>> uri.host
108 'www.apple.com'
109 >>> uri.port is None
110 True
111 >>> uri.path
112 '/store'
113 >>> uri.query
114 'delivery=[slow]'
115 >>> uri.fragment
116 'horse+cart'
117
118 ====================
119 Finding URIs in Text
120 ====================
121
122 lazr.uri also knows how to retrieve a list of URIs from a block of
123 text. This is intended for uses like finding bug tracker URIs or
124 similar.
125
126 The find_uris_in_text() function returns an iterator that yields URI
127 objects for each URI found in the text. Note that the returned URIs
128 have been canonicalised by the URI class:
129
130 >>> from lazr.uri import find_uris_in_text
131 >>> text = '''
132 ... A list of URIs:
133 ... * http://localhost/a/b
134 ... * http://launchpad.net
135 ... * MAILTO:[email protected]
136 ... * xmpp:[email protected]
137 ... * http://bazaar.launchpad.net/%7ename12/firefox/foo
138 ... * http://somewhere.in/time?track=[02]#wasted-years
139 ... '''
140
141 >>> for uri in find_uris_in_text(text):
142 ... print(uri)
143 http://localhost/a/b
144 http://launchpad.net/
145 mailto:[email protected]
146 xmpp:[email protected]
147 http://bazaar.launchpad.net/~name12/firefox/foo
148 http://somewhere.in/time?track=[02]#wasted-years
149
150
151 =================
152 NEWS for lazr.uri
153 =================
154
155 1.0.6 (2021-09-13)
156 ==================
157
158 - Adjust versioning strategy to avoid importing pkg_resources, which is slow
159 in large environments.
160
161 1.0.5 (2020-06-29)
162 ==================
163
164 - Add an explicit __hash__ method to lazr.uri.URI.
165
166 1.0.4 (2020-06-12)
167 ==================
168
169 - Install version.txt with package_data (Stefano Rivera,
170 https://bugs.launchpad.net/lazr.uri/+bug/918660).
171 - Switch from buildout to tox.
172
173 1.0.3 (2012-01-18)
174 ==================
175
176 - Add compatibility with Python 3 (Thomas Kluyver).
177
178 1.0.1 (2009-06-01)
179 ==================
180
181 - Eliminate dependency on setuptools_bzr so sdists do not bring bzr ini, among
182 others.
183
184 1.0 (2009-03-23)
185 ================
186
187 - Initial release on PyPI
188
189 Platform: UNKNOWN
190 Classifier: Development Status :: 5 - Production/Stable
191 Classifier: Intended Audience :: Developers
192 Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
193 Classifier: Operating System :: OS Independent
194 Classifier: Programming Language :: Python
195 Classifier: Programming Language :: Python :: 2
196 Classifier: Programming Language :: Python :: 2.7
197 Classifier: Programming Language :: Python :: 3
198 Classifier: Programming Language :: Python :: 3.5
199 Classifier: Programming Language :: Python :: 3.6
200 Classifier: Programming Language :: Python :: 3.7
201 Classifier: Programming Language :: Python :: 3.8
202 Description-Content-Type: text/x-rst
203 Provides-Extra: docs
204 Provides-Extra: test