opensees-cli 0.3.1__tar.gz → 0.3.3__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.
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/PKG-INFO +1 -1
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/pyproject.toml +1 -1
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli/__init__.py +1 -1
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli/auth.py +14 -17
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli.egg-info/PKG-INFO +1 -1
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/README.md +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/setup.cfg +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli/__main__.py +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli/api.py +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli/config.py +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli/files.py +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli/main.py +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli/path_setup.py +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli/run.py +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli/version.py +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli.egg-info/SOURCES.txt +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli.egg-info/dependency_links.txt +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli.egg-info/entry_points.txt +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli.egg-info/requires.txt +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/src/opensees_cli.egg-info/top_level.txt +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/tests/test_api.py +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/tests/test_auth_commands.py +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/tests/test_config.py +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/tests/test_files_commands.py +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/tests/test_main_commands.py +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/tests/test_run_commands.py +0 -0
- {opensees_cli-0.3.1 → opensees_cli-0.3.3}/tests/test_version_commands.py +0 -0
|
@@ -268,13 +268,6 @@ def _fmt_bytes_precise(n: float) -> str:
|
|
|
268
268
|
return f"{n:.2f} GB"
|
|
269
269
|
|
|
270
270
|
|
|
271
|
-
def _fmt_usage(n: float) -> str:
|
|
272
|
-
n = float(n or 0)
|
|
273
|
-
if abs(n - round(n)) < 0.05:
|
|
274
|
-
return str(int(round(n)))
|
|
275
|
-
return f"{n:.1f}"
|
|
276
|
-
|
|
277
|
-
|
|
278
271
|
def _usage_parts(q: dict) -> tuple:
|
|
279
272
|
maximum = q.get("max_monthly_usage")
|
|
280
273
|
if maximum is None:
|
|
@@ -293,9 +286,21 @@ def _usage_parts(q: dict) -> tuple:
|
|
|
293
286
|
return maximum or 0, used or 0, reserved or 0, remaining
|
|
294
287
|
|
|
295
288
|
|
|
289
|
+
def _fmt_usage_pct(pct: float) -> str:
|
|
290
|
+
"""Whole percent, or up to two decimals when the share is under 1%."""
|
|
291
|
+
if pct <= 0:
|
|
292
|
+
return "0%"
|
|
293
|
+
if pct < 1:
|
|
294
|
+
text = f"{pct:.2f}".rstrip("0").rstrip(".")
|
|
295
|
+
if text in ("", "0"):
|
|
296
|
+
text = "0.00"
|
|
297
|
+
return f"{text}%"
|
|
298
|
+
return f"{pct:.0f}%"
|
|
299
|
+
|
|
300
|
+
|
|
296
301
|
def print_quota(q: dict) -> None:
|
|
297
302
|
"""Print quota info to the console."""
|
|
298
|
-
max_rt, used, reserved,
|
|
303
|
+
max_rt, used, reserved, _remaining = _usage_parts(q)
|
|
299
304
|
committed = used + reserved
|
|
300
305
|
pct = (committed / max_rt * 100) if max_rt else 0
|
|
301
306
|
rt_color = "green" if pct < 75 else ("yellow" if pct < 90 else "red")
|
|
@@ -317,15 +322,7 @@ def print_quota(q: dict) -> None:
|
|
|
317
322
|
console.print(f" Max task timeout: {_fmt_duration(q['max_task_timeout']) if q.get('max_task_timeout') else '-'}")
|
|
318
323
|
console.print(f" Max RAM: {_fmt_bytes((q.get('max_ram_mb') or 1024) * 1024 * 1024)}")
|
|
319
324
|
console.print(f" Max storage/task: {_fmt_bytes(q['max_storage_per_task']) if q.get('max_storage_per_task') else '-'}")
|
|
320
|
-
|
|
321
|
-
console.print(
|
|
322
|
-
f" Monthly usage: [{rt_color}]{_fmt_usage(used)} settled"
|
|
323
|
-
f" + {_fmt_usage(reserved)} in-flight[/{rt_color}]"
|
|
324
|
-
f" / {_fmt_usage(max_rt)} ({pct:.0f}% committed)"
|
|
325
|
-
)
|
|
326
|
-
else:
|
|
327
|
-
console.print(f" Monthly usage: [{rt_color}]{_fmt_usage(used)}[/{rt_color}] / {_fmt_usage(max_rt)} ({pct:.0f}% used)")
|
|
328
|
-
console.print(f" Usage left: {_fmt_usage(remaining)}")
|
|
325
|
+
console.print(f" Monthly usage: [{rt_color}]{_fmt_usage_pct(pct)}[/{rt_color}]")
|
|
329
326
|
if q.get("next_reset_at"):
|
|
330
327
|
console.print(f" Next cycle: {_to_local_date(q['next_reset_at'])}")
|
|
331
328
|
else:
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|