machineconfig 6.32__py3-none-any.whl → 6.33__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.

Potentially problematic release.


This version of machineconfig might be problematic. Click here for more details.

@@ -37,17 +37,11 @@ class Read:
37
37
  raise ImportError(err) from err2
38
38
  @staticmethod
39
39
  def json(path: 'Path', r: bool = False, **kwargs: Any) -> Any: # return could be list or dict etc
40
- import json
41
- try:
42
- mydict = json.loads(Path(path).read_text(encoding='utf-8'), **kwargs)
43
- except Exception:
44
- import pyjson5
45
- mydict = pyjson5.loads(Path(path).read_text(encoding='utf-8'), **kwargs) # file has C-style comments.
46
- _ = r
47
- return mydict
40
+ from machineconfig.utils.io import read_json
41
+ return read_json(path, r=r, **kwargs)
48
42
  @staticmethod
49
43
  def yaml(path: 'Path', r: bool = False) -> Any: # return could be list or dict etc
50
- import yaml # type: ignore
44
+ import yaml
51
45
  with open(str(path), "r", encoding="utf-8") as file:
52
46
  mydict = yaml.load(file, Loader=yaml.FullLoader)
53
47
  _ = r
machineconfig/utils/io.py CHANGED
@@ -61,9 +61,14 @@ def read_json(path: "Path", r: bool = False, **kwargs: Any) -> Any: # return co
61
61
  try:
62
62
  mydict = json.loads(Path(path).read_text(encoding="utf-8"), **kwargs)
63
63
  except Exception:
64
- import pyjson5
65
-
66
- mydict = pyjson5.loads(Path(path).read_text(encoding="utf-8"), **kwargs) # file has C-style comments.
64
+ import re
65
+ def remove_comments(text: str) -> str:
66
+ # remove all // single-line comments
67
+ text = re.sub(r'//.*', '', text)
68
+ # remove all /* … */ block comments (non-greedy)
69
+ text = re.sub(r'/\*.*?\*/', '', text, flags=re.DOTALL)
70
+ return text
71
+ mydict = json.loads(remove_comments(Path(path).read_text(encoding="utf-8")), **kwargs)
67
72
  _ = r
68
73
  return mydict
69
74
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: machineconfig
3
- Version: 6.32
3
+ Version: 6.33
4
4
  Summary: Dotfiles management package
5
5
  Author-email: Alex Al-Saffar <programmer@usa.com>
6
6
  License: Apache 2.0
@@ -23,7 +23,6 @@ Requires-Dist: psutil>=7.0.0
23
23
  Requires-Dist: gitpython>=3.1.44
24
24
  Requires-Dist: pyfzf>=0.3.1
25
25
  Requires-Dist: rclone-python>=0.1.23
26
- Requires-Dist: pyjson5>=1.6.9
27
26
  Requires-Dist: questionary>=2.1.1
28
27
  Requires-Dist: typer-slim>=0.19.2
29
28
  Requires-Dist: typer>=0.19.2
@@ -386,7 +386,7 @@ machineconfig/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
386
386
  machineconfig/utils/accessories.py,sha256=W_9dLzjwNTW5JQk_pe3B2ijQ1nA2-8Kdg2r7VBtzgQs,4340
387
387
  machineconfig/utils/code.py,sha256=f0K5abTIBBurK5pSM_VRtW_npFjK18UvIG_BEyzOv40,8912
388
388
  machineconfig/utils/installer.py,sha256=puFcMe-oNAeqTW0jz1NAEil8HRtxY4B6Z0VAeq_jH-o,10493
389
- machineconfig/utils/io.py,sha256=rzEwAnq-gyT29Y4CDHHGxAA6ddIIFOCxrqZ6dn0ALa4,2255
389
+ machineconfig/utils/io.py,sha256=4dSieoqZO8Vvi4vW8lLoITDHBvmFp4dtl3kyeZHQ6Co,2528
390
390
  machineconfig/utils/links.py,sha256=KM6vIn3hag9FYEzLSHP5MAM9tU_RStw2mCq2_OvmmZA,23672
391
391
  machineconfig/utils/meta.py,sha256=fDn7cpq6iqAPzX2eKLSK9DZb0870rluR7eLDx5NgNaw,5994
392
392
  machineconfig/utils/notifications.py,sha256=tuXIudcip0tEioG-bm8BbLr3FMDve4f6BktlznBhKxM,9013
@@ -409,7 +409,7 @@ machineconfig/utils/cloud/onedrive/transaction.py,sha256=m-aNcnWj_gfZVvJOSpkdIqj
409
409
  machineconfig/utils/files/ascii_art.py,sha256=cNJaJC07vx94fS44-tzgfbfBeCwXVrgpnWGBLUnfC38,5212
410
410
  machineconfig/utils/files/dbms.py,sha256=B7Mns8g774kfeXZwcuGWUpRnSgiOtS6khn8faRH5rQs,11390
411
411
  machineconfig/utils/files/headers.py,sha256=F-sudsZ1JyAcmZNO4FdcyhoClbCdb2vMlqceT36zfhE,3717
412
- machineconfig/utils/files/read.py,sha256=R1bvIIdiFX9N0JyzUISqVfewYFq30cY3z0kqSlKGtuA,4566
412
+ machineconfig/utils/files/read.py,sha256=QDxLEIYi0NcgAys97IVB6IUl4S9CiFP6TKGxUxRBJOM,4330
413
413
  machineconfig/utils/files/ouch/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
414
414
  machineconfig/utils/files/ouch/decompress.py,sha256=7qPaEkMerBBXzeZyFn8hLODHZJv1aty-yGgwBxLgVys,1413
415
415
  machineconfig/utils/installer_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -422,8 +422,8 @@ machineconfig/utils/schemas/installer/installer_types.py,sha256=QClRY61QaduBPJoS
422
422
  machineconfig/utils/schemas/layouts/layout_types.py,sha256=TcqlZdGVoH8htG5fHn1KWXhRdPueAcoyApppZsPAPto,2020
423
423
  machineconfig/utils/schemas/repos/repos_types.py,sha256=ECVr-3IVIo8yjmYmVXX2mnDDN1SLSwvQIhx4KDDQHBQ,405
424
424
  machineconfig/utils/ssh_utils/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
425
- machineconfig-6.32.dist-info/METADATA,sha256=vVj42KcByWj_yUt6oAbD7f23iUI4tnUbWvnyX2RsIQM,3012
426
- machineconfig-6.32.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
427
- machineconfig-6.32.dist-info/entry_points.txt,sha256=M0jwN_brZdXWhmNVeXLvdKxfkv8WhhXFZYcuKBA9qnk,418
428
- machineconfig-6.32.dist-info/top_level.txt,sha256=porRtB8qms8fOIUJgK-tO83_FeH6Bpe12oUVC670teA,14
429
- machineconfig-6.32.dist-info/RECORD,,
425
+ machineconfig-6.33.dist-info/METADATA,sha256=yIeBcgTsrlSHX1HobsVLU8Y89wCd3l52zxWxkCptfqk,2982
426
+ machineconfig-6.33.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
427
+ machineconfig-6.33.dist-info/entry_points.txt,sha256=M0jwN_brZdXWhmNVeXLvdKxfkv8WhhXFZYcuKBA9qnk,418
428
+ machineconfig-6.33.dist-info/top_level.txt,sha256=porRtB8qms8fOIUJgK-tO83_FeH6Bpe12oUVC670teA,14
429
+ machineconfig-6.33.dist-info/RECORD,,