sdata 0.25.2__tar.gz → 0.25.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sdata-0.25.2/sdata.egg-info → sdata-0.25.4}/PKG-INFO +1 -1
- {sdata-0.25.2 → sdata-0.25.4}/sdata/__init__.py +2 -1
- sdata-0.25.4/sdata/base.py +155 -0
- {sdata-0.25.2 → sdata-0.25.4/sdata.egg-info}/PKG-INFO +1 -1
- {sdata-0.25.2 → sdata-0.25.4}/sdata.egg-info/SOURCES.txt +1 -0
- {sdata-0.25.2 → sdata-0.25.4}/LICENSE-MIT +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/MANIFEST.in +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/README.md +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/pyproject.toml +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/blob.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/__init__.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/attrdict/__init__.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/attrdict/default.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/attrdict/dictionary.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/attrdict/mapping.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/attrdict/merge.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/attrdict/mixins.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/piexif/__init__.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/piexif/_common.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/piexif/_dump.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/piexif/_exceptions.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/piexif/_exif.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/piexif/_insert.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/piexif/_load.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/piexif/_remove.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/piexif/_transplant.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/piexif/_webp.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/piexif/helper.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/ranger/__init__.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/ranger/collections/__init__.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/ranger/collections/rangebucketmap.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/ranger/collections/rangemap.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/ranger/collections/rangeset.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/ranger/range/__init__.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/ranger/range/cut.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/ranger/range/range.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/semver.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/simple_graph_db/LICENSE +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/simple_graph_db/__init__.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/simple_graph_db/database.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/simple_graph_db/schema.sql +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/sobol_seq.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/sortedcontainers/LICENSE +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/sortedcontainers/__init__.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/sortedcontainers/sorteddict.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/sortedcontainers/sortedlist.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/sortedcontainers/sortedset.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/sqlitedict.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/timeflake/__init__.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/timeflake/flake.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/contrib/timeflake/utils.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/data.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/doe.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/experiments/__init__.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/experiments/ks2.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/experiments/lapshear.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/experiments/material.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/image.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/iolib/__init__.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/iolib/db.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/iolib/hashtree.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/iolib/hdf.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/iolib/isomme.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/iolib/json1sqlitestore.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/iolib/jsonsqlitestore.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/iolib/owncloudfs.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/iolib/pgp.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/iolib/pud.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/iolib/simple_signature.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/iolib/vault.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/metadata.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/node.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/parameter.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/parameters_deprecated.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/suuid.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/timestamp.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/tools.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata/workbook.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata.egg-info/dependency_links.txt +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata.egg-info/requires.txt +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/sdata.egg-info/top_level.txt +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/setup.cfg +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/setup.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/__init__.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/iolib/__init__.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/iolib/pud/__init__.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/iolib/pud/test_pud.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/iolib/test_hasttree.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/iolib/test_hdf.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/iolib/test_jsonsqlitestore.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_attribute.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_blob.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_data.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_image.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_io.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_ks2.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_metadata.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_parameter.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_sqlite.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_suuid.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_table.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_testprogram.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_timeflake.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_timestamp.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_tools.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_vault.py +0 -0
- {sdata-0.25.2 → sdata-0.25.4}/tests/test_workbook.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# -*-coding: utf-8-*-
|
|
2
2
|
from __future__ import division
|
|
3
3
|
|
|
4
|
-
__version__ = '0.25.
|
|
4
|
+
__version__ = '0.25.4'
|
|
5
5
|
__revision__ = None
|
|
6
6
|
__version_info__ = tuple([int(num) for num in __version__.split('.')])
|
|
7
7
|
|
|
@@ -20,6 +20,7 @@ import pandas
|
|
|
20
20
|
|
|
21
21
|
from sdata.metadata import Metadata, Attribute
|
|
22
22
|
from sdata.data import Data
|
|
23
|
+
from sdata.base import Base
|
|
23
24
|
from sdata.blob import Blob
|
|
24
25
|
from sdata.suuid import SUUID
|
|
25
26
|
from sdata.image import Image
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import sdata
|
|
2
|
+
from sdata import __version__
|
|
3
|
+
from sdata.suuid import SUUID
|
|
4
|
+
from sdata.metadata import Metadata, Attribute, extract_name_unit
|
|
5
|
+
from sdata.timestamp import now_utc_str, now_local_str, today_str
|
|
6
|
+
import uuid
|
|
7
|
+
import copy
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Base:
|
|
11
|
+
|
|
12
|
+
SDATA_VERSION = "!sdata_version"
|
|
13
|
+
SDATA_NAME = "!sdata_name"
|
|
14
|
+
SDATA_SNAME = "!sdata_sname"
|
|
15
|
+
SDATA_UUID = "!sdata_uuid"
|
|
16
|
+
SDATA_SUUID = "!sdata_suuid"
|
|
17
|
+
SDATA_CTIME = "!sdata_ctime"
|
|
18
|
+
SDATA_MTIME = "!sdata_mtime"
|
|
19
|
+
SDATA_PARENT = "!sdata_parent"
|
|
20
|
+
SDATA_CLASS = "!sdata_class"
|
|
21
|
+
SDATA_PROJECT = "!sdata_project"
|
|
22
|
+
SDATA_URL = "!sdata_url"
|
|
23
|
+
SDATA_COLUMN = "!sdata_column"
|
|
24
|
+
|
|
25
|
+
SDATA_ATTRIBUTES = [SDATA_VERSION, SDATA_NAME, SDATA_UUID, SDATA_SUUID, SDATA_CLASS, SDATA_PARENT, SDATA_PROJECT,
|
|
26
|
+
SDATA_CTIME, SDATA_MTIME, SDATA_URL]
|
|
27
|
+
|
|
28
|
+
def __init__(self, **kwargs):
|
|
29
|
+
name = kwargs.get("name", "N.N.")
|
|
30
|
+
suuid = SUUID.from_name(class_name=self.__class__.__name__, name=name)
|
|
31
|
+
self.metadata = Metadata(name=suuid.sname)
|
|
32
|
+
self.metadata.add(self.SDATA_VERSION, __version__, dtype="str", description="sdata package version")
|
|
33
|
+
self.metadata.add(self.SDATA_NAME, name, dtype="str", description="name of the data object")
|
|
34
|
+
self.metadata.add(self.SDATA_SNAME, suuid.sname, dtype="str", description="sname of the data object")
|
|
35
|
+
self.metadata.add(self.SDATA_UUID, suuid.huuid, dtype="str", description="Universally Unique Identifier")
|
|
36
|
+
self.metadata.add(self.SDATA_SUUID, suuid.suuid, dtype="str", description="Super Universally Unique Identifier")
|
|
37
|
+
self.metadata.add(self.SDATA_PARENT, str(kwargs.get("parent", "")), dtype="str", description="suuid of the parent sdata object")
|
|
38
|
+
self.metadata.add(self.SDATA_CLASS, self.__class__.__name__, dtype="str", description="sdata class")
|
|
39
|
+
self.metadata.add(self.SDATA_CTIME, now_utc_str(), dtype="str", description="creation date")
|
|
40
|
+
self.metadata.add(self.SDATA_MTIME, now_utc_str(), dtype="str", description="modification date")
|
|
41
|
+
self.metadata.add(self.SDATA_URL, str(kwargs.get("url", "")), dtype="str", description="url of the data object")
|
|
42
|
+
self.metadata.add(self.SDATA_PROJECT, str(kwargs.get("project", "")), dtype="str", description="project name")
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def md(self):
|
|
46
|
+
return self.metadata
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def mdf(self):
|
|
50
|
+
return self.metadata.df
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def osname(self):
|
|
54
|
+
""":returns: os compatible name (ascii?)"""
|
|
55
|
+
return self.asciiname(self.name)
|
|
56
|
+
|
|
57
|
+
@staticmethod
|
|
58
|
+
def asciiname(name):
|
|
59
|
+
name = copy.copy(name)
|
|
60
|
+
mapper = [("ä", "ae"), ("ö", "oe"), ("ü", "ue"), ("Ä", "Ae"), ("Ö", "Oe"), ("Ü", "Ue"),
|
|
61
|
+
("ß", "sz"), (" ", "_"), ("/", "_"), ("\\", "_")]
|
|
62
|
+
for k, v in mapper:
|
|
63
|
+
name = name.replace(k, v)
|
|
64
|
+
name = name.lower()
|
|
65
|
+
return name.encode('ascii', 'replace').decode("ascii")
|
|
66
|
+
|
|
67
|
+
def __str__(self):
|
|
68
|
+
return f"({self.__class__.__name__} '{self.name}':{self.uuid})"
|
|
69
|
+
|
|
70
|
+
def _get_uuid(self):
|
|
71
|
+
return self.metadata.get(self.SDATA_UUID).value
|
|
72
|
+
# return self._uuid
|
|
73
|
+
|
|
74
|
+
def _set_uuid(self, value):
|
|
75
|
+
if isinstance(value, str):
|
|
76
|
+
try:
|
|
77
|
+
uuid.UUID(value)
|
|
78
|
+
self.metadata.set_attr(self.SDATA_UUID, uuid.UUID(value).hex)
|
|
79
|
+
except ValueError as exp:
|
|
80
|
+
logger.warning("data.uuid: %s" % exp)
|
|
81
|
+
raise Sdata_Uuid_Exeption("got invalid uuid str '{}'".format(str(value)))
|
|
82
|
+
elif isinstance(value, uuid.UUID):
|
|
83
|
+
self.metadata.set_attr(self.SDATA_UUID, value.hex)
|
|
84
|
+
else:
|
|
85
|
+
logger.error("Data.uuid: invalid uuid '{}'".format(value))
|
|
86
|
+
raise Exception("Data.uuid: invalid uuid '{}'".format(value))
|
|
87
|
+
|
|
88
|
+
uuid = property(fget=_get_uuid, fset=_set_uuid, doc="uuid of the object")
|
|
89
|
+
|
|
90
|
+
def get_uuid(self):
|
|
91
|
+
return uuid.UUID(self.uuid)
|
|
92
|
+
|
|
93
|
+
def _get_suuid(self):
|
|
94
|
+
return self.metadata.get(self.SDATA_SUUID).value
|
|
95
|
+
|
|
96
|
+
def _set_suuid(self, value):
|
|
97
|
+
self.metadata.set_attr(self.SDATA_SUUID, value)
|
|
98
|
+
|
|
99
|
+
suuid = property(fget=_get_suuid, fset=_set_suuid, doc="suuid of the object")
|
|
100
|
+
|
|
101
|
+
def get_suuid(self):
|
|
102
|
+
return sdata.SUUID.from_suuid_sname(self.sname)
|
|
103
|
+
|
|
104
|
+
def _get_sname(self):
|
|
105
|
+
return self.metadata.get(self.SDATA_SNAME).value
|
|
106
|
+
|
|
107
|
+
def _set_sname(self, value):
|
|
108
|
+
self.metadata.set_attr(self.SDATA_SNAME, value)
|
|
109
|
+
|
|
110
|
+
sname = property(fget=_get_sname, fset=_set_sname, doc="sname of the object")
|
|
111
|
+
|
|
112
|
+
def _get_name(self):
|
|
113
|
+
return self.metadata.get(self.SDATA_NAME).value
|
|
114
|
+
|
|
115
|
+
def _set_name(self, value):
|
|
116
|
+
self.metadata.set_attr(self.SDATA_NAME, value)
|
|
117
|
+
|
|
118
|
+
name = property(fget=_get_name, fset=_set_name, doc="name of the object")
|
|
119
|
+
|
|
120
|
+
@property
|
|
121
|
+
def parent(self):
|
|
122
|
+
return self.metadata.get(self.SDATA_PARENT).value
|
|
123
|
+
|
|
124
|
+
def get_parent(self):
|
|
125
|
+
return SUUID.from_suuid_sname(self.metadata.get(self.SDATA_PARENT).value)
|
|
126
|
+
|
|
127
|
+
def __str__(self):
|
|
128
|
+
return f"<{self.__class__.__name__}:{self.name}:{self.uuid}>"
|
|
129
|
+
|
|
130
|
+
__repr__ = __str__
|
|
131
|
+
|
|
132
|
+
@property
|
|
133
|
+
def udf(self):
|
|
134
|
+
return self.metadata.udf
|
|
135
|
+
|
|
136
|
+
@property
|
|
137
|
+
def sdf(self):
|
|
138
|
+
return self.metadata.sdf
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
def md(self):
|
|
142
|
+
return self.metadata
|
|
143
|
+
|
|
144
|
+
if __name__ == '__main__':
|
|
145
|
+
class MyFancyClass(Base):
|
|
146
|
+
def __init__(self, **kwargs):
|
|
147
|
+
super().__init__(**kwargs)
|
|
148
|
+
pass
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
c = MyFancyClass(name="Hello Spencer")
|
|
152
|
+
print(c)
|
|
153
|
+
print(c.osname)
|
|
154
|
+
print(c.mdf)
|
|
155
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|