Skip to content

Commit ce5baaa

Browse files
committed
Add brief overview docstring for converter module
[skip ci]
1 parent 0691b12 commit ce5baaa

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

docs/undate/converters.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ Overview
55
--------
66

77

8-
..note: base converter is pretty developer-facing documentation;
9-
.. calendar/converter usage would be helpful to add
8+
.. automodule:: undate.converters
9+
10+
-----
1011

1112
.. automodule:: undate.converters.base
1213
:members:
@@ -42,6 +43,8 @@ Extended Date-Time Format (EDTF)
4243
Calendars
4344
---------
4445

46+
.. automodule:: undate.converters.calendars
47+
4548
Gregorian
4649
^^^^^^^^^
4750

src/undate/converters/__init__.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
"""
2+
Converter classes add support for parsing and serializing dates
3+
in a variety of formats. A subset of these are calendar converters
4+
(:mod:`undate.converters.calendar`), which means they support both parsing
5+
and conversion from an alternate calendar to a common Gregorian
6+
for comparison across dates.
7+
8+
To parse a date with a supported converter, use the ``Undate`` class method
9+
:meth:`~undate.undate.Undate.parse` and specify the date as a string
10+
with the desired format or calendar, e.g.
11+
12+
.. code-block::
13+
14+
Undate.parse("2001-05", "EDTF")
15+
Undate.parse("7 Heshvan 5425", "Hebrew")
16+
17+
For converters that support it, you can also serialize a date in a specified
18+
format with ``Undate`` class method :meth:`~undate.undate.Undate.format`:
19+
20+
.. code-block::
21+
22+
Undate.parse("Rabīʿ ath-Thānī 343", "Islamic").format("EDTF")
23+
24+
25+
"""
26+
127
from undate.converters.base import BaseDateConverter, GRAMMAR_FILE_PATH
228

329
__all__ = ["BaseDateConverter", "GRAMMAR_FILE_PATH"]

0 commit comments

Comments
 (0)