bcmd 0.0.36__tar.gz → 0.0.38__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bcmd
3
- Version: 0.0.36
3
+ Version: 0.0.38
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
@@ -1,3 +1,4 @@
1
+ from math import nan
1
2
  from typing import Final
2
3
 
3
4
  import typer
@@ -43,25 +44,47 @@ async def scale(
43
44
  @app.command()
44
45
  @bfunc.syncCall
45
46
  async def increase(
46
- old: float = typer.Argument(..., help='原始数值'),
47
- new: float = typer.Argument(..., help='新数值'),
47
+ old: float = typer.Argument(nan, help='原始数值'),
48
+ new: float = typer.Argument(nan, help='新数值'),
48
49
  ):
49
- '计算增长率,例子:beni math increase 123 456'
50
- value = (new - old) / old
51
- if value > 0:
52
- valueStr = bcolor.red(f'{value*100:+,.3f}%')
50
+ '''
51
+ 计算增长率
52
+
53
+ 例子:beni math increase 123 456
54
+
55
+ 例子(连续对话):beni math increase
56
+ '''
57
+ if old is not nan and new is not nan:
58
+ value = (new - old) / old
59
+ if value > 0:
60
+ valueStr = bcolor.red(f'{value*100:+,.3f}%')
61
+ else:
62
+ valueStr = bcolor.green(f'{value*100:+,.3f}%')
63
+ table = PrettyTable(
64
+ title=bcolor.yellow('计算增长率'),
65
+ )
66
+ table.add_rows([
67
+ ['旧数值', f'{old:,}'],
68
+ ['新数值', f'{new:,}'],
69
+ ['增长率', valueStr],
70
+ ])
71
+ print()
72
+ print(table.get_string(header=False))
73
+ elif old is nan and new is nan:
74
+ while True:
75
+ print()
76
+ value = input('输入2个数值,空格分隔,退出输入 [exit] :').strip()
77
+ if value == 'exit':
78
+ break
79
+ try:
80
+ ary = value.split(' ')
81
+ ary = [float(x) for x in ary if x]
82
+ assert len(ary) == 2, '参数必须要2个数值'
83
+ increase(ary[0], ary[1])
84
+ except Exception as e:
85
+ bcolor.printRed(e)
53
86
  else:
54
- valueStr = bcolor.green(f'{value*100:+,.3f}%')
55
- table = PrettyTable(
56
- title=bcolor.yellow('计算增长率'),
57
- )
58
- table.add_rows([
59
- ['旧数值', f'{old:,}'],
60
- ['新数值', f'{new:,}'],
61
- ['增长率', valueStr],
62
- ])
63
- print()
64
- print(table.get_string(header=False))
87
+ btask.abort('参数错误,不传参数,或者传入2个数值参数')
65
88
 
66
89
 
67
90
  @app.command()
@@ -295,7 +295,7 @@ pydantic
295
295
  pyinstaller
296
296
  pyyaml
297
297
  qiniu
298
- twine
298
+ rich
299
299
  typer
300
300
 
301
301
 
@@ -311,25 +311,18 @@ async-timeout==4.0.3
311
311
  attrs==23.1.0
312
312
  autopep8==2.0.4
313
313
  benimang==0.4.21
314
- bleach==6.0.0
315
314
  certifi==2023.7.22
316
315
  charset-normalizer==3.2.0
317
316
  click==8.1.7
318
317
  colorama==0.4.6
319
- docutils==0.20.1
320
318
  frozenlist==1.4.0
321
319
  idna==3.4
322
- importlib-metadata==6.8.0
323
- jaraco.classes==3.3.0
324
- keyring==24.2.0
325
320
  markdown-it-py==3.0.0
326
321
  mdurl==0.1.2
327
- more-itertools==10.1.0
328
322
  multidict==6.0.4
329
323
  nest-asyncio==1.5.7
330
324
  orjson==3.9.5
331
325
  pefile==2023.2.7
332
- pkginfo==1.9.6
333
326
  portalocker==2.7.0
334
327
  pretty-errors==1.2.25
335
328
  prettytable==3.8.0
@@ -343,19 +336,12 @@ pywin32==306
343
336
  pywin32-ctypes==0.2.2
344
337
  PyYAML==6.0.1
345
338
  qiniu==7.11.1
346
- readme-renderer==41.0
347
339
  requests==2.31.0
348
- requests-toolbelt==1.0.0
349
- rfc3986==2.0.0
350
340
  rich==13.5.2
351
- six==1.16.0
352
- twine==4.0.2
353
341
  typer==0.9.0
354
342
  typing_extensions==4.7.1
355
343
  urllib3==2.0.4
356
344
  wcwidth==0.2.6
357
- webencodings==0.5.1
358
345
  yarl==1.9.2
359
- zipp==3.16.2
360
346
 
361
- '''
347
+ '''
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bcmd
3
- Version: 0.0.36
3
+ Version: 0.0.38
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
@@ -3,7 +3,7 @@
3
3
 
4
4
  [project]
5
5
  name = 'bcmd'
6
- version = '0.0.36'
6
+ version = '0.0.38'
7
7
  description = 'Commands for Beni'
8
8
  requires-python = '>=3.10'
9
9
  keywords = ['benimang', 'beni', 'bcmd']
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