Add Neon API package and related files

This commit is contained in:
2024-02-27 17:01:37 -05:00
parent 4cc5b8448c
commit fe646906d9
10 changed files with 8 additions and 8 deletions
+23
View File
@@ -0,0 +1,23 @@
import datetime
def compact_mapping(obj):
"""Compact a dict/mapping by removing all None values."""
return {k: v for k, v in obj.items() if v is not None}
def to_iso8601(dt):
"""Convert a datetime object to an
`ISO 8601 <https://www.iso.org/iso-8601-date-and-time-format.html>`_ string.
"""
return dt.strftime("%Y-%m-%dT%H:%M:%SZ")
def from_iso8601(s):
"""Convert an `ISO 8601 <https://www.iso.org/iso-8601-date-and-time-format.html>`_
string to a datetime object.
"""
return datetime.strptime(s, "%Y-%m-%dT%H:%M:%SZ")