kmisc 2.1.104__tar.gz → 2.1.105__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.
- kmisc-2.1.105/PKG-INFO +268 -0
- {kmisc-2.1.104 → kmisc-2.1.105}/kmisc/__init__.py +1 -1
- kmisc-2.1.105/kmisc.egg-info/PKG-INFO +268 -0
- kmisc-2.1.104/PKG-INFO +0 -267
- kmisc-2.1.104/kmisc.egg-info/PKG-INFO +0 -267
- {kmisc-2.1.104 → kmisc-2.1.105}/LICENSE +0 -0
- {kmisc-2.1.104 → kmisc-2.1.105}/README.md +0 -0
- {kmisc-2.1.104 → kmisc-2.1.105}/kmisc.egg-info/SOURCES.txt +0 -0
- {kmisc-2.1.104 → kmisc-2.1.105}/kmisc.egg-info/dependency_links.txt +0 -0
- {kmisc-2.1.104 → kmisc-2.1.105}/kmisc.egg-info/top_level.txt +0 -0
- {kmisc-2.1.104 → kmisc-2.1.105}/pyproject.toml +0 -0
- {kmisc-2.1.104 → kmisc-2.1.105}/setup.cfg +0 -0
- {kmisc-2.1.104 → kmisc-2.1.105}/setup.py +0 -0
kmisc-2.1.105/PKG-INFO
ADDED
@@ -0,0 +1,268 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: kmisc
|
3
|
+
Version: 2.1.105
|
4
|
+
Summary: Enginering useful library
|
5
|
+
Home-page: https://github.com/kagepark/kmisc
|
6
|
+
Author: Kage Park
|
7
|
+
License: MIT
|
8
|
+
Description: Open Kage's useful tools and class to public.
|
9
|
+
(Long time used and upgraded)
|
10
|
+
But, this is develope version.
|
11
|
+
So, suddenly it will be big change when I got some more good idea.
|
12
|
+
I re-groupped to library.
|
13
|
+
and change name to klib
|
14
|
+
|
15
|
+
# Install
|
16
|
+
```javascript
|
17
|
+
pip3 install kmisc
|
18
|
+
```
|
19
|
+
|
20
|
+
# Import functions
|
21
|
+
|
22
|
+
# Custom Dictionary Class
|
23
|
+
|
24
|
+
Convert Dictionary to Object style Dictionary
|
25
|
+
## Contents
|
26
|
+
1. Create tree type items
|
27
|
+
1. Added New commands
|
28
|
+
1. Put() : Put value at a item
|
29
|
+
1. Get() : Get value of item
|
30
|
+
1. Del() : Delete item
|
31
|
+
1. Update() : Update value at item
|
32
|
+
1. Print() : Print dictionary
|
33
|
+
1. Diff() : Compare two dictionary
|
34
|
+
1. Check() : Check put the value is same as the item(key)'s value
|
35
|
+
1. List() : Return list of keys value
|
36
|
+
1. Proper() : Show/Set/Update property at the item.
|
37
|
+
1. Find() : Find data in the dictionary
|
38
|
+
1. Load() : Load saved data from file
|
39
|
+
1. Save() : dictionary save to file
|
40
|
+
1. Sort() : Sort dictionary
|
41
|
+
1. FirstKey(): Get first Key
|
42
|
+
1. FirstKey(): Get first Key
|
43
|
+
1. Added property at each key
|
44
|
+
|
45
|
+
- Initialize dictionary
|
46
|
+
|
47
|
+
|
48
|
+
```javascript
|
49
|
+
from kmisc import kDict
|
50
|
+
root=kDict.kDict()
|
51
|
+
```
|
52
|
+
|
53
|
+
```javascript
|
54
|
+
from kmisc import kDict
|
55
|
+
>>> test={
|
56
|
+
'a':123,
|
57
|
+
'b':{
|
58
|
+
'c':{'ddd'},
|
59
|
+
'e':{}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
root=kDict.kDict(test)
|
63
|
+
```
|
64
|
+
|
65
|
+
- Add new data
|
66
|
+
|
67
|
+
```javascript
|
68
|
+
>>> root.tree.apple.color='red'
|
69
|
+
```
|
70
|
+
or
|
71
|
+
|
72
|
+
```javascript
|
73
|
+
>>> root.tree.apple.Put('color','red')
|
74
|
+
```
|
75
|
+
or
|
76
|
+
```javascript
|
77
|
+
>>> root.tree.apple['color']='red'
|
78
|
+
```
|
79
|
+
- Get data
|
80
|
+
```javascript
|
81
|
+
>>> root.tree.apple.color.Get()
|
82
|
+
```
|
83
|
+
or
|
84
|
+
```javascript
|
85
|
+
>>> root.tree.apple.Get('color')
|
86
|
+
```
|
87
|
+
- Print dictionary
|
88
|
+
```javascript
|
89
|
+
>>> root.Print()
|
90
|
+
>>> root.tree.Print()
|
91
|
+
```
|
92
|
+
- Set property at Apple's color
|
93
|
+
|
94
|
+
- Set readonly
|
95
|
+
```javascript
|
96
|
+
>>> root.tree.apple.color.Proper('readonly',True)
|
97
|
+
```
|
98
|
+
- Try change data
|
99
|
+
```javascript
|
100
|
+
>>> root.tree.apple.Put('color','white')
|
101
|
+
item is readonly
|
102
|
+
|
103
|
+
>>> root.tree.Print()
|
104
|
+
{'color': {'._d': 'red', '._p': {'readonly': True}}}
|
105
|
+
```
|
106
|
+
- Unset readonly
|
107
|
+
```javascript
|
108
|
+
>>> root.tree.apple.color.Proper('readonly',False)
|
109
|
+
```
|
110
|
+
- Try change data
|
111
|
+
```javascript
|
112
|
+
>>> root.tree.apple.Put('color','white')
|
113
|
+
>>> root.tree.Print()
|
114
|
+
{'color': {'._d': 'red', '._p': {'readonly': True}}}
|
115
|
+
```
|
116
|
+
Sample Dictionary:
|
117
|
+
```javascript
|
118
|
+
{'a': 123,
|
119
|
+
'b': {'c': set(['ddd']), 'e': {}, 'z': 123},
|
120
|
+
'tree': {'apple': {'color': {'._d': 'white', '._p': {'readonly': False}}},
|
121
|
+
'banana': {'banana2': {'._d': 'white', '._p': {}},
|
122
|
+
'banana3': {'._d': 'yellow', '._p': {}},
|
123
|
+
'color': {'._d': 'yellow', '._p': {'readonly': True}}},
|
124
|
+
'yellow': {'monkey': {'._d': 'white', '._p': {}}}}}
|
125
|
+
```
|
126
|
+
- Find readonly property item path
|
127
|
+
```javascript
|
128
|
+
>>> root.Find('readonly',property=True)
|
129
|
+
['tree/banana/color']
|
130
|
+
```
|
131
|
+
- Find apple key path
|
132
|
+
```javascript
|
133
|
+
>>> root.Find('apple',mode='key')
|
134
|
+
['tree/apple']
|
135
|
+
```
|
136
|
+
- Find white color data path
|
137
|
+
```javascript
|
138
|
+
>>> root.Find('white')
|
139
|
+
['tree/apple/color', 'tree/yellow/monkey', 'tree/banana/banana2']
|
140
|
+
```
|
141
|
+
- Find 123 data path
|
142
|
+
```javascript
|
143
|
+
>>> root.Find('white')
|
144
|
+
['a', 'b/z']
|
145
|
+
```
|
146
|
+
- Find white color data path in key and value
|
147
|
+
```javascript
|
148
|
+
>>> root.Find('yellow',mode='all')
|
149
|
+
['tree/yellow', 'tree/banana/color', 'tree/banana/banana3']
|
150
|
+
```
|
151
|
+
- Save Data (always use root if not then save partial data)
|
152
|
+
```javascript
|
153
|
+
>>> from kmisc import kDict
|
154
|
+
>>> kDict.kDict._dfile_='<dict file name>'
|
155
|
+
>>> root.Save()
|
156
|
+
```
|
157
|
+
- Load Data (always use root if not then load at key)
|
158
|
+
```javascript
|
159
|
+
>>> from kmisc import kDict
|
160
|
+
>>> kDict.kDict._dfile_='<dict file name>'
|
161
|
+
>>> root.Load()
|
162
|
+
```
|
163
|
+
# MISC functions
|
164
|
+
Useful commands
|
165
|
+
|
166
|
+
Type : Similar as isinstance(<obj>,(chk,type))
|
167
|
+
```javascript
|
168
|
+
>>> import kmisc as km
|
169
|
+
>>> km.Type('abc','str')
|
170
|
+
>>> True
|
171
|
+
>>> km.Type('abc',str)
|
172
|
+
>>> True
|
173
|
+
```
|
174
|
+
|
175
|
+
Copy: copy data for list,dict,str,int,tuple...
|
176
|
+
|
177
|
+
```javascript
|
178
|
+
>>> new_data=Copy(<data>)
|
179
|
+
```
|
180
|
+
|
181
|
+
Join : Similar as os.path().join()
|
182
|
+
Joining data of bytes,string,....
|
183
|
+
|
184
|
+
Next: Get data from list,tuple,dict,string
|
185
|
+
|
186
|
+
Delete : Delete data in list,tuple,dict,str
|
187
|
+
|
188
|
+
COLOR : class for console,html color string
|
189
|
+
|
190
|
+
FIND : find string or format data
|
191
|
+
|
192
|
+
DIFF : diff between data
|
193
|
+
|
194
|
+
LIST : handle list()
|
195
|
+
|
196
|
+
STR: handle string
|
197
|
+
|
198
|
+
TIME : handle time formats
|
199
|
+
|
200
|
+
SHELL : handle command run,progress,....
|
201
|
+
|
202
|
+
BYTES: handle byte data
|
203
|
+
|
204
|
+
CONVERT : data converter
|
205
|
+
|
206
|
+
MAC : handle mac address
|
207
|
+
|
208
|
+
VERSION : handle version
|
209
|
+
|
210
|
+
IP : handle IP address
|
211
|
+
|
212
|
+
GET: getting data from anywhere
|
213
|
+
|
214
|
+
IS: check the data
|
215
|
+
|
216
|
+
LOG: handle log data
|
217
|
+
|
218
|
+
HOST: handle Host Information
|
219
|
+
|
220
|
+
FILE: handle File (Read/Write)
|
221
|
+
|
222
|
+
WEB: handle web protocol data
|
223
|
+
|
224
|
+
EMAIL: handle email data
|
225
|
+
|
226
|
+
ANSI : handle hansi data
|
227
|
+
|
228
|
+
Multiprocessor : handle multi processing
|
229
|
+
|
230
|
+
FUNCTION: handle function information
|
231
|
+
|
232
|
+
SCREEN: handle ipmi SOL
|
233
|
+
|
234
|
+
CLI : handle Command Line Interface
|
235
|
+
|
236
|
+
Cut: cutting string to format
|
237
|
+
|
238
|
+
Get: Getting data from anywhere
|
239
|
+
|
240
|
+
Replace : replace string data
|
241
|
+
|
242
|
+
Insert : add data
|
243
|
+
|
244
|
+
Update: update data
|
245
|
+
|
246
|
+
printf : similar as printf in c
|
247
|
+
|
248
|
+
sprintf : similar as sprintf in c
|
249
|
+
|
250
|
+
Sort : sorting data
|
251
|
+
|
252
|
+
findXML : Get XML data
|
253
|
+
|
254
|
+
cat : similar as linux cat command
|
255
|
+
|
256
|
+
ls : similar as linux ls command
|
257
|
+
|
258
|
+
IsSame: check both data is same or not
|
259
|
+
|
260
|
+
etc...
|
261
|
+
|
262
|
+
Platform: UNKNOWN
|
263
|
+
Classifier: Programming Language :: Python :: 2
|
264
|
+
Classifier: Programming Language :: Python :: 3
|
265
|
+
Classifier: License :: OSI Approved :: MIT License
|
266
|
+
Classifier: Operating System :: OS Independent
|
267
|
+
Description-Content-Type: text/markdown
|
268
|
+
License-File: LICENSE
|
@@ -2452,7 +2452,7 @@ def find_cdrom_dev(size=None):
|
|
2452
2452
|
if os.path.isfile('{0}/device/model'.format(rrr)):
|
2453
2453
|
with open('{0}/device/model'.format(rrr),'r') as fpp:
|
2454
2454
|
model=fpp.read()
|
2455
|
-
for ii in ['CDROM','DVD-ROM','DVD-RW']:
|
2455
|
+
for ii in ['CDROM','DVD-ROM','DVD-RW','File-Stor Gadget']: #File-Stor Gadget for OpenBMC's cdrom
|
2456
2456
|
if ii in model:
|
2457
2457
|
if IsNone(size):
|
2458
2458
|
return '/dev/{0}'.format(dd)
|
@@ -0,0 +1,268 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: kmisc
|
3
|
+
Version: 2.1.105
|
4
|
+
Summary: Enginering useful library
|
5
|
+
Home-page: https://github.com/kagepark/kmisc
|
6
|
+
Author: Kage Park
|
7
|
+
License: MIT
|
8
|
+
Description: Open Kage's useful tools and class to public.
|
9
|
+
(Long time used and upgraded)
|
10
|
+
But, this is develope version.
|
11
|
+
So, suddenly it will be big change when I got some more good idea.
|
12
|
+
I re-groupped to library.
|
13
|
+
and change name to klib
|
14
|
+
|
15
|
+
# Install
|
16
|
+
```javascript
|
17
|
+
pip3 install kmisc
|
18
|
+
```
|
19
|
+
|
20
|
+
# Import functions
|
21
|
+
|
22
|
+
# Custom Dictionary Class
|
23
|
+
|
24
|
+
Convert Dictionary to Object style Dictionary
|
25
|
+
## Contents
|
26
|
+
1. Create tree type items
|
27
|
+
1. Added New commands
|
28
|
+
1. Put() : Put value at a item
|
29
|
+
1. Get() : Get value of item
|
30
|
+
1. Del() : Delete item
|
31
|
+
1. Update() : Update value at item
|
32
|
+
1. Print() : Print dictionary
|
33
|
+
1. Diff() : Compare two dictionary
|
34
|
+
1. Check() : Check put the value is same as the item(key)'s value
|
35
|
+
1. List() : Return list of keys value
|
36
|
+
1. Proper() : Show/Set/Update property at the item.
|
37
|
+
1. Find() : Find data in the dictionary
|
38
|
+
1. Load() : Load saved data from file
|
39
|
+
1. Save() : dictionary save to file
|
40
|
+
1. Sort() : Sort dictionary
|
41
|
+
1. FirstKey(): Get first Key
|
42
|
+
1. FirstKey(): Get first Key
|
43
|
+
1. Added property at each key
|
44
|
+
|
45
|
+
- Initialize dictionary
|
46
|
+
|
47
|
+
|
48
|
+
```javascript
|
49
|
+
from kmisc import kDict
|
50
|
+
root=kDict.kDict()
|
51
|
+
```
|
52
|
+
|
53
|
+
```javascript
|
54
|
+
from kmisc import kDict
|
55
|
+
>>> test={
|
56
|
+
'a':123,
|
57
|
+
'b':{
|
58
|
+
'c':{'ddd'},
|
59
|
+
'e':{}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
root=kDict.kDict(test)
|
63
|
+
```
|
64
|
+
|
65
|
+
- Add new data
|
66
|
+
|
67
|
+
```javascript
|
68
|
+
>>> root.tree.apple.color='red'
|
69
|
+
```
|
70
|
+
or
|
71
|
+
|
72
|
+
```javascript
|
73
|
+
>>> root.tree.apple.Put('color','red')
|
74
|
+
```
|
75
|
+
or
|
76
|
+
```javascript
|
77
|
+
>>> root.tree.apple['color']='red'
|
78
|
+
```
|
79
|
+
- Get data
|
80
|
+
```javascript
|
81
|
+
>>> root.tree.apple.color.Get()
|
82
|
+
```
|
83
|
+
or
|
84
|
+
```javascript
|
85
|
+
>>> root.tree.apple.Get('color')
|
86
|
+
```
|
87
|
+
- Print dictionary
|
88
|
+
```javascript
|
89
|
+
>>> root.Print()
|
90
|
+
>>> root.tree.Print()
|
91
|
+
```
|
92
|
+
- Set property at Apple's color
|
93
|
+
|
94
|
+
- Set readonly
|
95
|
+
```javascript
|
96
|
+
>>> root.tree.apple.color.Proper('readonly',True)
|
97
|
+
```
|
98
|
+
- Try change data
|
99
|
+
```javascript
|
100
|
+
>>> root.tree.apple.Put('color','white')
|
101
|
+
item is readonly
|
102
|
+
|
103
|
+
>>> root.tree.Print()
|
104
|
+
{'color': {'._d': 'red', '._p': {'readonly': True}}}
|
105
|
+
```
|
106
|
+
- Unset readonly
|
107
|
+
```javascript
|
108
|
+
>>> root.tree.apple.color.Proper('readonly',False)
|
109
|
+
```
|
110
|
+
- Try change data
|
111
|
+
```javascript
|
112
|
+
>>> root.tree.apple.Put('color','white')
|
113
|
+
>>> root.tree.Print()
|
114
|
+
{'color': {'._d': 'red', '._p': {'readonly': True}}}
|
115
|
+
```
|
116
|
+
Sample Dictionary:
|
117
|
+
```javascript
|
118
|
+
{'a': 123,
|
119
|
+
'b': {'c': set(['ddd']), 'e': {}, 'z': 123},
|
120
|
+
'tree': {'apple': {'color': {'._d': 'white', '._p': {'readonly': False}}},
|
121
|
+
'banana': {'banana2': {'._d': 'white', '._p': {}},
|
122
|
+
'banana3': {'._d': 'yellow', '._p': {}},
|
123
|
+
'color': {'._d': 'yellow', '._p': {'readonly': True}}},
|
124
|
+
'yellow': {'monkey': {'._d': 'white', '._p': {}}}}}
|
125
|
+
```
|
126
|
+
- Find readonly property item path
|
127
|
+
```javascript
|
128
|
+
>>> root.Find('readonly',property=True)
|
129
|
+
['tree/banana/color']
|
130
|
+
```
|
131
|
+
- Find apple key path
|
132
|
+
```javascript
|
133
|
+
>>> root.Find('apple',mode='key')
|
134
|
+
['tree/apple']
|
135
|
+
```
|
136
|
+
- Find white color data path
|
137
|
+
```javascript
|
138
|
+
>>> root.Find('white')
|
139
|
+
['tree/apple/color', 'tree/yellow/monkey', 'tree/banana/banana2']
|
140
|
+
```
|
141
|
+
- Find 123 data path
|
142
|
+
```javascript
|
143
|
+
>>> root.Find('white')
|
144
|
+
['a', 'b/z']
|
145
|
+
```
|
146
|
+
- Find white color data path in key and value
|
147
|
+
```javascript
|
148
|
+
>>> root.Find('yellow',mode='all')
|
149
|
+
['tree/yellow', 'tree/banana/color', 'tree/banana/banana3']
|
150
|
+
```
|
151
|
+
- Save Data (always use root if not then save partial data)
|
152
|
+
```javascript
|
153
|
+
>>> from kmisc import kDict
|
154
|
+
>>> kDict.kDict._dfile_='<dict file name>'
|
155
|
+
>>> root.Save()
|
156
|
+
```
|
157
|
+
- Load Data (always use root if not then load at key)
|
158
|
+
```javascript
|
159
|
+
>>> from kmisc import kDict
|
160
|
+
>>> kDict.kDict._dfile_='<dict file name>'
|
161
|
+
>>> root.Load()
|
162
|
+
```
|
163
|
+
# MISC functions
|
164
|
+
Useful commands
|
165
|
+
|
166
|
+
Type : Similar as isinstance(<obj>,(chk,type))
|
167
|
+
```javascript
|
168
|
+
>>> import kmisc as km
|
169
|
+
>>> km.Type('abc','str')
|
170
|
+
>>> True
|
171
|
+
>>> km.Type('abc',str)
|
172
|
+
>>> True
|
173
|
+
```
|
174
|
+
|
175
|
+
Copy: copy data for list,dict,str,int,tuple...
|
176
|
+
|
177
|
+
```javascript
|
178
|
+
>>> new_data=Copy(<data>)
|
179
|
+
```
|
180
|
+
|
181
|
+
Join : Similar as os.path().join()
|
182
|
+
Joining data of bytes,string,....
|
183
|
+
|
184
|
+
Next: Get data from list,tuple,dict,string
|
185
|
+
|
186
|
+
Delete : Delete data in list,tuple,dict,str
|
187
|
+
|
188
|
+
COLOR : class for console,html color string
|
189
|
+
|
190
|
+
FIND : find string or format data
|
191
|
+
|
192
|
+
DIFF : diff between data
|
193
|
+
|
194
|
+
LIST : handle list()
|
195
|
+
|
196
|
+
STR: handle string
|
197
|
+
|
198
|
+
TIME : handle time formats
|
199
|
+
|
200
|
+
SHELL : handle command run,progress,....
|
201
|
+
|
202
|
+
BYTES: handle byte data
|
203
|
+
|
204
|
+
CONVERT : data converter
|
205
|
+
|
206
|
+
MAC : handle mac address
|
207
|
+
|
208
|
+
VERSION : handle version
|
209
|
+
|
210
|
+
IP : handle IP address
|
211
|
+
|
212
|
+
GET: getting data from anywhere
|
213
|
+
|
214
|
+
IS: check the data
|
215
|
+
|
216
|
+
LOG: handle log data
|
217
|
+
|
218
|
+
HOST: handle Host Information
|
219
|
+
|
220
|
+
FILE: handle File (Read/Write)
|
221
|
+
|
222
|
+
WEB: handle web protocol data
|
223
|
+
|
224
|
+
EMAIL: handle email data
|
225
|
+
|
226
|
+
ANSI : handle hansi data
|
227
|
+
|
228
|
+
Multiprocessor : handle multi processing
|
229
|
+
|
230
|
+
FUNCTION: handle function information
|
231
|
+
|
232
|
+
SCREEN: handle ipmi SOL
|
233
|
+
|
234
|
+
CLI : handle Command Line Interface
|
235
|
+
|
236
|
+
Cut: cutting string to format
|
237
|
+
|
238
|
+
Get: Getting data from anywhere
|
239
|
+
|
240
|
+
Replace : replace string data
|
241
|
+
|
242
|
+
Insert : add data
|
243
|
+
|
244
|
+
Update: update data
|
245
|
+
|
246
|
+
printf : similar as printf in c
|
247
|
+
|
248
|
+
sprintf : similar as sprintf in c
|
249
|
+
|
250
|
+
Sort : sorting data
|
251
|
+
|
252
|
+
findXML : Get XML data
|
253
|
+
|
254
|
+
cat : similar as linux cat command
|
255
|
+
|
256
|
+
ls : similar as linux ls command
|
257
|
+
|
258
|
+
IsSame: check both data is same or not
|
259
|
+
|
260
|
+
etc...
|
261
|
+
|
262
|
+
Platform: UNKNOWN
|
263
|
+
Classifier: Programming Language :: Python :: 2
|
264
|
+
Classifier: Programming Language :: Python :: 3
|
265
|
+
Classifier: License :: OSI Approved :: MIT License
|
266
|
+
Classifier: Operating System :: OS Independent
|
267
|
+
Description-Content-Type: text/markdown
|
268
|
+
License-File: LICENSE
|
kmisc-2.1.104/PKG-INFO
DELETED
@@ -1,267 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: kmisc
|
3
|
-
Version: 2.1.104
|
4
|
-
Summary: Enginering useful library
|
5
|
-
Home-page: https://github.com/kagepark/kmisc
|
6
|
-
Author: Kage Park
|
7
|
-
License: MIT
|
8
|
-
Classifier: Programming Language :: Python :: 2
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
11
|
-
Classifier: Operating System :: OS Independent
|
12
|
-
Description-Content-Type: text/markdown
|
13
|
-
License-File: LICENSE
|
14
|
-
|
15
|
-
Open Kage's useful tools and class to public.
|
16
|
-
(Long time used and upgraded)
|
17
|
-
But, this is develope version.
|
18
|
-
So, suddenly it will be big change when I got some more good idea.
|
19
|
-
I re-groupped to library.
|
20
|
-
and change name to klib
|
21
|
-
|
22
|
-
# Install
|
23
|
-
```javascript
|
24
|
-
pip3 install kmisc
|
25
|
-
```
|
26
|
-
|
27
|
-
# Import functions
|
28
|
-
|
29
|
-
# Custom Dictionary Class
|
30
|
-
|
31
|
-
Convert Dictionary to Object style Dictionary
|
32
|
-
## Contents
|
33
|
-
1. Create tree type items
|
34
|
-
1. Added New commands
|
35
|
-
1. Put() : Put value at a item
|
36
|
-
1. Get() : Get value of item
|
37
|
-
1. Del() : Delete item
|
38
|
-
1. Update() : Update value at item
|
39
|
-
1. Print() : Print dictionary
|
40
|
-
1. Diff() : Compare two dictionary
|
41
|
-
1. Check() : Check put the value is same as the item(key)'s value
|
42
|
-
1. List() : Return list of keys value
|
43
|
-
1. Proper() : Show/Set/Update property at the item.
|
44
|
-
1. Find() : Find data in the dictionary
|
45
|
-
1. Load() : Load saved data from file
|
46
|
-
1. Save() : dictionary save to file
|
47
|
-
1. Sort() : Sort dictionary
|
48
|
-
1. FirstKey(): Get first Key
|
49
|
-
1. FirstKey(): Get first Key
|
50
|
-
1. Added property at each key
|
51
|
-
|
52
|
-
- Initialize dictionary
|
53
|
-
|
54
|
-
|
55
|
-
```javascript
|
56
|
-
from kmisc import kDict
|
57
|
-
root=kDict.kDict()
|
58
|
-
```
|
59
|
-
|
60
|
-
```javascript
|
61
|
-
from kmisc import kDict
|
62
|
-
>>> test={
|
63
|
-
'a':123,
|
64
|
-
'b':{
|
65
|
-
'c':{'ddd'},
|
66
|
-
'e':{}
|
67
|
-
}
|
68
|
-
}
|
69
|
-
root=kDict.kDict(test)
|
70
|
-
```
|
71
|
-
|
72
|
-
- Add new data
|
73
|
-
|
74
|
-
```javascript
|
75
|
-
>>> root.tree.apple.color='red'
|
76
|
-
```
|
77
|
-
or
|
78
|
-
|
79
|
-
```javascript
|
80
|
-
>>> root.tree.apple.Put('color','red')
|
81
|
-
```
|
82
|
-
or
|
83
|
-
```javascript
|
84
|
-
>>> root.tree.apple['color']='red'
|
85
|
-
```
|
86
|
-
- Get data
|
87
|
-
```javascript
|
88
|
-
>>> root.tree.apple.color.Get()
|
89
|
-
```
|
90
|
-
or
|
91
|
-
```javascript
|
92
|
-
>>> root.tree.apple.Get('color')
|
93
|
-
```
|
94
|
-
- Print dictionary
|
95
|
-
```javascript
|
96
|
-
>>> root.Print()
|
97
|
-
>>> root.tree.Print()
|
98
|
-
```
|
99
|
-
- Set property at Apple's color
|
100
|
-
|
101
|
-
- Set readonly
|
102
|
-
```javascript
|
103
|
-
>>> root.tree.apple.color.Proper('readonly',True)
|
104
|
-
```
|
105
|
-
- Try change data
|
106
|
-
```javascript
|
107
|
-
>>> root.tree.apple.Put('color','white')
|
108
|
-
item is readonly
|
109
|
-
|
110
|
-
>>> root.tree.Print()
|
111
|
-
{'color': {'._d': 'red', '._p': {'readonly': True}}}
|
112
|
-
```
|
113
|
-
- Unset readonly
|
114
|
-
```javascript
|
115
|
-
>>> root.tree.apple.color.Proper('readonly',False)
|
116
|
-
```
|
117
|
-
- Try change data
|
118
|
-
```javascript
|
119
|
-
>>> root.tree.apple.Put('color','white')
|
120
|
-
>>> root.tree.Print()
|
121
|
-
{'color': {'._d': 'red', '._p': {'readonly': True}}}
|
122
|
-
```
|
123
|
-
Sample Dictionary:
|
124
|
-
```javascript
|
125
|
-
{'a': 123,
|
126
|
-
'b': {'c': set(['ddd']), 'e': {}, 'z': 123},
|
127
|
-
'tree': {'apple': {'color': {'._d': 'white', '._p': {'readonly': False}}},
|
128
|
-
'banana': {'banana2': {'._d': 'white', '._p': {}},
|
129
|
-
'banana3': {'._d': 'yellow', '._p': {}},
|
130
|
-
'color': {'._d': 'yellow', '._p': {'readonly': True}}},
|
131
|
-
'yellow': {'monkey': {'._d': 'white', '._p': {}}}}}
|
132
|
-
```
|
133
|
-
- Find readonly property item path
|
134
|
-
```javascript
|
135
|
-
>>> root.Find('readonly',property=True)
|
136
|
-
['tree/banana/color']
|
137
|
-
```
|
138
|
-
- Find apple key path
|
139
|
-
```javascript
|
140
|
-
>>> root.Find('apple',mode='key')
|
141
|
-
['tree/apple']
|
142
|
-
```
|
143
|
-
- Find white color data path
|
144
|
-
```javascript
|
145
|
-
>>> root.Find('white')
|
146
|
-
['tree/apple/color', 'tree/yellow/monkey', 'tree/banana/banana2']
|
147
|
-
```
|
148
|
-
- Find 123 data path
|
149
|
-
```javascript
|
150
|
-
>>> root.Find('white')
|
151
|
-
['a', 'b/z']
|
152
|
-
```
|
153
|
-
- Find white color data path in key and value
|
154
|
-
```javascript
|
155
|
-
>>> root.Find('yellow',mode='all')
|
156
|
-
['tree/yellow', 'tree/banana/color', 'tree/banana/banana3']
|
157
|
-
```
|
158
|
-
- Save Data (always use root if not then save partial data)
|
159
|
-
```javascript
|
160
|
-
>>> from kmisc import kDict
|
161
|
-
>>> kDict.kDict._dfile_='<dict file name>'
|
162
|
-
>>> root.Save()
|
163
|
-
```
|
164
|
-
- Load Data (always use root if not then load at key)
|
165
|
-
```javascript
|
166
|
-
>>> from kmisc import kDict
|
167
|
-
>>> kDict.kDict._dfile_='<dict file name>'
|
168
|
-
>>> root.Load()
|
169
|
-
```
|
170
|
-
# MISC functions
|
171
|
-
Useful commands
|
172
|
-
|
173
|
-
Type : Similar as isinstance(<obj>,(chk,type))
|
174
|
-
```javascript
|
175
|
-
>>> import kmisc as km
|
176
|
-
>>> km.Type('abc','str')
|
177
|
-
>>> True
|
178
|
-
>>> km.Type('abc',str)
|
179
|
-
>>> True
|
180
|
-
```
|
181
|
-
|
182
|
-
Copy: copy data for list,dict,str,int,tuple...
|
183
|
-
|
184
|
-
```javascript
|
185
|
-
>>> new_data=Copy(<data>)
|
186
|
-
```
|
187
|
-
|
188
|
-
Join : Similar as os.path().join()
|
189
|
-
Joining data of bytes,string,....
|
190
|
-
|
191
|
-
Next: Get data from list,tuple,dict,string
|
192
|
-
|
193
|
-
Delete : Delete data in list,tuple,dict,str
|
194
|
-
|
195
|
-
COLOR : class for console,html color string
|
196
|
-
|
197
|
-
FIND : find string or format data
|
198
|
-
|
199
|
-
DIFF : diff between data
|
200
|
-
|
201
|
-
LIST : handle list()
|
202
|
-
|
203
|
-
STR: handle string
|
204
|
-
|
205
|
-
TIME : handle time formats
|
206
|
-
|
207
|
-
SHELL : handle command run,progress,....
|
208
|
-
|
209
|
-
BYTES: handle byte data
|
210
|
-
|
211
|
-
CONVERT : data converter
|
212
|
-
|
213
|
-
MAC : handle mac address
|
214
|
-
|
215
|
-
VERSION : handle version
|
216
|
-
|
217
|
-
IP : handle IP address
|
218
|
-
|
219
|
-
GET: getting data from anywhere
|
220
|
-
|
221
|
-
IS: check the data
|
222
|
-
|
223
|
-
LOG: handle log data
|
224
|
-
|
225
|
-
HOST: handle Host Information
|
226
|
-
|
227
|
-
FILE: handle File (Read/Write)
|
228
|
-
|
229
|
-
WEB: handle web protocol data
|
230
|
-
|
231
|
-
EMAIL: handle email data
|
232
|
-
|
233
|
-
ANSI : handle hansi data
|
234
|
-
|
235
|
-
Multiprocessor : handle multi processing
|
236
|
-
|
237
|
-
FUNCTION: handle function information
|
238
|
-
|
239
|
-
SCREEN: handle ipmi SOL
|
240
|
-
|
241
|
-
CLI : handle Command Line Interface
|
242
|
-
|
243
|
-
Cut: cutting string to format
|
244
|
-
|
245
|
-
Get: Getting data from anywhere
|
246
|
-
|
247
|
-
Replace : replace string data
|
248
|
-
|
249
|
-
Insert : add data
|
250
|
-
|
251
|
-
Update: update data
|
252
|
-
|
253
|
-
printf : similar as printf in c
|
254
|
-
|
255
|
-
sprintf : similar as sprintf in c
|
256
|
-
|
257
|
-
Sort : sorting data
|
258
|
-
|
259
|
-
findXML : Get XML data
|
260
|
-
|
261
|
-
cat : similar as linux cat command
|
262
|
-
|
263
|
-
ls : similar as linux ls command
|
264
|
-
|
265
|
-
IsSame: check both data is same or not
|
266
|
-
|
267
|
-
etc...
|
@@ -1,267 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: kmisc
|
3
|
-
Version: 2.1.104
|
4
|
-
Summary: Enginering useful library
|
5
|
-
Home-page: https://github.com/kagepark/kmisc
|
6
|
-
Author: Kage Park
|
7
|
-
License: MIT
|
8
|
-
Classifier: Programming Language :: Python :: 2
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
11
|
-
Classifier: Operating System :: OS Independent
|
12
|
-
Description-Content-Type: text/markdown
|
13
|
-
License-File: LICENSE
|
14
|
-
|
15
|
-
Open Kage's useful tools and class to public.
|
16
|
-
(Long time used and upgraded)
|
17
|
-
But, this is develope version.
|
18
|
-
So, suddenly it will be big change when I got some more good idea.
|
19
|
-
I re-groupped to library.
|
20
|
-
and change name to klib
|
21
|
-
|
22
|
-
# Install
|
23
|
-
```javascript
|
24
|
-
pip3 install kmisc
|
25
|
-
```
|
26
|
-
|
27
|
-
# Import functions
|
28
|
-
|
29
|
-
# Custom Dictionary Class
|
30
|
-
|
31
|
-
Convert Dictionary to Object style Dictionary
|
32
|
-
## Contents
|
33
|
-
1. Create tree type items
|
34
|
-
1. Added New commands
|
35
|
-
1. Put() : Put value at a item
|
36
|
-
1. Get() : Get value of item
|
37
|
-
1. Del() : Delete item
|
38
|
-
1. Update() : Update value at item
|
39
|
-
1. Print() : Print dictionary
|
40
|
-
1. Diff() : Compare two dictionary
|
41
|
-
1. Check() : Check put the value is same as the item(key)'s value
|
42
|
-
1. List() : Return list of keys value
|
43
|
-
1. Proper() : Show/Set/Update property at the item.
|
44
|
-
1. Find() : Find data in the dictionary
|
45
|
-
1. Load() : Load saved data from file
|
46
|
-
1. Save() : dictionary save to file
|
47
|
-
1. Sort() : Sort dictionary
|
48
|
-
1. FirstKey(): Get first Key
|
49
|
-
1. FirstKey(): Get first Key
|
50
|
-
1. Added property at each key
|
51
|
-
|
52
|
-
- Initialize dictionary
|
53
|
-
|
54
|
-
|
55
|
-
```javascript
|
56
|
-
from kmisc import kDict
|
57
|
-
root=kDict.kDict()
|
58
|
-
```
|
59
|
-
|
60
|
-
```javascript
|
61
|
-
from kmisc import kDict
|
62
|
-
>>> test={
|
63
|
-
'a':123,
|
64
|
-
'b':{
|
65
|
-
'c':{'ddd'},
|
66
|
-
'e':{}
|
67
|
-
}
|
68
|
-
}
|
69
|
-
root=kDict.kDict(test)
|
70
|
-
```
|
71
|
-
|
72
|
-
- Add new data
|
73
|
-
|
74
|
-
```javascript
|
75
|
-
>>> root.tree.apple.color='red'
|
76
|
-
```
|
77
|
-
or
|
78
|
-
|
79
|
-
```javascript
|
80
|
-
>>> root.tree.apple.Put('color','red')
|
81
|
-
```
|
82
|
-
or
|
83
|
-
```javascript
|
84
|
-
>>> root.tree.apple['color']='red'
|
85
|
-
```
|
86
|
-
- Get data
|
87
|
-
```javascript
|
88
|
-
>>> root.tree.apple.color.Get()
|
89
|
-
```
|
90
|
-
or
|
91
|
-
```javascript
|
92
|
-
>>> root.tree.apple.Get('color')
|
93
|
-
```
|
94
|
-
- Print dictionary
|
95
|
-
```javascript
|
96
|
-
>>> root.Print()
|
97
|
-
>>> root.tree.Print()
|
98
|
-
```
|
99
|
-
- Set property at Apple's color
|
100
|
-
|
101
|
-
- Set readonly
|
102
|
-
```javascript
|
103
|
-
>>> root.tree.apple.color.Proper('readonly',True)
|
104
|
-
```
|
105
|
-
- Try change data
|
106
|
-
```javascript
|
107
|
-
>>> root.tree.apple.Put('color','white')
|
108
|
-
item is readonly
|
109
|
-
|
110
|
-
>>> root.tree.Print()
|
111
|
-
{'color': {'._d': 'red', '._p': {'readonly': True}}}
|
112
|
-
```
|
113
|
-
- Unset readonly
|
114
|
-
```javascript
|
115
|
-
>>> root.tree.apple.color.Proper('readonly',False)
|
116
|
-
```
|
117
|
-
- Try change data
|
118
|
-
```javascript
|
119
|
-
>>> root.tree.apple.Put('color','white')
|
120
|
-
>>> root.tree.Print()
|
121
|
-
{'color': {'._d': 'red', '._p': {'readonly': True}}}
|
122
|
-
```
|
123
|
-
Sample Dictionary:
|
124
|
-
```javascript
|
125
|
-
{'a': 123,
|
126
|
-
'b': {'c': set(['ddd']), 'e': {}, 'z': 123},
|
127
|
-
'tree': {'apple': {'color': {'._d': 'white', '._p': {'readonly': False}}},
|
128
|
-
'banana': {'banana2': {'._d': 'white', '._p': {}},
|
129
|
-
'banana3': {'._d': 'yellow', '._p': {}},
|
130
|
-
'color': {'._d': 'yellow', '._p': {'readonly': True}}},
|
131
|
-
'yellow': {'monkey': {'._d': 'white', '._p': {}}}}}
|
132
|
-
```
|
133
|
-
- Find readonly property item path
|
134
|
-
```javascript
|
135
|
-
>>> root.Find('readonly',property=True)
|
136
|
-
['tree/banana/color']
|
137
|
-
```
|
138
|
-
- Find apple key path
|
139
|
-
```javascript
|
140
|
-
>>> root.Find('apple',mode='key')
|
141
|
-
['tree/apple']
|
142
|
-
```
|
143
|
-
- Find white color data path
|
144
|
-
```javascript
|
145
|
-
>>> root.Find('white')
|
146
|
-
['tree/apple/color', 'tree/yellow/monkey', 'tree/banana/banana2']
|
147
|
-
```
|
148
|
-
- Find 123 data path
|
149
|
-
```javascript
|
150
|
-
>>> root.Find('white')
|
151
|
-
['a', 'b/z']
|
152
|
-
```
|
153
|
-
- Find white color data path in key and value
|
154
|
-
```javascript
|
155
|
-
>>> root.Find('yellow',mode='all')
|
156
|
-
['tree/yellow', 'tree/banana/color', 'tree/banana/banana3']
|
157
|
-
```
|
158
|
-
- Save Data (always use root if not then save partial data)
|
159
|
-
```javascript
|
160
|
-
>>> from kmisc import kDict
|
161
|
-
>>> kDict.kDict._dfile_='<dict file name>'
|
162
|
-
>>> root.Save()
|
163
|
-
```
|
164
|
-
- Load Data (always use root if not then load at key)
|
165
|
-
```javascript
|
166
|
-
>>> from kmisc import kDict
|
167
|
-
>>> kDict.kDict._dfile_='<dict file name>'
|
168
|
-
>>> root.Load()
|
169
|
-
```
|
170
|
-
# MISC functions
|
171
|
-
Useful commands
|
172
|
-
|
173
|
-
Type : Similar as isinstance(<obj>,(chk,type))
|
174
|
-
```javascript
|
175
|
-
>>> import kmisc as km
|
176
|
-
>>> km.Type('abc','str')
|
177
|
-
>>> True
|
178
|
-
>>> km.Type('abc',str)
|
179
|
-
>>> True
|
180
|
-
```
|
181
|
-
|
182
|
-
Copy: copy data for list,dict,str,int,tuple...
|
183
|
-
|
184
|
-
```javascript
|
185
|
-
>>> new_data=Copy(<data>)
|
186
|
-
```
|
187
|
-
|
188
|
-
Join : Similar as os.path().join()
|
189
|
-
Joining data of bytes,string,....
|
190
|
-
|
191
|
-
Next: Get data from list,tuple,dict,string
|
192
|
-
|
193
|
-
Delete : Delete data in list,tuple,dict,str
|
194
|
-
|
195
|
-
COLOR : class for console,html color string
|
196
|
-
|
197
|
-
FIND : find string or format data
|
198
|
-
|
199
|
-
DIFF : diff between data
|
200
|
-
|
201
|
-
LIST : handle list()
|
202
|
-
|
203
|
-
STR: handle string
|
204
|
-
|
205
|
-
TIME : handle time formats
|
206
|
-
|
207
|
-
SHELL : handle command run,progress,....
|
208
|
-
|
209
|
-
BYTES: handle byte data
|
210
|
-
|
211
|
-
CONVERT : data converter
|
212
|
-
|
213
|
-
MAC : handle mac address
|
214
|
-
|
215
|
-
VERSION : handle version
|
216
|
-
|
217
|
-
IP : handle IP address
|
218
|
-
|
219
|
-
GET: getting data from anywhere
|
220
|
-
|
221
|
-
IS: check the data
|
222
|
-
|
223
|
-
LOG: handle log data
|
224
|
-
|
225
|
-
HOST: handle Host Information
|
226
|
-
|
227
|
-
FILE: handle File (Read/Write)
|
228
|
-
|
229
|
-
WEB: handle web protocol data
|
230
|
-
|
231
|
-
EMAIL: handle email data
|
232
|
-
|
233
|
-
ANSI : handle hansi data
|
234
|
-
|
235
|
-
Multiprocessor : handle multi processing
|
236
|
-
|
237
|
-
FUNCTION: handle function information
|
238
|
-
|
239
|
-
SCREEN: handle ipmi SOL
|
240
|
-
|
241
|
-
CLI : handle Command Line Interface
|
242
|
-
|
243
|
-
Cut: cutting string to format
|
244
|
-
|
245
|
-
Get: Getting data from anywhere
|
246
|
-
|
247
|
-
Replace : replace string data
|
248
|
-
|
249
|
-
Insert : add data
|
250
|
-
|
251
|
-
Update: update data
|
252
|
-
|
253
|
-
printf : similar as printf in c
|
254
|
-
|
255
|
-
sprintf : similar as sprintf in c
|
256
|
-
|
257
|
-
Sort : sorting data
|
258
|
-
|
259
|
-
findXML : Get XML data
|
260
|
-
|
261
|
-
cat : similar as linux cat command
|
262
|
-
|
263
|
-
ls : similar as linux ls command
|
264
|
-
|
265
|
-
IsSame: check both data is same or not
|
266
|
-
|
267
|
-
etc...
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|