-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathui.py
70 lines (51 loc) · 1.58 KB
/
ui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import workspace.api
class Create:
def __init__(self, index):
self._index = index
for cls in workspace.list_of_variables:
setattr(Create,
cls.__name__.lower(),
getattr(workspace.api, workspace.create_fcn_name(cls)))
class HDF5File:
"""
Imports functions from api.py and serves as an interface for end user.
"""
def __init__(self, index):
self._index = index
self.create = Create(index)
def __repr__(self):
return repr(workspace.api.hdf5_files[self._index])
def close(self):
"""
Alias of ``api.close()``.
"""
workspace.api.close(self._index)
def flush(self):
"""
Alias of ``api.flush()``.
"""
workspace.api.flush(self._index)
class Interface:
"""
Imports functions from api.py and serves as an interface for end user.
:Object: **vars**: List of all variables available in the interactive namespace.
:Object: **compression**: Dictionary that contains dataset compression parameters.
"""
vars = workspace.api.variables
compression = workspace.api.compression
def __repr__(self):
return repr(workspace.api.hdf5_files)
def __getitem__(self, index):
return HDF5File(index)
def __iter__(self):
return iter(workspace.api.hdf5_files)
def add(self, filename, mode='a'):
"""
Alias of ``api.add()``.
"""
workspace.api.add(filename, mode)
def clear(self):
"""
Alias of ``api.clear()``.
"""
workspace.api.clear()