bcmd 0.0.56__tar.gz → 0.0.58__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.

Potentially problematic release.


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

Files changed (29) hide show
  1. {bcmd-0.0.56 → bcmd-0.0.58}/PKG-INFO +2 -2
  2. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd/tasks/__init__.py +2 -0
  3. bcmd-0.0.58/bcmd/tasks/download.py +34 -0
  4. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd/tasks/pwd.py +1 -1
  5. bcmd-0.0.58/bcmd/tasks/temp.py +31 -0
  6. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd/tasks/venv.py +15 -4
  7. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd.egg-info/PKG-INFO +2 -2
  8. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd.egg-info/SOURCES.txt +2 -0
  9. bcmd-0.0.58/bcmd.egg-info/requires.txt +3 -0
  10. {bcmd-0.0.56 → bcmd-0.0.58}/pyproject.toml +2 -2
  11. bcmd-0.0.56/bcmd.egg-info/requires.txt +0 -3
  12. {bcmd-0.0.56 → bcmd-0.0.58}/MANIFEST.in +0 -0
  13. {bcmd-0.0.56 → bcmd-0.0.58}/README.md +0 -0
  14. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd/__init__.py +0 -0
  15. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd/common/__init__.py +0 -0
  16. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd/common/password.py +0 -0
  17. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd/main.py +0 -0
  18. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd/tasks/bin.py +0 -0
  19. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd/tasks/json.py +0 -0
  20. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd/tasks/lib.py +0 -0
  21. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd/tasks/math.py +0 -0
  22. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd/tasks/mirror.py +0 -0
  23. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd/tasks/proxy.py +0 -0
  24. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd/tasks/task.py +0 -0
  25. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd/tasks/time.py +0 -0
  26. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd.egg-info/dependency_links.txt +0 -0
  27. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd.egg-info/entry_points.txt +0 -0
  28. {bcmd-0.0.56 → bcmd-0.0.58}/bcmd.egg-info/top_level.txt +0 -0
  29. {bcmd-0.0.56 → bcmd-0.0.58}/setup.cfg +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bcmd
3
- Version: 0.0.56
3
+ Version: 0.0.58
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
7
7
  Keywords: benimang,beni,bcmd
8
8
  Requires-Python: >=3.10
9
- Requires-Dist: benimang==0.4.34
9
+ Requires-Dist: benimang==0.5.3
10
10
  Requires-Dist: pathspec
11
11
  Requires-Dist: pyjwt
@@ -1,5 +1,6 @@
1
1
  # type: ignore
2
2
  from . import bin
3
+ from . import download
3
4
  from . import json
4
5
  from . import lib
5
6
  from . import math
@@ -7,5 +8,6 @@ from . import mirror
7
8
  from . import proxy
8
9
  from . import pwd
9
10
  from . import task
11
+ from . import temp
10
12
  from . import time
11
13
  from . import venv
@@ -0,0 +1,34 @@
1
+ import asyncio
2
+ import os
3
+ from pathlib import Path
4
+ from typing import Final
5
+
6
+ import pyperclip
7
+ import typer
8
+ from beni import bcolor, bhttp, bpath, btask
9
+ from beni.bfunc import syncCall
10
+
11
+ app: Final = btask.newSubApp('下载')
12
+
13
+
14
+ @app.command()
15
+ @syncCall
16
+ async def urls(
17
+ path: Path = typer.Option(None, '--path', '-p', help='指定路径,默认当前目录'),
18
+ ):
19
+ '下载文件'
20
+ path = path or Path(os.getcwd())
21
+ content = pyperclip.paste()
22
+ urlSet = set([x.strip() for x in content.strip().split('\n') if x.strip()])
23
+
24
+ async def download(url: str):
25
+ file = bpath.get(path, '/'.join([x for x in url.replace('://', '/').split('/') if x]))
26
+ try:
27
+ bcolor.printGreen(url)
28
+ await bhttp.download(url, file)
29
+ except:
30
+ bcolor.printRed(url)
31
+
32
+ await asyncio.gather(*[download(x) for x in urlSet])
33
+
34
+ bcolor.printYellow('Done')
@@ -9,7 +9,7 @@ from beni import bcolor, btask
9
9
  from beni.bfunc import magicSequence, syncCall
10
10
  from rich.console import Console
11
11
 
12
- app: Final = btask.newSubApp('lib 工具')
12
+ app: Final = btask.newSubApp('密钥')
13
13
 
14
14
 
15
15
  _KEY_SALT = '_salt_@#%@#xafDGAz.nq'
@@ -0,0 +1,31 @@
1
+ from pathlib import Path
2
+ from typing import Final
3
+
4
+ import typer
5
+ from beni import bcolor, bpath, btask
6
+ from beni.bfunc import syncCall
7
+ from beni.bqiniu import QiniuBucket
8
+
9
+ from bcmd.common import password
10
+
11
+ app: Final = btask.newSubApp('temp 工具')
12
+
13
+
14
+ @app.command()
15
+ @syncCall
16
+ async def upload_qiniu(
17
+ local_path: Path = typer.Argument(..., help="本地路径"),
18
+ bucket_name: str = typer.Argument(None, help="七牛云空间名称"),
19
+ ):
20
+ ak, sk = await password.getQiniu()
21
+ bucket = QiniuBucket(
22
+ 'pytask-doc',
23
+ '',
24
+ ak,
25
+ sk,
26
+ )
27
+ for file in bpath.listFile(local_path, True):
28
+ key = file.relative_to(local_path).as_posix()
29
+ await bucket.uploadFile(key, file)
30
+ print(key)
31
+ bcolor.printGreen('OK')
@@ -23,7 +23,11 @@ async def venv(
23
23
  quiet: bool = typer.Option(False, '--quiet', '-q', help='是否安静模式'),
24
24
  ):
25
25
  'python 虚拟环境配置'
26
- await password.getQiniu()
26
+
27
+ path = path or Path(os.getcwd())
28
+ binPath = path / 'bin'
29
+ binListFile = bpath.get(path, 'bin.list')
30
+ await _inputQiniuPassword(binListFile, binPath)
27
31
  packages = packages or []
28
32
  for i in range(len(packages)):
29
33
  package = packages[i]
@@ -35,7 +39,6 @@ async def venv(
35
39
  if disabled_mirror and pipIniFile.is_file():
36
40
  bpath.move(pipIniFile, tempFile)
37
41
  try:
38
- path = path or Path(os.getcwd())
39
42
  venvPath = bpath.get(path, 'venv')
40
43
  assertPath(venvPath)
41
44
  if not venvPath.exists() and not quiet:
@@ -59,12 +62,11 @@ async def venv(
59
62
  await bexecute.run(f'{pip} freeze > {venvLockFile}')
60
63
 
61
64
  # 下载 bin 文件
62
- binListFile = bpath.get(path, 'bin.list')
63
65
  if binListFile.exists():
64
66
  bin.download(
65
67
  names=Null,
66
68
  file=binListFile,
67
- output=path / 'bin',
69
+ output=binPath,
68
70
  )
69
71
 
70
72
  finally:
@@ -111,3 +113,12 @@ async def _getPackageLatestVersion(package: str):
111
113
  f'https://pypi.org/pypi/{package}/json'
112
114
  )
113
115
  return data['info']['version']
116
+
117
+
118
+ async def _inputQiniuPassword(binListFile: Path, binPath: Path) -> None:
119
+ '根据需要输入七牛云密码'
120
+ if binListFile.exists():
121
+ aaSet = set([x.strip() for x in (await bfile.readText(binListFile)).strip().split('\n') if x.strip()])
122
+ bbSet = set([x.name for x in bpath.listFile(binPath)])
123
+ if aaSet != bbSet:
124
+ await password.getQiniu()
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bcmd
3
- Version: 0.0.56
3
+ Version: 0.0.58
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
7
7
  Keywords: benimang,beni,bcmd
8
8
  Requires-Python: >=3.10
9
- Requires-Dist: benimang==0.4.34
9
+ Requires-Dist: benimang==0.5.3
10
10
  Requires-Dist: pathspec
11
11
  Requires-Dist: pyjwt
@@ -13,6 +13,7 @@ bcmd/common/__init__.py
13
13
  bcmd/common/password.py
14
14
  bcmd/tasks/__init__.py
15
15
  bcmd/tasks/bin.py
16
+ bcmd/tasks/download.py
16
17
  bcmd/tasks/json.py
17
18
  bcmd/tasks/lib.py
18
19
  bcmd/tasks/math.py
@@ -20,5 +21,6 @@ bcmd/tasks/mirror.py
20
21
  bcmd/tasks/proxy.py
21
22
  bcmd/tasks/pwd.py
22
23
  bcmd/tasks/task.py
24
+ bcmd/tasks/temp.py
23
25
  bcmd/tasks/time.py
24
26
  bcmd/tasks/venv.py
@@ -0,0 +1,3 @@
1
+ benimang==0.5.3
2
+ pathspec
3
+ pyjwt
@@ -3,7 +3,7 @@
3
3
 
4
4
  [project]
5
5
  name = 'bcmd'
6
- version = '0.0.56'
6
+ version = '0.0.58'
7
7
  description = 'Commands for Beni'
8
8
  requires-python = '>=3.10'
9
9
  keywords = ['benimang', 'beni', 'bcmd']
@@ -12,7 +12,7 @@ maintainers = [{ name = 'Beni Mang', email = 'benimang@126.com' }]
12
12
 
13
13
 
14
14
  dependencies = [
15
- 'benimang==0.4.34',
15
+ 'benimang==0.5.3',
16
16
  'pathspec',
17
17
  'pyjwt',
18
18
  ]
@@ -1,3 +0,0 @@
1
- benimang==0.4.34
2
- pathspec
3
- pyjwt
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes