dcicutils 8.14.0.1b11__py3-none-any.whl → 8.14.0.1b12__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.
@@ -401,7 +401,8 @@ def _upsert_data(portal: Portal, data: dict, schema_name: str,
401
401
 
402
402
 
403
403
  def _load_data(load: str, ini_file: str, explicit_schema_name: Optional[str] = None,
404
- verbose: bool = False, debug: bool = False, noprogress: bool = False) -> bool:
404
+ verbose: bool = False, debug: bool = False, noprogress: bool = False,
405
+ _portal: Optional[Portal] = None, _single_insert_file: Optional[str] = None) -> bool:
405
406
 
406
407
  from snovault.loadxl import load_all_gen, LoadGenWrapper
407
408
  from dcicutils.captured_output import captured_output
@@ -411,7 +412,7 @@ def _load_data(load: str, ini_file: str, explicit_schema_name: Optional[str] = N
411
412
 
412
413
  nonlocal LoadGenWrapper, load_all_gen, verbose, debug
413
414
  progress_total = sum(schema_names_to_load.values()) * 2 # loadxl does two passes
414
- progress_bar = ProgressBar(progress_total) if not noprogress else None
415
+ progress_bar = ProgressBar(progress_total, interrupt_exit=True) if not noprogress else None
415
416
 
416
417
  def decode_bytes(str_or_bytes: Union[str, bytes], *, encoding: str = "utf-8") -> str:
417
418
  if not isinstance(encoding, str):
@@ -477,9 +478,9 @@ def _load_data(load: str, ini_file: str, explicit_schema_name: Optional[str] = N
477
478
  inserts_directory = None
478
479
  inserts_file = load
479
480
 
480
- portal = None
481
- with captured_output(not debug):
482
- portal = Portal(ini_file)
481
+ if not (portal := _portal):
482
+ with captured_output(not debug):
483
+ portal = Portal(ini_file)
483
484
 
484
485
  if inserts_file:
485
486
  with io.open(inserts_file, "r") as f:
@@ -498,7 +499,8 @@ def _load_data(load: str, ini_file: str, explicit_schema_name: Optional[str] = N
498
499
  with io.open(file_name, "w") as f:
499
500
  json.dump(data, f)
500
501
  return _load_data(load=tmpdir, ini_file=ini_file, explicit_schema_name=explicit_schema_name,
501
- verbose=verbose, debug=debug, noprogress=noprogress)
502
+ verbose=verbose, debug=debug, noprogress=noprogress,
503
+ _portal=portal, _single_insert_file=inserts_file)
502
504
  elif isinstance(data, dict):
503
505
  _print("DICT IN FILE FOR LOAD NOT YET SUPPPORTED")
504
506
  if not _is_schema_name_list(portal, schema_names := list(data.keys())):
@@ -517,7 +519,8 @@ def _load_data(load: str, ini_file: str, explicit_schema_name: Optional[str] = N
517
519
  nfiles += 1
518
520
  if nfiles > 0:
519
521
  return _load_data(load=tmpdir, ini_file=ini_file,
520
- verbose=verbose, debug=debug, noprogress=noprogress)
522
+ verbose=verbose, debug=debug, noprogress=noprogress,
523
+ _portal=portal, _single_insert_file=inserts_file)
521
524
  # TODO
522
525
  return True
523
526
  else:
@@ -525,7 +528,10 @@ def _load_data(load: str, ini_file: str, explicit_schema_name: Optional[str] = N
525
528
  return False
526
529
  return True
527
530
  if verbose:
528
- _print(f"Loading data files into Portal (via snovault.loadxl) from: {inserts_directory}")
531
+ if _single_insert_file:
532
+ _print(f"Loading data file into Portal (via snovault.loadxl) from: {_single_insert_file}")
533
+ else:
534
+ _print(f"Loading data files into Portal (via snovault.loadxl) from: {inserts_directory}")
529
535
  _print(f"Portal INI file for load is: {ini_file}")
530
536
 
531
537
  schema_names = list(_get_schemas(portal).keys())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcicutils
3
- Version: 8.14.0.1b11
3
+ Version: 8.14.0.1b12
4
4
  Summary: Utility package for interacting with the 4DN Data Portal and other 4DN resources
5
5
  Home-page: https://github.com/4dn-dcic/utils
6
6
  License: MIT
@@ -60,7 +60,7 @@ dcicutils/s3_utils.py,sha256=h2B9ftOo-kxqfiKth5ZDC_cAUFy1Pbu7BrVanFnE5Iw,28839
60
60
  dcicutils/schema_utils.py,sha256=GmRm-XqZKJ6qine16SQF1txcby9WougDav_sYmKNs9E,12400
61
61
  dcicutils/scripts/publish_to_pypi.py,sha256=sMd4WASQGlxlh7uLrt2eGkFRXYgONVmvIg8mClMS5RQ,13903
62
62
  dcicutils/scripts/run_license_checker.py,sha256=z2keYnRDZsHQbTeo1XORAXSXNJK5axVzL5LjiNqZ7jE,4184
63
- dcicutils/scripts/update_portal_object.py,sha256=fLgsPgnugKLS18A8JwP8O_UdmeFqNIjUIhrEFlIhfgE,32589
63
+ dcicutils/scripts/update_portal_object.py,sha256=KSsbHVOaS7zGOSVYbB2Lf7FT_gYFAGk4ot8e-us2HkE,33057
64
64
  dcicutils/scripts/view_portal_object.py,sha256=lcgXWH9ooVf7tJDIRnoFGOgT0wYLGhiJlJW3a9w6A_c,36983
65
65
  dcicutils/secrets_utils.py,sha256=8dppXAsiHhJzI6NmOcvJV5ldvKkQZzh3Fl-cb8Wm7MI,19745
66
66
  dcicutils/sheet_utils.py,sha256=VlmzteONW5VF_Q4vo0yA5vesz1ViUah1MZ_yA1rwZ0M,33629
@@ -75,8 +75,8 @@ dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
75
75
  dcicutils/validation_utils.py,sha256=cMZIU2cY98FYtzK52z5WUYck7urH6JcqOuz9jkXpqzg,14797
76
76
  dcicutils/variant_utils.py,sha256=2H9azNx3xAj-MySg-uZ2SFqbWs4kZvf61JnK6b-h4Qw,4343
77
77
  dcicutils/zip_utils.py,sha256=_Y9EmL3D2dUZhxucxHvrtmmlbZmK4FpSsHEb7rGSJLU,3265
78
- dcicutils-8.14.0.1b11.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
79
- dcicutils-8.14.0.1b11.dist-info/METADATA,sha256=HFNj87yKbAwTA98cVDJm_0r9aVJssg7zo5dIsqngVrg,3440
80
- dcicutils-8.14.0.1b11.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
81
- dcicutils-8.14.0.1b11.dist-info/entry_points.txt,sha256=W6kEWdUJk9tQ4myAgpehPdebcwvCAZ7UgB-wyPgDUMg,335
82
- dcicutils-8.14.0.1b11.dist-info/RECORD,,
78
+ dcicutils-8.14.0.1b12.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
79
+ dcicutils-8.14.0.1b12.dist-info/METADATA,sha256=iUlj60aXP1C2TpYySyc6ieQWkM3a11PKfLLFXEOFH9s,3440
80
+ dcicutils-8.14.0.1b12.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
81
+ dcicutils-8.14.0.1b12.dist-info/entry_points.txt,sha256=W6kEWdUJk9tQ4myAgpehPdebcwvCAZ7UgB-wyPgDUMg,335
82
+ dcicutils-8.14.0.1b12.dist-info/RECORD,,