pltr-cli 0.5.2__py3-none-any.whl → 0.7.0__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.
pltr/utils/formatting.py CHANGED
@@ -1282,3 +1282,173 @@ class OutputFormatter:
1282
1282
  return self.format_output(details, format_type, output_file)
1283
1283
  else:
1284
1284
  return self.format_output(view, format_type, output_file)
1285
+
1286
+ def format_file_info(
1287
+ self,
1288
+ file_info: Dict[str, Any],
1289
+ format_type: str = "table",
1290
+ output_file: Optional[str] = None,
1291
+ ) -> Optional[str]:
1292
+ """
1293
+ Format file metadata information.
1294
+
1295
+ Args:
1296
+ file_info: File info dictionary
1297
+ format_type: Output format
1298
+ output_file: Optional output file path
1299
+
1300
+ Returns:
1301
+ Formatted string if no output file specified
1302
+ """
1303
+ if format_type == "table":
1304
+ details = []
1305
+
1306
+ property_order = [
1307
+ ("path", "File Path"),
1308
+ ("dataset_rid", "Dataset RID"),
1309
+ ("branch", "Branch"),
1310
+ ("size_bytes", "Size (bytes)"),
1311
+ ("content_type", "Content Type"),
1312
+ ("last_modified", "Last Modified"),
1313
+ ("created_time", "Created"),
1314
+ ("transaction_rid", "Transaction RID"),
1315
+ ]
1316
+
1317
+ for key, label in property_order:
1318
+ if file_info.get(key) is not None:
1319
+ value = file_info[key]
1320
+ if key in ["last_modified", "created_time"]:
1321
+ value = self._format_datetime(value)
1322
+ details.append({"Property": label, "Value": str(value)})
1323
+
1324
+ # Add any remaining properties
1325
+ for key, value in file_info.items():
1326
+ if (
1327
+ key not in [prop[0] for prop in property_order]
1328
+ and value is not None
1329
+ ):
1330
+ details.append(
1331
+ {"Property": key.replace("_", " ").title(), "Value": str(value)}
1332
+ )
1333
+
1334
+ return self.format_output(details, format_type, output_file)
1335
+ else:
1336
+ return self.format_output(file_info, format_type, output_file)
1337
+
1338
+ def format_schedules(
1339
+ self,
1340
+ schedules: List[Dict[str, Any]],
1341
+ format_type: str = "table",
1342
+ output_file: Optional[str] = None,
1343
+ ) -> Optional[str]:
1344
+ """
1345
+ Format dataset schedules for display.
1346
+
1347
+ Args:
1348
+ schedules: List of schedule dictionaries
1349
+ format_type: Output format
1350
+ output_file: Optional output file path
1351
+
1352
+ Returns:
1353
+ Formatted string if no output file specified
1354
+ """
1355
+ formatted_schedules = []
1356
+ for schedule in schedules:
1357
+ formatted_schedule = {
1358
+ "Schedule RID": schedule.get("schedule_rid", "")[:12] + "..."
1359
+ if schedule.get("schedule_rid")
1360
+ else "",
1361
+ "Name": schedule.get("name", ""),
1362
+ "Description": schedule.get("description", "")[:50] + "..."
1363
+ if schedule.get("description", "")
1364
+ else "",
1365
+ "Enabled": schedule.get("enabled", ""),
1366
+ "Created": self._format_datetime(schedule.get("created_time")),
1367
+ }
1368
+ formatted_schedules.append(formatted_schedule)
1369
+
1370
+ return self.format_output(formatted_schedules, format_type, output_file)
1371
+
1372
+ def format_jobs(
1373
+ self,
1374
+ jobs: List[Dict[str, Any]],
1375
+ format_type: str = "table",
1376
+ output_file: Optional[str] = None,
1377
+ ) -> Optional[str]:
1378
+ """
1379
+ Format dataset jobs for display.
1380
+
1381
+ Args:
1382
+ jobs: List of job dictionaries
1383
+ format_type: Output format
1384
+ output_file: Optional output file path
1385
+
1386
+ Returns:
1387
+ Formatted string if no output file specified
1388
+ """
1389
+ formatted_jobs = []
1390
+ for job in jobs:
1391
+ formatted_job = {
1392
+ "Job RID": job.get("job_rid", "")[:12] + "..."
1393
+ if job.get("job_rid")
1394
+ else "",
1395
+ "Name": job.get("name", ""),
1396
+ "Status": job.get("status", ""),
1397
+ "Created": self._format_datetime(job.get("created_time")),
1398
+ "Started": self._format_datetime(job.get("started_time")),
1399
+ "Completed": self._format_datetime(job.get("completed_time")),
1400
+ }
1401
+ formatted_jobs.append(formatted_job)
1402
+
1403
+ return self.format_output(formatted_jobs, format_type, output_file)
1404
+
1405
+ def format_transaction_build(
1406
+ self,
1407
+ build_info: Dict[str, Any],
1408
+ format_type: str = "table",
1409
+ output_file: Optional[str] = None,
1410
+ ) -> Optional[str]:
1411
+ """
1412
+ Format transaction build information.
1413
+
1414
+ Args:
1415
+ build_info: Build info dictionary
1416
+ format_type: Output format
1417
+ output_file: Optional output file path
1418
+
1419
+ Returns:
1420
+ Formatted string if no output file specified
1421
+ """
1422
+ if format_type == "table":
1423
+ details = []
1424
+
1425
+ property_order = [
1426
+ ("transaction_rid", "Transaction RID"),
1427
+ ("dataset_rid", "Dataset RID"),
1428
+ ("build_rid", "Build RID"),
1429
+ ("status", "Status"),
1430
+ ("started_time", "Started"),
1431
+ ("completed_time", "Completed"),
1432
+ ("duration_ms", "Duration (ms)"),
1433
+ ]
1434
+
1435
+ for key, label in property_order:
1436
+ if build_info.get(key) is not None:
1437
+ value = build_info[key]
1438
+ if key in ["started_time", "completed_time"]:
1439
+ value = self._format_datetime(value)
1440
+ details.append({"Property": label, "Value": str(value)})
1441
+
1442
+ # Add any remaining properties
1443
+ for key, value in build_info.items():
1444
+ if (
1445
+ key not in [prop[0] for prop in property_order]
1446
+ and value is not None
1447
+ ):
1448
+ details.append(
1449
+ {"Property": key.replace("_", " ").title(), "Value": str(value)}
1450
+ )
1451
+
1452
+ return self.format_output(details, format_type, output_file)
1453
+ else:
1454
+ return self.format_output(build_info, format_type, output_file)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pltr-cli
3
- Version: 0.5.2
3
+ Version: 0.7.0
4
4
  Summary: Command-line interface for Palantir Foundry APIs
5
5
  Project-URL: Homepage, https://github.com/anjor/pltr-cli
6
6
  Project-URL: Repository, https://github.com/anjor/pltr-cli
@@ -1,4 +1,4 @@
1
- pltr/__init__.py,sha256=isJrmDBLRag7Zc2UK9ZovWGOv7ji1Oh-zJtJMNJFkXw,22
1
+ pltr/__init__.py,sha256=RaANGbRu5e-vehwXI1-Qe2ggPPfs1TQaZj072JdbLk4,22
2
2
  pltr/__main__.py,sha256=HWJ49UoAYBQCf8kjuySPmBTuUjTZrOx-y6PzMTyS1KE,879
3
3
  pltr/cli.py,sha256=DikRsWsU7QWvRWHgB6wZIct916ebWyaub7PlAjKJXws,2664
4
4
  pltr/auth/__init__.py,sha256=G0V-Rh25FaJsH2nhrf146XQQG_ApdbyPJNuHJC25kgk,38
@@ -13,7 +13,7 @@ pltr/commands/alias.py,sha256=r9xMsQNrGvaixSlspzoO2IXQ44LFXuZM4itt8vC0dRc,6862
13
13
  pltr/commands/completion.py,sha256=YTxaRL4-rDs5n7aXf3ogFsxbHVJUBo_HiBbd0fbBPZ0,10870
14
14
  pltr/commands/configure.py,sha256=oYj-VlOEj3MDwtB2RC4bYOYzI_sXTanPnz7y1GmMTqY,4800
15
15
  pltr/commands/connectivity.py,sha256=m8_BYwHij_5IbrYFTU_SYYtbqLCjxA8VIQpbdlWJqHs,14758
16
- pltr/commands/dataset.py,sha256=6NiFnWkV_Tkx9AunV-dns6BeR_BBUNMg4tOocBBxaqI,24188
16
+ pltr/commands/dataset.py,sha256=NqGGF5IGhLGuy6FZxG-hd0p6yWlrVblzNwVqNjv3z20,50536
17
17
  pltr/commands/folder.py,sha256=IAPPA3Smk1IWqThneEtZ08Zp79vDKVUabSkL_nDvUWk,10679
18
18
  pltr/commands/mediasets.py,sha256=FXq7OtYU9wLgUxQFcS_fkA4i_CozGnsYKxh8GOSI0ok,15342
19
19
  pltr/commands/ontology.py,sha256=zUgSrmv8xi26SQK7GsM3qusgR9Wuka0GyzE7L8DkduE,18317
@@ -33,7 +33,7 @@ pltr/services/__init__.py,sha256=zQpgrqPdAkZI-nobi33mctU2-iGNgazzvjBVY8YRbSQ,101
33
33
  pltr/services/admin.py,sha256=8FjExmDeIKeVqkAxM83SVvpp_pH9W-Q33cgVs6BHxLQ,9957
34
34
  pltr/services/base.py,sha256=R2G781FI-sXtjUyLd91bVnmLb4cYZI3G8U5ndR9NLA4,1593
35
35
  pltr/services/connectivity.py,sha256=34kazXhue5gNi1_2s2R5Ma4VQe6jP25CO-ztiPhCeZw,10548
36
- pltr/services/dataset.py,sha256=OeKRkkTRT_3uALsvipVzaFIOYRatqXUxLbLkbyCiqLc,20478
36
+ pltr/services/dataset.py,sha256=23EBeJrFZkUBOU8EJcf5uMZyu-10rmIwMVGDZ4RZ2lI,38827
37
37
  pltr/services/folder.py,sha256=mWElyvn-wXPB5sv8Ik_dLeW5JM6jZg3g9KKBk6UcrlQ,5389
38
38
  pltr/services/mediasets.py,sha256=HgHNFWoG9r-5xupANVOxHg_h5EKsBDl6PsO8hwdbm28,9854
39
39
  pltr/services/ontology.py,sha256=iW7qRK8ptlw-u4eAwLNC-mdzLoLZzh7SRqJyok2c3GU,14883
@@ -46,10 +46,10 @@ pltr/services/sql.py,sha256=19cscjlzN8WE1s8_ctiRcrOvMzCfmWRj49vjJ8Gs5Q4,11286
46
46
  pltr/utils/__init__.py,sha256=DF7TigL1XbKVGM5VjgU8_8AGIszofkdO80oCzLGGnTE,38
47
47
  pltr/utils/alias_resolver.py,sha256=DIF7P1UnUU8kqocJfIDEWjYq4s8_0KfqRZBbECeZEh8,1539
48
48
  pltr/utils/completion.py,sha256=bjeqjleEfB2YcQFpcxvF0GoQ763F6KBbULSZC4FWY_g,4980
49
- pltr/utils/formatting.py,sha256=MuIgi8dSqvhzik7H0YQOq1sYPnY_poZOYeTVvrIY2Jk,44235
49
+ pltr/utils/formatting.py,sha256=38g3G2T5WUFKCCKo42NIBR8_Rdl4pp0ytCEZURoV3l4,50275
50
50
  pltr/utils/progress.py,sha256=BKYbiLO61uhQbibabU7pxvvbAWMRLRmqk4pZldBQK_g,9053
51
- pltr_cli-0.5.2.dist-info/METADATA,sha256=vWl7v5qxGJIOJYHLsRjY4fHdCPk6sWav2BTn-xS0F1Y,17714
52
- pltr_cli-0.5.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
- pltr_cli-0.5.2.dist-info/entry_points.txt,sha256=8tvEcW04kA_oAE2Dwwu-Og9efjl4ESJvs4AzlP2KBdQ,38
54
- pltr_cli-0.5.2.dist-info/licenses/LICENSE,sha256=6VUFd_ytnOBD2O1tmkKrA-smigi9QEhYr_tge4h4z8Y,1070
55
- pltr_cli-0.5.2.dist-info/RECORD,,
51
+ pltr_cli-0.7.0.dist-info/METADATA,sha256=yuvIf5pOqN1pl_I_s6czGO8IeXVfEgZuyLGFsKjC8mw,17714
52
+ pltr_cli-0.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
+ pltr_cli-0.7.0.dist-info/entry_points.txt,sha256=8tvEcW04kA_oAE2Dwwu-Og9efjl4ESJvs4AzlP2KBdQ,38
54
+ pltr_cli-0.7.0.dist-info/licenses/LICENSE,sha256=6VUFd_ytnOBD2O1tmkKrA-smigi9QEhYr_tge4h4z8Y,1070
55
+ pltr_cli-0.7.0.dist-info/RECORD,,