tradedangerous 12.0.7__py3-none-any.whl → 12.0.8__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 tradedangerous might be problematic. Click here for more details.

@@ -26,18 +26,29 @@ if typing.TYPE_CHECKING:
26
26
  class HTTP404(TradeException):
27
27
  pass
28
28
 
29
- def makeUnit(value):
29
+
30
+ def makeUnit(value: float) -> str:
31
+ num, unit = split_unit(value)
32
+ return f"{num}{unit}"
33
+
34
+
35
+ def split_unit(value: float) -> tuple[str, str]:
30
36
  """
31
- Convert a value in bytes into a Kb, Mb, Gb etc.
37
+ Split a byte size into a (number_str, unit_str) tuple.
38
+ Used when you need to colour or format the numeric part separately.
39
+
40
+ Example:
41
+ >>> split_unit(30200000)
42
+ ('28.8', 'MB')
32
43
  """
33
-
34
- units = [ 'B ', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ]
35
- unitSize = int(value)
36
- for unit in units:
37
- if unitSize <= 640:
38
- return "{:>5.01f}{}".format(unitSize, unit)
39
- unitSize /= 1024
40
- return None
44
+ units = ["B", "KB", "MB", "GB", "TB"]
45
+ n = float(value)
46
+ i = 0
47
+ while n >= 1024.0 and i < len(units) - 1:
48
+ n /= 1024.0
49
+ i += 1
50
+ num_str = f"{n:.1f}" if i > 0 else f"{int(n)}"
51
+ return num_str, units[i]
41
52
 
42
53
 
43
54
  def get_filename_from_url(url: str) -> str:
@@ -128,11 +139,13 @@ def download(
128
139
 
129
140
  if not tdenv.quiet:
130
141
  elapsed = (time.time() - started) or 1
142
+ num1, unit1 = split_unit(fetched)
143
+ num2, unit2 = split_unit(fetched / elapsed)
131
144
  tdenv.NOTE(
132
- "Downloaded {} of {}ed data {}/s",
133
- makeUnit(fetched), encoding,
134
- makeUnit(fetched / elapsed)
145
+ f"Downloaded [cyan]{num1}[/]{unit1} of {encoding}ed data "
146
+ f"[cyan]{num2}[/]{unit2}/s"
135
147
  )
148
+
136
149
 
137
150
  fs.ensurefolder(actPath.parent)
138
151
 
tradedangerous/version.py CHANGED
@@ -12,5 +12,5 @@
12
12
  """just keeper of current version"""
13
13
 
14
14
  # TODO: remember to update tests when version changes
15
- __version__ = '12.0.7'
15
+ __version__ = '12.0.8'
16
16
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tradedangerous
3
- Version: 12.0.7
3
+ Version: 12.0.8
4
4
  Summary: Trade-Dangerous is a set of powerful trading tools for Elite Dangerous, organized around one of the most powerful trade run optimizers available.
5
5
  Home-page: https://github.com/eyeonus/Trade-Dangerous
6
6
  Author: eyeonus
@@ -18,9 +18,9 @@ tradedangerous/tradecalc.py,sha256=LA37VAaVS8lSRW1Ydmo28R9FmFwhjoieOMG6KxVtn9A,4
18
18
  tradedangerous/tradedb.py,sha256=s1ZFK1ZmJz1_EBdIBdW0IBeWNoT-UP0j1JhBxIFQvws,79215
19
19
  tradedangerous/tradeenv.py,sha256=FrKAqFQQO5N0jrld9Ie1Tw23PoXxVBpA85n9RyEw2xg,12338
20
20
  tradedangerous/tradeexcept.py,sha256=aZ-Y31MbkjF7lmAzBAbaMsPPE7FEEfuf4gaX2GvriDk,368
21
- tradedangerous/transfers.py,sha256=t_0Sjr4FI9lhIPwyPOXdR8d97bE611ujbKK4ioWShm0,6024
21
+ tradedangerous/transfers.py,sha256=mx5bidC8g67ShP3G-1IoWcXjDgMOHH35Kw6qUROcP4Y,6363
22
22
  tradedangerous/utils.py,sha256=PUPvAEqUyxYGqqQa0b_yfLAvq8YVUxK6HfdS-CxM-Lo,5186
23
- tradedangerous/version.py,sha256=roMbR1DA05j95XJ6BhbrT_58nGhLE-DDy-pS153cPQQ,646
23
+ tradedangerous/version.py,sha256=2TUHZgKzIdGYfEB7HvkeIqcgKAxuuDubL1n-Ekw5WD4,646
24
24
  tradedangerous/commands/TEMPLATE.py,sha256=seMXDN_Nf_Rvj_5BivI-0yhVT6W9iRDihr5yo8kr5qw,2069
25
25
  tradedangerous/commands/__init__.py,sha256=UvcWgcr_PVScbJ6R83iaUb2_4Ttmft85HYexTFo7FwU,9171
26
26
  tradedangerous/commands/buildcache_cmd.py,sha256=WwDRLcVGCWZSM9x2jKpXXj2QRt5RLkvrcHzmZ8UCI_s,3346
@@ -75,9 +75,9 @@ tradedangerous/templates/Added.csv,sha256=8o54civQCcS9y7_DBo0GX196XWRbbREQqKDYTK
75
75
  tradedangerous/templates/Category.csv,sha256=8xwUDcBZE25T6x6dZGlRUMTCqeDLt3a9LXU5h6hRHV8,250
76
76
  tradedangerous/templates/RareItem.csv,sha256=F1RhRnTD82PiwrVUO-ai2ErGH2PTqNnQaDw5mcgljXs,10483
77
77
  tradedangerous/templates/TradeDangerous.sql,sha256=pCw2Js8GQniqAWC6N3SL-ujyqlLYCeR2-SI-qhk6VsI,9336
78
- tradedangerous-12.0.7.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
79
- tradedangerous-12.0.7.dist-info/METADATA,sha256=_eY_nsgawI5QEPfPOidRSrr0sUcmNLN6B5UlLXo6KPE,4873
80
- tradedangerous-12.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
81
- tradedangerous-12.0.7.dist-info/entry_points.txt,sha256=lrA7U9JHOcNuam2WEK4Hmc3vQ3mrJfsbJCE74qd9au8,62
82
- tradedangerous-12.0.7.dist-info/top_level.txt,sha256=JEoOVAhg5GfXZ4kHpNontu0RVzek_7P9_jp93f3Pqn8,16
83
- tradedangerous-12.0.7.dist-info/RECORD,,
78
+ tradedangerous-12.0.8.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
79
+ tradedangerous-12.0.8.dist-info/METADATA,sha256=WDIeVtAbL5OGPRuUFJXabQ6DG-bkOO6JLk-kgS_dCIc,4873
80
+ tradedangerous-12.0.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
81
+ tradedangerous-12.0.8.dist-info/entry_points.txt,sha256=lrA7U9JHOcNuam2WEK4Hmc3vQ3mrJfsbJCE74qd9au8,62
82
+ tradedangerous-12.0.8.dist-info/top_level.txt,sha256=JEoOVAhg5GfXZ4kHpNontu0RVzek_7P9_jp93f3Pqn8,16
83
+ tradedangerous-12.0.8.dist-info/RECORD,,