summaryrefslogtreecommitdiff
path: root/contrib/python/podman/libs/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/python/podman/libs/__init__.py')
-rw-r--r--contrib/python/podman/libs/__init__.py54
1 files changed, 0 insertions, 54 deletions
diff --git a/contrib/python/podman/libs/__init__.py b/contrib/python/podman/libs/__init__.py
deleted file mode 100644
index 3a8a35021..000000000
--- a/contrib/python/podman/libs/__init__.py
+++ /dev/null
@@ -1,54 +0,0 @@
-"""Support files for podman API implementation."""
-import collections
-import datetime
-import functools
-
-from dateutil.parser import parse as dateutil_parse
-
-__all__ = [
- 'cached_property',
- 'datetime_parse',
- 'datetime_format',
-]
-
-
-def cached_property(fn):
- """Decorate property to cache return value."""
- return property(functools.lru_cache(maxsize=8)(fn))
-
-
-class Config(collections.UserDict):
- """Silently ignore None values, only take key once."""
-
- def __init__(self, **kwargs):
- """Construct dictionary."""
- super(Config, self).__init__(kwargs)
-
- def __setitem__(self, key, value):
- """Store unique, not None values."""
- if value is None:
- return
-
- if super().__contains__(key):
- return
-
- super().__setitem__(key, value)
-
-
-def datetime_parse(string):
- """Convert timestamps to datetime.
-
- tzinfo aware, if provided.
- """
- return dateutil_parse(string.upper(), fuzzy=True)
-
-
-def datetime_format(dt):
- """Format datetime in consistent style."""
- if isinstance(dt, str):
- return datetime_parse(dt).isoformat()
- elif isinstance(dt, datetime.datetime):
- return dt.isoformat()
- else:
- raise ValueError('Unable to format {}. Type {} not supported.'.format(
- dt, type(dt)))