kkpyutil 1.39.0__py3-none-any.whl → 1.40.0__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kkpyutil
3
- Version: 1.39.0
3
+ Version: 1.40.0
4
4
  Summary: Building blocks for sysadmin and DevOps
5
5
  Home-page: https://github.com/kakyoism/kkpyutil/
6
6
  License: MIT
@@ -0,0 +1,7 @@
1
+ kkpyutil.py,sha256=Lm_9sYcqDI9d_AR5qdvrn0fcMi6n1cWrGwOOC7d28ZE,111702
2
+ kkpyutil_helper/windows/kkttssave.ps1,sha256=xa3-WzqNh2rGYlOx_I4ewOuCE94gkTO5cEwYH0M67_0,446
3
+ kkpyutil_helper/windows/kkttsspeak.ps1,sha256=7WUUHMmjTQroUWA2Mvdt4JtSt475nZUHQx-qP-7rS6o,305
4
+ kkpyutil-1.40.0.dist-info/LICENSE,sha256=uISevGnCxB5QOU0ftbofN75_yUtd6E2h_MWE1zqagC8,1065
5
+ kkpyutil-1.40.0.dist-info/METADATA,sha256=OQeESTvqKUHtgPSSf5KwiKEZdBlVpsANpi5Hk9s882M,1136
6
+ kkpyutil-1.40.0.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
7
+ kkpyutil-1.40.0.dist-info/RECORD,,
kkpyutil.py CHANGED
@@ -2952,8 +2952,31 @@ def json_from_text(json_str):
2952
2952
  return None, e
2953
2953
 
2954
2954
 
2955
+ class OfflineJSON:
2956
+ def __init__(self, file_path):
2957
+ self.path = file_path
2958
+
2959
+ def exists(self):
2960
+ return osp.isfile(self.path)
2961
+
2962
+ def load(self):
2963
+ return load_json(self.path) if self.exists() else None
2964
+
2965
+ def save(self, data: dict):
2966
+ save_json(self.path, data)
2967
+
2968
+ def merge(self, props: dict):
2969
+ data = self.load()
2970
+ if not data:
2971
+ return self.save(props)
2972
+ data.update(props)
2973
+ self.save(data)
2974
+ return data
2975
+
2976
+
2955
2977
  def _test():
2956
- print(say('hello'))
2978
+ # print(say('hello'))
2979
+ print(create_guid())
2957
2980
 
2958
2981
 
2959
2982
  if __name__ == '__main__':
@@ -1,7 +0,0 @@
1
- kkpyutil.py,sha256=aJZiOrfAupfxoq0xFySLag6iaWZQyx7JMOpDAzaB-wE,111187
2
- kkpyutil_helper/windows/kkttssave.ps1,sha256=xa3-WzqNh2rGYlOx_I4ewOuCE94gkTO5cEwYH0M67_0,446
3
- kkpyutil_helper/windows/kkttsspeak.ps1,sha256=7WUUHMmjTQroUWA2Mvdt4JtSt475nZUHQx-qP-7rS6o,305
4
- kkpyutil-1.39.0.dist-info/LICENSE,sha256=uISevGnCxB5QOU0ftbofN75_yUtd6E2h_MWE1zqagC8,1065
5
- kkpyutil-1.39.0.dist-info/METADATA,sha256=NW7-hBiiwyDwK6cXJguT7L87xuyCQC6YCZl00fPJhc4,1136
6
- kkpyutil-1.39.0.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
7
- kkpyutil-1.39.0.dist-info/RECORD,,