bcmd 0.0.51__py3-none-any.whl → 0.0.56__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 bcmd might be problematic. Click here for more details.

bcmd/common/password.py CHANGED
@@ -11,7 +11,7 @@ async def getPypi() -> tuple[str, str]:
11
11
  with tryRun():
12
12
  data = _getData(
13
13
  '输入密码(pypi)',
14
- 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImJlbmltYW5nIiwicGFzc3dvIjoxNjk2OTIxNDg3Ljg2NzY5MTN9.WvtsFXFB0fk7GTj01tfed1BF-gmDv-3U4bVmcN2wT9wcmQiOiJweXBpMDA5OTg4IiwiODVlYmMwMmQtZDg4MS00NWJiLWE3ZjktNTdkZDA1YjJiNjg2'
14
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Il9fdG9rZW5fXyIsInBhc3N3b3JkIjoicHlwaS1BZ0VJY0hsd2FTNXZjbWNDSkRrM05qWTFOMk5tTFRsaU9URXROR0ZsT1MwNVlUQTBMVFE0WVQ2NlTzlIbkx4RG9Ca3ciLCIzMGE0YTM1Ni0zNmYwLTQ4NTktODk3Zi0xZDFmZDRkMmVhMWQiOjE3MDA4NDU1ODQuNDg5MTY2fQ.YjsYWtUxfsDbHJRQiFSzfuNKDnccC3gxGbAk_bW-LBARCak5EUmlOR1ppWVFBQ0tsc3pMQ0ppT0RBMU16QmhaUzFrTURZekxUUTBZbVF0T0dJMU1pMHdNMlZqWVRSaFlUYzJZV1lpWFFBQUJpQWNvaWxLNlA2TVNZSklETnlvXzcwTXkybzVPWWR3'
15
15
  )
16
16
  return data['username'], data['password']
17
17
 
bcmd/tasks/lib.py CHANGED
@@ -16,14 +16,14 @@ app: Final = btask.newSubApp('lib 工具')
16
16
  @syncCall
17
17
  async def tidy(
18
18
  workspace_path: Path = typer.Argument(None, help='workspace 路径'),
19
- no_version: bool = typer.Option(False, '--no-version', help='是否带版本号'),
19
+ with_version: bool = typer.Option(False, '--with-version', help='是否带版本号')
20
20
  ):
21
21
  '整理 pyproject.toml 里面的 dependencies'
22
22
  if not workspace_path:
23
23
  workspace_path = Path.cwd()
24
24
  pyprojectTomlFile = workspace_path / 'pyproject.toml'
25
25
  btask.check(pyprojectTomlFile.is_file(), 'pyproject.toml 不存在', pyprojectTomlFile)
26
- targetVenvFileName = 'venv.list' if no_version else 'venv.lock'
26
+ targetVenvFileName = 'venv.lock' if with_version else 'venv.list'
27
27
  targetVenvFile = bpath.get(workspace_path, f'./../{targetVenvFileName}')
28
28
  btask.check(targetVenvFile.is_file(), '文件不存在', targetVenvFile)
29
29
  ary = (await bfile.readText(targetVenvFile)).strip().replace('\r\n', '\n').split('\n')
@@ -45,13 +45,14 @@ async def tidy(
45
45
  async def version(
46
46
  workspace_path: Path = typer.Argument(None, help='workspace 路径'),
47
47
  disabled_commit: bool = typer.Option(False, '--disabled-commit', '-d', help='是否提交git'),
48
+ with_dependencies_version: bool = typer.Option(False, '--with_dependencies_version', help='第三方库是否带版本号')
48
49
  ):
49
- '修改 pyproject.toml 版本号'
50
+ '修改 pyproject.toml 版本号(同时会更新依赖列表)'
50
51
  if not workspace_path:
51
52
  workspace_path = Path.cwd()
52
53
  file = workspace_path / 'pyproject.toml'
53
54
  btask.check(file.is_file(), '文件不存在', file)
54
- isChangeDependencies = tidy(workspace_path)
55
+ isChangeDependencies = tidy(workspace_path, with_dependencies_version)
55
56
  data = await bfile.readToml(file)
56
57
  version = data['project']['version']
57
58
  versionList = [int(x) for x in version.split('.')]
@@ -65,7 +66,7 @@ async def version(
65
66
  else:
66
67
  raise Exception('版本号修改失败,先检查文件中定义的版本号格式是否正常')
67
68
  await bfile.writeText(file, content)
68
- bcolor.printCyan(f'{version} => {newVersion}')
69
+ bcolor.printCyan(newVersion)
69
70
  if not disabled_commit:
70
71
  msg = ''.join([
71
72
  f'更新版本号 {newVersion}',
bcmd/tasks/pwd.py CHANGED
@@ -1,6 +1,5 @@
1
1
  import getpass
2
2
  import json
3
- import time
4
3
  import uuid
5
4
  from typing import Final
6
5
 
@@ -13,10 +12,14 @@ from rich.console import Console
13
12
  app: Final = btask.newSubApp('lib 工具')
14
13
 
15
14
 
15
+ _KEY_SALT = '_salt_@#%@#xafDGAz.nq'
16
+ _KEY_TEXT = '_text_A!@$,FJ@#adsfkl'
17
+
18
+
16
19
  @app.command()
17
20
  @syncCall
18
- async def encode():
19
- '生成密文(JSON内容需要先复制到剪贴板)'
21
+ async def encode_json():
22
+ '生成JSON密文(使用剪贴板内容)'
20
23
  content = pyperclip.paste()
21
24
  try:
22
25
  data = json.loads(content)
@@ -28,7 +31,7 @@ async def encode():
28
31
  password = getpass.getpass('输入密码:')
29
32
  while password != getpass.getpass('再次密码:'):
30
33
  pass
31
- data[str(uuid.uuid4())] = time.time()
34
+ data[_KEY_SALT] = str(uuid.uuid4())
32
35
  result = jwt.encode(data, password, algorithm='HS256')
33
36
  result = magicSequence(result)
34
37
  pyperclip.copy(result)
@@ -40,8 +43,8 @@ async def encode():
40
43
 
41
44
  @app.command()
42
45
  @syncCall
43
- async def decode():
44
- '还原密文内容'
46
+ async def decode_json():
47
+ '还原JSON密文内容(使用剪贴板内容)'
45
48
  content = pyperclip.paste()
46
49
  bcolor.printYellow(content)
47
50
  content = magicSequence(content)
@@ -50,6 +53,49 @@ async def decode():
50
53
  password = getpass.getpass('输入密码:')
51
54
  try:
52
55
  data = jwt.decode(content, password, algorithms=['HS256'])
56
+ if _KEY_SALT in data:
57
+ del data[_KEY_SALT]
53
58
  Console().print_json(data=data, indent=4, ensure_ascii=False, sort_keys=True)
54
59
  except:
55
60
  return btask.abort('无法解析密文')
61
+
62
+
63
+ @app.command()
64
+ @syncCall
65
+ async def encode_text():
66
+ '生成文本密文(使用剪贴板内容)'
67
+ content = pyperclip.paste()
68
+ bcolor.printYellow(content)
69
+ data = {
70
+ _KEY_TEXT: content,
71
+ _KEY_SALT: str(uuid.uuid4()),
72
+ }
73
+ password = ''
74
+ while not password:
75
+ password = getpass.getpass('输入密码:')
76
+ while password != getpass.getpass('再次密码:'):
77
+ pass
78
+ result = jwt.encode(data, password, algorithm='HS256')
79
+ result = magicSequence(result)
80
+ pyperclip.copy(result)
81
+ print('密文已复制到剪贴板')
82
+ bcolor.printYellow(result)
83
+ bcolor.printGreen('OK')
84
+
85
+
86
+ @app.command()
87
+ @syncCall
88
+ async def decode_text():
89
+ '还原文本密文内容(使用剪贴板内容)'
90
+ content = pyperclip.paste()
91
+ bcolor.printYellow(content)
92
+ content = magicSequence(content)
93
+ password = ''
94
+ while not password:
95
+ password = getpass.getpass('输入密码:')
96
+ try:
97
+ data = jwt.decode(content, password, algorithms=['HS256'])
98
+ content = data[_KEY_TEXT]
99
+ bcolor.printYellow(content)
100
+ except:
101
+ return btask.abort('无法解析密文')
bcmd/tasks/venv.py CHANGED
@@ -5,6 +5,11 @@ from typing import Final
5
5
  import typer
6
6
  from beni import bexecute, bfile, bhttp, binput, bpath, btask
7
7
  from beni.bfunc import syncCall
8
+ from beni.btype import Null
9
+
10
+ from bcmd.common import password
11
+
12
+ from . import bin
8
13
 
9
14
  app: Final = btask.app
10
15
 
@@ -18,6 +23,7 @@ async def venv(
18
23
  quiet: bool = typer.Option(False, '--quiet', '-q', help='是否安静模式'),
19
24
  ):
20
25
  'python 虚拟环境配置'
26
+ await password.getQiniu()
21
27
  packages = packages or []
22
28
  for i in range(len(packages)):
23
29
  package = packages[i]
@@ -51,6 +57,16 @@ async def venv(
51
57
  pip = bpath.get(venvPath, 'Scripts/pip.exe')
52
58
  await pipInstall(pip, targetFile)
53
59
  await bexecute.run(f'{pip} freeze > {venvLockFile}')
60
+
61
+ # 下载 bin 文件
62
+ binListFile = bpath.get(path, 'bin.list')
63
+ if binListFile.exists():
64
+ bin.download(
65
+ names=Null,
66
+ file=binListFile,
67
+ output=path / 'bin',
68
+ )
69
+
54
70
  finally:
55
71
  if tempFile.is_file():
56
72
  bpath.move(tempFile, pipIniFile, True)
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.1
2
+ Name: bcmd
3
+ Version: 0.0.56
4
+ Summary: Commands for Beni
5
+ Author-email: Beni Mang <benimang@126.com>
6
+ Maintainer-email: Beni Mang <benimang@126.com>
7
+ Keywords: benimang,beni,bcmd
8
+ Requires-Python: >=3.10
9
+ Requires-Dist: benimang ==0.4.34
10
+ Requires-Dist: pathspec
11
+ Requires-Dist: pyjwt
12
+
@@ -1,20 +1,20 @@
1
1
  bcmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  bcmd/main.py,sha256=_ycMuR_Opl2muPSZAQYTLk9wGM20x_4I0o7eF_HV848,136
3
3
  bcmd/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- bcmd/common/password.py,sha256=5IR-lIOUphCbUtfIDe2ISbQwlAr4Pbm7Irw5sQyEa_w,1336
4
+ bcmd/common/password.py,sha256=O2TL7S7wLMtatII2N-z68dkX6Y3vF-NKccMffcb69sU,1562
5
5
  bcmd/tasks/__init__.py,sha256=JQomljtTMPQbpLv-y0vKSzwFm4_WZdtWzutCAoXq6Ok,205
6
6
  bcmd/tasks/bin.py,sha256=4O9Doak-ecOTGvyriZf6v31bhTI66s5IsIKV3wW_cu4,3082
7
7
  bcmd/tasks/json.py,sha256=WWOyvcZPYaqQgp-Tkm-uIJschNMBKPKtZN3yXz_SC5s,635
8
- bcmd/tasks/lib.py,sha256=A0TgyrpwF62qucBDtunsDedj_HkhyMzU31vb54U4XZU,4175
8
+ bcmd/tasks/lib.py,sha256=l4v9JnsSFicnWfd6lOMa9TIKZn14ybYsIiPX1vCWaho,4350
9
9
  bcmd/tasks/math.py,sha256=jDLIEhy9Dbz7yHlZQIr7rps6C-rNamiVM7_9tVYdMJk,4302
10
10
  bcmd/tasks/mirror.py,sha256=PLRI5XPG9CV44rgQn1mB5U-GRJYnp5wl3Xwsd0_df_Y,1448
11
11
  bcmd/tasks/proxy.py,sha256=nAxF9yzk-2O6TeEczGRc3vS3dfe2ZZR1hcGOFU1DS3g,660
12
- bcmd/tasks/pwd.py,sha256=rMHsabEVmZpN9xz9Br-sSJSdS-2_jO0WCe7dQ7UnFvo,1579
12
+ bcmd/tasks/pwd.py,sha256=-j6HcZcfKz7U2XhEDAsomY0FdXZwnwqE_yXD5RRZtX0,2885
13
13
  bcmd/tasks/task.py,sha256=7AelyK8mTVTfERaagkaUUggP8Md3XC9gurgoakMYf_I,4738
14
14
  bcmd/tasks/time.py,sha256=nSIVYov2LsGdxsZAtC91UKXcUtVAqR9o-JmzeuevFhA,2586
15
- bcmd/tasks/venv.py,sha256=uQNV9doN9h7ZkxKNKi4Thd6AnYPNmsAUCtCB9DQC0Jg,3620
16
- bcmd-0.0.51.dist-info/METADATA,sha256=-ztfWSTvi0sabuvlWQZrzPogNnnMWPP3TBTWTJevDwA,2142
17
- bcmd-0.0.51.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
18
- bcmd-0.0.51.dist-info/entry_points.txt,sha256=rHJrP6KEQpB-YaQqDFzEL2v88r03rxSfnzAayRvAqHU,39
19
- bcmd-0.0.51.dist-info/top_level.txt,sha256=-KrvhhtBcYsm4XhcjQvEcFbBB3VXeep7d3NIfDTrXKQ,5
20
- bcmd-0.0.51.dist-info/RECORD,,
15
+ bcmd/tasks/venv.py,sha256=VU34ZZlvqUc4EIlOHayOiJNW4L7v8wsz1Mc-FPfdGVI,4015
16
+ bcmd-0.0.56.dist-info/METADATA,sha256=whlDDZ3rwGvlTZgKF35pjtH7bAjU76BCF67Vc5Fq0mQ,310
17
+ bcmd-0.0.56.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
18
+ bcmd-0.0.56.dist-info/entry_points.txt,sha256=rHJrP6KEQpB-YaQqDFzEL2v88r03rxSfnzAayRvAqHU,39
19
+ bcmd-0.0.56.dist-info/top_level.txt,sha256=-KrvhhtBcYsm4XhcjQvEcFbBB3VXeep7d3NIfDTrXKQ,5
20
+ bcmd-0.0.56.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: bdist_wheel (0.42.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,65 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: bcmd
3
- Version: 0.0.51
4
- Summary: Commands for Beni
5
- Author-email: Beni Mang <benimang@126.com>
6
- Maintainer-email: Beni Mang <benimang@126.com>
7
- Keywords: benimang,beni,bcmd
8
- Requires-Python: >=3.10
9
- Requires-Dist: aioconsole ==0.6.2
10
- Requires-Dist: aiofiles ==23.2.1
11
- Requires-Dist: aiohttp ==3.8.5
12
- Requires-Dist: aiosignal ==1.3.1
13
- Requires-Dist: async-timeout ==4.0.3
14
- Requires-Dist: attrs ==23.1.0
15
- Requires-Dist: autopep8 ==2.0.4
16
- Requires-Dist: benimang ==0.4.33
17
- Requires-Dist: bleach ==6.0.0
18
- Requires-Dist: build ==0.10.0
19
- Requires-Dist: certifi ==2023.7.22
20
- Requires-Dist: charset-normalizer ==3.2.0
21
- Requires-Dist: click ==8.1.7
22
- Requires-Dist: colorama ==0.4.6
23
- Requires-Dist: docutils ==0.20.1
24
- Requires-Dist: frozenlist ==1.4.0
25
- Requires-Dist: idna ==3.4
26
- Requires-Dist: importlib-metadata ==6.8.0
27
- Requires-Dist: jaraco.classes ==3.3.0
28
- Requires-Dist: keyring ==24.2.0
29
- Requires-Dist: markdown-it-py ==3.0.0
30
- Requires-Dist: mdurl ==0.1.2
31
- Requires-Dist: more-itertools ==10.1.0
32
- Requires-Dist: multidict ==6.0.4
33
- Requires-Dist: nest-asyncio ==1.5.7
34
- Requires-Dist: orjson ==3.9.5
35
- Requires-Dist: packaging ==23.1
36
- Requires-Dist: pathspec ==0.11.2
37
- Requires-Dist: pkginfo ==1.9.6
38
- Requires-Dist: portalocker ==2.7.0
39
- Requires-Dist: pretty-errors ==1.2.25
40
- Requires-Dist: prettytable ==3.8.0
41
- Requires-Dist: pycodestyle ==2.11.0
42
- Requires-Dist: Pygments ==2.16.1
43
- Requires-Dist: PyJWT ==2.8.0
44
- Requires-Dist: pyperclip ==1.8.2
45
- Requires-Dist: pyproject-hooks ==1.0.0
46
- Requires-Dist: pywin32 ==306
47
- Requires-Dist: pywin32-ctypes ==0.2.2
48
- Requires-Dist: PyYAML ==6.0.1
49
- Requires-Dist: qiniu ==7.11.1
50
- Requires-Dist: readme-renderer ==41.0
51
- Requires-Dist: requests ==2.31.0
52
- Requires-Dist: requests-toolbelt ==1.0.0
53
- Requires-Dist: rfc3986 ==2.0.0
54
- Requires-Dist: rich ==13.5.2
55
- Requires-Dist: six ==1.16.0
56
- Requires-Dist: twine ==4.0.2
57
- Requires-Dist: typer ==0.9.0
58
- Requires-Dist: typing-extensions ==4.7.1
59
- Requires-Dist: tzdata ==2023.3
60
- Requires-Dist: urllib3 ==2.0.4
61
- Requires-Dist: wcwidth ==0.2.6
62
- Requires-Dist: webencodings ==0.5.1
63
- Requires-Dist: yarl ==1.9.2
64
- Requires-Dist: zipp ==3.16.2
65
-