Debian Codegraph @

src/isodate.egg-info/PKG-INFO

raw
1 Metadata-Version: 2.1
2 Name: isodate
3 Version: 0.7.2
4 Summary: An ISO 8601 date/time/duration parser and formatter
5 Author: Gerhard Weis
6 License: Copyright (c) 2021, Hugo van Kemenade and contributors
7 Copyright (c) 2009-2018, Gerhard Weis and contributors
8 Copyright (c) 2009, Gerhard Weis
9 All rights reserved.
10
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions are met:
13 * Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
15 * Redistributions in binary form must reproduce the above copyright
16 notice, this list of conditions and the following disclaimer in the
17 documentation and/or other materials provided with the distribution.
18 * Neither the name of the <organization> nor the
19 names of its contributors may be used to endorse or promote products
20 derived from this software without specific prior written permission.
21
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
26 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33 Project-URL: Homepage, https://github.com/gweis/isodate/
34 Classifier: Development Status :: 4 - Beta
35 Classifier: Intended Audience :: Developers
36 Classifier: License :: OSI Approved :: BSD License
37 Classifier: Operating System :: OS Independent
38 Classifier: Programming Language :: Python
39 Classifier: Programming Language :: Python :: 3
40 Classifier: Programming Language :: Python :: 3.7
41 Classifier: Programming Language :: Python :: 3.8
42 Classifier: Programming Language :: Python :: 3.9
43 Classifier: Programming Language :: Python :: 3.10
44 Classifier: Programming Language :: Python :: 3.11
45 Classifier: Programming Language :: Python :: 3.12
46 Classifier: Programming Language :: Python :: 3.13
47 Classifier: Programming Language :: Python :: Implementation :: CPython
48 Classifier: Programming Language :: Python :: Implementation :: PyPy
49 Classifier: Topic :: Internet
50 Classifier: Topic :: Software Development :: Libraries :: Python Modules
51 Requires-Python: >=3.7
52 Description-Content-Type: text/x-rst
53 License-File: LICENSE
54
55
56 ISO 8601 date/time parser
57 =========================
58
59 .. image:: https://travis-ci.org/gweis/isodate.svg?branch=master
60 :target: https://travis-ci.org/gweis/isodate
61 :alt: Travis-CI
62 .. image:: https://coveralls.io/repos/gweis/isodate/badge.svg?branch=master
63 :target: https://coveralls.io/r/gweis/isodate?branch=master
64 :alt: Coveralls
65 .. image:: https://img.shields.io/pypi/v/isodate.svg
66 :target: https://pypi.python.org/pypi/isodate/
67 :alt: Latest Version
68 .. image:: https://img.shields.io/pypi/l/isodate.svg
69 :target: https://pypi.python.org/pypi/isodate/
70 :alt: License
71
72
73 This module implements ISO 8601 date, time and duration parsing.
74 The implementation follows ISO8601:2004 standard, and implements only
75 date/time representations mentioned in the standard. If something is not
76 mentioned there, then it is treated as non existent, and not as an allowed
77 option.
78
79 For instance, ISO8601:2004 never mentions 2 digit years. So, it is not
80 intended by this module to support 2 digit years. (while it may still
81 be valid as ISO date, because it is not explicitly forbidden.)
82 Another example is, when no time zone information is given for a time,
83 then it should be interpreted as local time, and not UTC.
84
85 As this module maps ISO 8601 dates/times to standard Python data types, like
86 *date*, *time*, *datetime* and *timedelta*, it is not possible to convert
87 all possible ISO 8601 dates/times. For instance, dates before 0001-01-01 are
88 not allowed by the Python *date* and *datetime* classes. Additionally
89 fractional seconds are limited to microseconds. That means if the parser finds
90 for instance nanoseconds it will round it down to microseconds.
91
92 Documentation
93 -------------
94
95 The following parsing methods are available.
96 * parse_time:
97 parses an ISO 8601 time string into a *time* object
98 * parse_date:
99 parses an ISO 8601 date string into a *date* object
100 * parse_datetime:
101 parses an ISO 8601 date-time string into a *datetime* object
102 * parse_duration:
103 parses an ISO 8601 duration string into a *timedelta* or *Duration*
104 object.
105 * parse_tzinfo:
106 parses the time zone info part of an ISO 8601 string into a
107 *tzinfo* object.
108
109 As ISO 8601 allows to define durations in years and months, and *timedelta*
110 does not handle years and months, this module provides a *Duration* class,
111 which can be used almost like a *timedelta* object (with some limitations).
112 However, a *Duration* object can be converted into a *timedelta* object.
113
114 There are also ISO formatting methods for all supported data types. Each
115 *xxx_isoformat* method accepts a format parameter. The default format is
116 always the ISO 8601 expanded format. This is the same format used by
117 *datetime.isoformat*:
118
119 * time_isoformat:
120 Intended to create ISO time strings with default format
121 *hh:mm:ssZ*.
122 * date_isoformat:
123 Intended to create ISO date strings with default format
124 *yyyy-mm-dd*.
125 * datetime_isoformat:
126 Intended to create ISO date-time strings with default format
127 *yyyy-mm-ddThh:mm:ssZ*.
128 * duration_isoformat:
129 Intended to create ISO duration strings with default format
130 *PnnYnnMnnDTnnHnnMnnS*.
131 * tz_isoformat:
132 Intended to create ISO time zone strings with default format
133 *hh:mm*.
134 * strftime:
135 A re-implementation mostly compatible with Python's *strftime*, but
136 supports only those format strings, which can also be used for dates
137 prior 1900. This method also understands how to format *datetime* and
138 *Duration* instances.
139
140 Installation
141 ------------
142
143 This module can easily be installed with Python standard installation methods.
144
145 Use *pip install isodate*.
146
147 Limitations
148 -----------
149
150 * The parser accepts several date/time representation which should be invalid
151 according to ISO 8601 standard.
152
153 1. for date and time together, this parser accepts a mixture of basic and extended format.
154 e.g. the date could be in basic format, while the time is accepted in extended format.
155 It also allows short dates and times in date-time strings.
156 2. For incomplete dates, the first day is chosen. e.g. 19th century results in a date of
157 1901-01-01.
158 3. negative *Duration* and *timedelta* value are not fully supported yet.
159
160 Further information
161 -------------------
162
163 The doc strings and unit tests should provide rather detailed information about
164 the methods and their limitations.
165
166 The source release provides a *setup.py* script,
167 which can be used to run the unit tests included.
168
169 Source code is available at `<https://github.com/gweis/isodate>`_.
170
171
172 CHANGES
173 =======
174
175 0.7.3 (unreleased)
176 ------------------
177
178 - no changes yet
179
180
181 0.7.2 (2024-10-08)
182 ------------------
183
184 - drop end of life python versions
185 - Don't match garbage characters at the end of parsed strings #16 (Gabriel de Perthuis)
186
187
188 Potentially breaking changes:
189 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
190
191 - Fractional seconds are cut off to microseconds (always round down)
192 - Allow control over return type of parse_duration #64 (Felix Claessen)
193 - Python >= 3.7 required
194
195
196 0.6.1 (2021-12-13)
197 ------------------
198
199 - support python 3.10 (Hugo van Kemenade)
200 - last version to support py 2.7
201
202
203 0.6.0 (2017-10-13)
204 ------------------
205
206 - support incomplete month date (Fabien Loffredo)
207 - rely on duck typing when doing duration maths
208 - support ':' as separator in fractional time zones (usrenmae)
209
210
211 0.5.4 (2015-08-06)
212 ------------------
213
214 - Fix parsing of Periods (Fabien Bochu)
215 - Make Duration objects hashable (Geoffrey Fairchild)
216 - Add multiplication to duration (Reinoud Elhorst)
217
218
219 0.5.1 (2014-11-07)
220 ------------------
221
222 - fixed pickling of Duration objects
223 - raise ISO8601Error when there is no 'T' separator in datetime strings (Adrian Coveney)
224
225
226 0.5.0 (2014-02-23)
227 ------------------
228
229 - ISO8601Error are subclasses of ValueError now (Michael Hrivnak)
230 - improve compatibility across various python variants and versions
231 - raise exceptions when using fractional years and months in date
232 maths with durations
233 - renamed method todatetime on Duraction objects to totimedelta
234
235
236 0.4.9 (2012-10-30)
237 ------------------
238
239 - support pickling FixedOffset instances
240 - make sure parsed fractional seconds are in microseconds
241 - add leading zeros when formattig microseconds (Jarom Loveridge)
242
243
244 0.4.8 (2012-05-04)
245 ------------------
246
247 - fixed incompatibility of unittests with python 2.5 and 2.6 (runs fine on 2.7
248 and 3.2)
249
250
251 0.4.7 (2012-01-26)
252 ------------------
253
254 - fixed tzinfo formatting (never pass None into tzinfo.utcoffset())
255
256
257 0.4.6 (2012-01-06)
258 ------------------
259
260 - added Python 3 compatibility via 2to3
261
262 0.4.5 (2012-01-06)
263 ------------------
264
265 - made setuptools dependency optional
266
267 0.4.4 (2011-04-16)
268 ------------------
269
270 - Fixed formatting of microseconds for datetime objects
271
272 0.4.3 (2010-10-29)
273 ------------------
274
275 - Fixed problem with %P formatting and fractions (supplied by David Brooks)
276
277 0.4.2 (2010-10-28)
278 ------------------
279
280 - Implemented unary - for Duration (supplied by David Brooks)
281 - Output fractional seconds with '%P' format. (partly supplied by David Brooks)
282
283 0.4.1 (2010-10-13)
284 ------------------
285
286 - fixed bug in comparison between timedelta and Duration.
287 - fixed precision problem with microseconds (reported by Tommi Virtanen)
288
289 0.4.0 (2009-02-09)
290 ------------------
291
292 - added method to parse ISO 8601 time zone strings
293 - added methods to create ISO 8601 conforming strings
294
295 0.3.0 (2009-1-05)
296 ------------------
297
298 - Initial release
299
300
301 TODOs
302 =====
303
304 This to do list contains some thoughts and ideas about missing features, and
305 parts to think about, whether to implement them or not. This list is probably
306 not complete.
307
308 Missing features:
309 -----------------
310
311 * time formatting does not allow to create fractional representations.
312 * parser for ISO intervals.
313 * currently microseconds are always padded to a length of 6 characters.
314 trailing 0s should be optional
315
316 Documentation:
317 --------------
318
319 * parse_datetime:
320 - complete documentation to show what this function allows, but ISO forbids.
321 and vice verse.
322 - support other separators between date and time than 'T'
323
324 * parse_date:
325 - yeardigits should be always greater than 4
326 - dates before 0001-01-01 are not supported
327
328 * parse_duration:
329 - alternative formats are not fully supported due to parse_date restrictions
330 - standard duration format is fully supported but not very restrictive.
331
332 * Duration:
333 - support fractional years and month in calculations
334 - implement w3c order relation? (`<http://www.w3.org/TR/xmlschema-2/#duration-order>`_)
335 - refactor to have duration mathematics only at one place.
336 - localize __str__ method (does timedelta do this?)
337 - when is a Duration negative?
338 - normalize Durations. months [00-12] and years ]-inf,+inf[