RemoteRF 0.0.7.53__tar.gz → 0.1.0.0__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.
Files changed (35) hide show
  1. {remoterf-0.0.7.53/src/remoteRF.egg-info → remoterf-0.1.0.0}/PKG-INFO +1 -1
  2. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/setup.py +1 -1
  3. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/core/app.py +108 -24
  4. {remoterf-0.0.7.53 → remoterf-0.1.0.0/src/remoteRF.egg-info}/PKG-INFO +1 -1
  5. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/LICENSE +0 -0
  6. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/MANIFEST.in +0 -0
  7. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/README.md +0 -0
  8. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/setup.cfg +0 -0
  9. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/__init__.py +0 -0
  10. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/common/__init__.py +0 -0
  11. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/common/grpc/__init__.py +0 -0
  12. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/common/grpc/grpc_pb2.py +0 -0
  13. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/common/grpc/grpc_pb2_grpc.py +0 -0
  14. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/common/utils/__init__.py +0 -0
  15. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/common/utils/ansi_codes.py +0 -0
  16. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/common/utils/api_token.py +0 -0
  17. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/common/utils/list_string.py +0 -0
  18. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/common/utils/process_arg.py +0 -0
  19. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/config/__init__.py +0 -0
  20. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/config/cert_fetcher.py +0 -0
  21. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/config/config.py +0 -0
  22. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/core/__init__.py +0 -0
  23. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/core/acc_login.py +0 -0
  24. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/core/grpc_acc.py +0 -0
  25. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/core/grpc_client.py +0 -0
  26. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/core/version.py +0 -0
  27. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/drivers/__init__.py +0 -0
  28. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/drivers/adalm_pluto/__init__.py +0 -0
  29. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/drivers/adalm_pluto/pluto_remote.py +0 -0
  30. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF/remoterf_cli.py +0 -0
  31. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF.egg-info/SOURCES.txt +0 -0
  32. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF.egg-info/dependency_links.txt +0 -0
  33. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF.egg-info/entry_points.txt +0 -0
  34. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF.egg-info/requires.txt +0 -0
  35. {remoterf-0.0.7.53 → remoterf-0.1.0.0}/src/remoteRF.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: remoterf
3
- Version: 0.0.7.53
3
+ Version: 0.1.0.0
4
4
  Summary: A python API to remotely access signal centric hardware. Client-side only! Courtesy of Wireless Lab @ UCLA & Prof. Ian Roberts.
5
5
  Author: Ethan Ge
6
6
  Author-email: ethoGalaxy@gmail.com
@@ -6,7 +6,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
6
6
 
7
7
  setup(
8
8
  name="remoterf",
9
- version="0.0.7.53",
9
+ version="0.1.0.0",
10
10
  author="Ethan Ge",
11
11
  author_email="ethoGalaxy@gmail.com",
12
12
  description="A python API to remotely access signal centric hardware. Client-side only! Courtesy of Wireless Lab @ UCLA & Prof. Ian Roberts.",
@@ -70,18 +70,18 @@ def commands():
70
70
  # printf("'resdev -n' ", Sty.MAGENTA, "- naive reserve device", Sty.DEFAULT)
71
71
  # printf("'resdev s' ", Sty.MAGENTA, "- Reserve a Device (by single date)", Sty.DEFAULT)
72
72
 
73
- if account.is_admin:
74
- print()
75
- printf("Admin Commands:", Sty.BOLD)
76
- printf("'admin printa' ", Sty.MAGENTA, " : Print all accounts", Sty.DEFAULT)
77
- printf("'admin printr' ", Sty.MAGENTA, " : Print all reservations", Sty.DEFAULT)
78
- printf("'admin printp' ", Sty.MAGENTA, " : Print all perms", Sty.DEFAULT)
79
- printf("'admin printd' ", Sty.MAGENTA, " : Print all devices", Sty.DEFAULT)
80
- printf("'admin rm a <username>' ", Sty.MAGENTA, " : Remove one account", Sty.DEFAULT)
81
- printf("'admin rm aa' ", Sty.MAGENTA, " : Remove all accounts", Sty.DEFAULT)
82
- printf("'admin rm ar' ", Sty.MAGENTA, " : Remove all reservations", Sty.DEFAULT)
83
- # If you expose set_account remotely:
84
- printf("'admin setacc <username> <U|P|A> [args...]' ", Sty.MAGENTA, " : Set perms", Sty.DEFAULT)
73
+ # if account.is_admin:
74
+ # print()
75
+ # printf("Admin Commands:", Sty.BOLD)
76
+ # printf("'admin printa' ", Sty.MAGENTA, " : Print all accounts", Sty.DEFAULT)
77
+ # printf("'admin printr' ", Sty.MAGENTA, " : Print all reservations", Sty.DEFAULT)
78
+ # printf("'admin printp' ", Sty.MAGENTA, " : Print all perms", Sty.DEFAULT)
79
+ # printf("'admin printd' ", Sty.MAGENTA, " : Print all devices", Sty.DEFAULT)
80
+ # printf("'admin rm a <username>' ", Sty.MAGENTA, " : Remove one account", Sty.DEFAULT)
81
+ # printf("'admin rm aa' ", Sty.MAGENTA, " : Remove all accounts", Sty.DEFAULT)
82
+ # printf("'admin rm ar' ", Sty.MAGENTA, " : Remove all reservations", Sty.DEFAULT)
83
+ # # If you expose set_account remotely:
84
+ # printf("'admin setacc <username> <U|P|A> [args...]' ", Sty.MAGENTA, " : Set perms", Sty.DEFAULT)
85
85
 
86
86
 
87
87
  def clear():
@@ -264,24 +264,108 @@ def reserve():
264
264
  except Exception as e:
265
265
  printf(f"Error: {e}", Sty.BRIGHT_RED)
266
266
 
267
+ import ast
268
+ import json
267
269
  def perms():
268
270
  data = account.get_perms()
269
271
  if 'ace' in data.results:
270
272
  print(f"Error: {unmap_arg(data.results['ace'])}")
271
273
  return
272
-
274
+
273
275
  results = ast.literal_eval(unmap_arg(data.results['UC']))[0]
274
- printf(f'Permission Level: ', Sty.BOLD, f'{results[0]}', Sty.BLUE)
275
- if results[0] == 'Normal User':
276
- print(unmap_arg(data.results['details']))
277
- elif results[0] == 'Power User':
278
- printf(f'Max Reservations: ', Sty.DEFAULT, f'{results[3]}', Sty.MAGENTA)
279
- printf(f'Max Reservation Duration (min): ', Sty.DEFAULT, f'{int(results[4]/60)}', Sty.MAGENTA)
280
- printf(f'Device IDs allowed Access to: ', Sty.DEFAULT, f'{results[5]}', Sty.MAGENTA)
281
- elif results[0] == 'Admin':
282
- printf(f'No restrictions on reservation count or duration.', Sty.DEFAULT)
276
+ perm_level = results[0]
277
+
278
+ printf("Permission Level: ", Sty.BOLD, f"{perm_level}", Sty.BLUE)
279
+
280
+ if perm_level == "Normal User":
281
+ details_raw = unmap_arg(data.results.get("details", map_arg("{}")))
282
+ try:
283
+ details = json.loads(details_raw) if details_raw else {}
284
+ except Exception:
285
+ details = {}
286
+
287
+ devices = details.get("devices", []) or []
288
+ caps = details.get("caps", {}) or {}
289
+ groups = details.get("groups", []) or []
290
+
291
+ def _cap_for(dev_id: int):
292
+ return caps.get(str(dev_id)) or caps.get(dev_id) or {}
293
+
294
+ # ---- Groups (NEW) ----
295
+ if groups:
296
+ # keep stable ordering
297
+ groups = [str(g) for g in groups if str(g).strip() != ""]
298
+ print("User Groups:")
299
+ for g in groups:
300
+ print(f" - {g}")
301
+ else:
302
+ print("User Groups: (none)")
303
+
304
+ # ---- Devices ----
305
+ if not devices:
306
+ printf("Devices: ", Sty.DEFAULT, "None", Sty.MAGENTA)
307
+ return
308
+
309
+ printf("Devices allowed: ", Sty.DEFAULT, f"{devices}", Sty.MAGENTA)
310
+
311
+ # Build per-device caps and group identical limits together
312
+ buckets: dict[tuple[int, int], list[int]] = {} # (max_r, max_t_sec) -> [dev_ids]
313
+ for d in devices:
314
+ try:
315
+ did = int(d)
316
+ except Exception:
317
+ continue
318
+ c = _cap_for(did)
319
+ max_t = int(c.get("max_reservation_time_sec", 0) or 0)
320
+ max_r = int(c.get("max_reservations", 0) or 0)
321
+ buckets.setdefault((max_r, max_t), []).append(did)
322
+
323
+ if not buckets:
324
+ print("Limits per device: (none)")
325
+ return
326
+
327
+ # If everything shares the same limits, print once
328
+ if len(buckets) == 1:
329
+ (max_r, max_t), _devs = next(iter(buckets.items()))
330
+ print("Limits (all devices):")
331
+ print(f" Max Concurrent Reservations: {max_r}")
332
+ print(f" Max Reservation Duration (min): {max_t // 60}")
333
+ return
334
+
335
+ # Otherwise print grouped limits
336
+ print("Limits per device (grouped):")
337
+ for (max_r, max_t), devs in sorted(buckets.items(), key=lambda kv: (kv[0][0], kv[0][1], kv[1])):
338
+ devs = sorted(devs)
339
+
340
+ # compress ranges like 0-3,5,7-9
341
+ ranges = []
342
+ start = prev = None
343
+ for x in devs:
344
+ if start is None:
345
+ start = prev = x
346
+ continue
347
+ if x == prev + 1:
348
+ prev = x
349
+ else:
350
+ ranges.append(f"{start}-{prev}" if start != prev else f"{start}")
351
+ start = prev = x
352
+ if start is not None:
353
+ ranges.append(f"{start}-{prev}" if start != prev else f"{start}")
354
+
355
+ dev_str = ",".join(ranges)
356
+ print(f" devices[{dev_str}]: max_reservations={max_r}, max_time_min={max_t // 60}")
357
+
358
+ elif perm_level == "Power User":
359
+ printf("Max Reservations: ", Sty.DEFAULT, f"{results[3]}", Sty.MAGENTA)
360
+ printf("Max Reservation Duration (min): ", Sty.DEFAULT, f"{int(results[4]/60)}", Sty.MAGENTA)
361
+ printf("Device IDs allowed Access to: ", Sty.DEFAULT, f"{results[5]}", Sty.MAGENTA)
362
+
363
+ elif perm_level == "Admin":
364
+ printf("No restrictions on reservation count or duration.", Sty.DEFAULT)
365
+
283
366
  else:
284
- printf(f"Error: Unknown permission level {results[0]}", Sty.BRIGHT_RED)
367
+ printf(f"Error: Unknown permission level {perm_level}", Sty.BRIGHT_RED)
368
+
285
369
 
286
370
  def enroll():
287
371
  code = session.prompt(stylize("Enter your enrollment code: ", Sty.DEFAULT))
@@ -293,7 +377,7 @@ def enroll():
293
377
  return
294
378
  else:
295
379
  # todo: print out specifics, like group name (ie: successfully enrolled in ECE 132A)
296
- printf("Enrollment successful.", Sty.BOLD_GREEN)
380
+ printf("Enrollment successful.", Sty.BG_GREEN)
297
381
 
298
382
  # New block scheduling
299
383
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: remoterf
3
- Version: 0.0.7.53
3
+ Version: 0.1.0.0
4
4
  Summary: A python API to remotely access signal centric hardware. Client-side only! Courtesy of Wireless Lab @ UCLA & Prof. Ian Roberts.
5
5
  Author: Ethan Ge
6
6
  Author-email: ethoGalaxy@gmail.com
File without changes
File without changes
File without changes
File without changes