Mercurial > libervia-backend
comparison sat/plugins/plugin_xep_0082.py @ 3879:46930301f0c1
tools: renamed module `sat.tools.datetime` to `date.tools.xmpp_datetime` to avoid conflict with Python's standard lib
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 31 Aug 2022 13:18:56 +0200 |
parents | 00212260f659 |
children | 8289ac1b34f4 |
comparison
equal
deleted
inserted
replaced
3878:32087d7c25d4 | 3879:46930301f0c1 |
---|---|
21 # Lint with `pylint` | 21 # Lint with `pylint` |
22 | 22 |
23 from sat.core.constants import Const as C | 23 from sat.core.constants import Const as C |
24 from sat.core.i18n import D_ | 24 from sat.core.i18n import D_ |
25 from sat.core.sat_main import SAT | 25 from sat.core.sat_main import SAT |
26 from sat.tools import datetime | 26 from sat.tools import xmpp_datetime |
27 | 27 |
28 | 28 |
29 __all__ = [ # pylint: disable=unused-variable | 29 __all__ = [ # pylint: disable=unused-variable |
30 "PLUGIN_INFO", | 30 "PLUGIN_INFO", |
31 "XEP_0082" | 31 "XEP_0082" |
47 | 47 |
48 class XEP_0082: # pylint: disable=invalid-name | 48 class XEP_0082: # pylint: disable=invalid-name |
49 """ | 49 """ |
50 Implementation of the date and time profiles specified in XEP-0082 using Python's | 50 Implementation of the date and time profiles specified in XEP-0082 using Python's |
51 datetime module. The legacy format described in XEP-0082 section "4. Migration" is not | 51 datetime module. The legacy format described in XEP-0082 section "4. Migration" is not |
52 supported. Reexports of the functions in :mod:`sat.tools.datetime`. | 52 supported. Reexports of the functions in :mod:`sat.tools.xmpp_datetime`. |
53 | 53 |
54 This is a passive plugin, i.e. it doesn't hook into any triggers to process stanzas | 54 This is a passive plugin, i.e. it doesn't hook into any triggers to process stanzas |
55 actively, but offers API for other plugins to use. | 55 actively, but offers API for other plugins to use. |
56 """ | 56 """ |
57 | 57 |
58 def __init__(self, sat: SAT) -> None: | 58 def __init__(self, sat: SAT) -> None: |
59 """ | 59 """ |
60 @param sat: The SAT instance. | 60 @param sat: The SAT instance. |
61 """ | 61 """ |
62 | 62 |
63 format_date = staticmethod(datetime.format_date) | 63 format_date = staticmethod(xmpp_datetime.format_date) |
64 parse_date = staticmethod(datetime.parse_date) | 64 parse_date = staticmethod(xmpp_datetime.parse_date) |
65 format_datetime = staticmethod(datetime.format_datetime) | 65 format_datetime = staticmethod(xmpp_datetime.format_datetime) |
66 parse_datetime = staticmethod(datetime.parse_datetime) | 66 parse_datetime = staticmethod(xmpp_datetime.parse_datetime) |
67 format_time = staticmethod(datetime.format_time) | 67 format_time = staticmethod(xmpp_datetime.format_time) |
68 parse_time = staticmethod(datetime.parse_time) | 68 parse_time = staticmethod(xmpp_datetime.parse_time) |