pycoze 0.1.58__py3-none-any.whl → 0.1.59__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
pycoze/utils/arg.py CHANGED
@@ -1,17 +1,19 @@
1
- import argparse
2
1
  import sys
3
2
  import json
4
3
 
5
4
 
6
- def read_arg(param, is_path=False):
5
+ def read_arg(param, is_path=False, posix=True):
6
+ while param.startswith("-"):
7
+ param = param[1:]
7
8
  args = sys.argv[1:]
8
- parser = argparse.ArgumentParser()
9
- parser.add_argument(param, nargs="?", help=f"Parameter {param}")
10
- args = parser.parse_known_args(args)[0]
11
- value = getattr(args, param.lstrip("-"))
12
- # 如果是路径并且有引号,去掉引号
9
+ for i in range(len(args)):
10
+ if args[i] == "-" + param or args[i] == "--" + param:
11
+ value = args[i + 1]
12
+ break
13
13
  if is_path and value and value.startswith('"') and value.endswith('"'):
14
14
  value = value[1:-1]
15
+ if posix:
16
+ value = value.replace("\\", "/")
15
17
 
16
18
  return value
17
19
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.58
3
+ Version: 0.1.59
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -20,10 +20,10 @@ pycoze/ui/color.py,sha256=cT9Ib8uNzkOKxyW0IwVj46o4LwdB1xgNCj1_Rou9d_4,854
20
20
  pycoze/ui/typ.py,sha256=NpT0FrbHvByOszBZMFtroRp7I7pN-38tYz_zPOPejF4,1723
21
21
  pycoze/ui/ui_def.py,sha256=CNFYH8NC-WYmbceIPpxsRr9H6O006pMKukx7U-BOE1Q,3744
22
22
  pycoze/utils/__init__.py,sha256=KExBkotf23dr2NfTEouWke5nJB1q2IuDXgHrmuyd95k,73
23
- pycoze/utils/arg.py,sha256=rRujm1zKc0XlnNlpIJ6JAAaFiTzDGmL_RliIpSc5OD8,724
23
+ pycoze/utils/arg.py,sha256=MyD4jOJDY73f44MBKOzNMEAXM2Ai6J9PWARtVlEQQno,736
24
24
  pycoze/utils/text_or_file.py,sha256=gpxZVWt2DW6YiEg_MnMuwg36VNf3TX383QD_1oZNB0Y,551
25
- pycoze-0.1.58.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
26
- pycoze-0.1.58.dist-info/METADATA,sha256=yab-43itzAxZyXOG9n48QeDVv6ZtVy3nH-VyBqgb-2w,719
27
- pycoze-0.1.58.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
28
- pycoze-0.1.58.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
29
- pycoze-0.1.58.dist-info/RECORD,,
25
+ pycoze-0.1.59.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
26
+ pycoze-0.1.59.dist-info/METADATA,sha256=xQDBrh8KF7tExzg6c_Or35PPa48GllK7onUlHUvX9tE,719
27
+ pycoze-0.1.59.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
28
+ pycoze-0.1.59.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
29
+ pycoze-0.1.59.dist-info/RECORD,,