dcicutils 8.8.6.1b9__py3-none-any.whl → 8.8.6.1b11__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
dcicutils/portal_utils.py CHANGED
@@ -407,6 +407,7 @@ class Portal:
407
407
 
408
408
  @function_cache(maxsize=100, serialize_key=True)
409
409
  def get_identifying_paths(self, portal_object: dict, portal_type: Optional[Union[str, dict]] = None,
410
+ first_only: bool = False,
410
411
  lookup_strategy: Optional[Union[Callable, bool]] = None) -> List[str]:
411
412
  """
412
413
  Returns the list of the identifying Portal (URL) paths for the given Portal object. Favors any uuid
@@ -467,7 +468,10 @@ class Portal:
467
468
  # And note the disction of just using /{uuid} here rather than /{type}/{uuid} as in the else
468
469
  # statement below is not really necessary; just here for emphasis that this is all that's needed.
469
470
  #
470
- results.append(f"/{identifying_value}")
471
+ if first_only is True:
472
+ results.append(f"/{portal_type}/{identifying_value}")
473
+ else:
474
+ results.append(f"/{identifying_value}")
471
475
  elif isinstance(identifying_value, list):
472
476
  for identifying_value_item in identifying_value:
473
477
  if identifying_value_item:
@@ -497,12 +501,15 @@ class Portal:
497
501
  if is_lookup_subtypes(lookup_options):
498
502
  for subtype_name in self.get_schema_subtype_names(portal_type):
499
503
  results.append(f"/{subtype_name}/{identifying_value}")
504
+ if (first_only is True) and results:
505
+ return results
500
506
  return results
501
507
 
502
508
  @function_cache(maxsize=100, serialize_key=True)
503
509
  def get_identifying_path(self, portal_object: dict, portal_type: Optional[Union[str, dict]] = None,
504
510
  lookup_strategy: Optional[Union[Callable, bool]] = None) -> Optional[str]:
505
- if identifying_paths := self.get_identifying_path(portal_object, portal_type, lookup_strategy):
511
+ if identifying_paths := self.get_identifying_paths(portal_object, portal_type, first_only=True,
512
+ lookup_strategy=lookup_strategy):
506
513
  return identifying_paths[0]
507
514
  return None
508
515
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcicutils
3
- Version: 8.8.6.1b9
3
+ Version: 8.8.6.1b11
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
@@ -48,7 +48,7 @@ dcicutils/misc_utils.py,sha256=zHwsxxEn24muLBP7mDvMa8I9VdMejwW8HMuCL5xbhhw,10769
48
48
  dcicutils/obfuscation_utils.py,sha256=fo2jOmDRC6xWpYX49u80bVNisqRRoPskFNX3ymFAmjw,5963
49
49
  dcicutils/opensearch_utils.py,sha256=V2exmFYW8Xl2_pGFixF4I2Cc549Opwe4PhFi5twC0M8,1017
50
50
  dcicutils/portal_object_utils.py,sha256=Az3n1aL-PQkN5gOFE6ZqC2XkYsqiwKlq7-tZggs1QN4,11062
51
- dcicutils/portal_utils.py,sha256=J3xvWx0pT5EVt76QjVSLHbuV2-yqOnvdiYD1w0iogmw,44253
51
+ dcicutils/portal_utils.py,sha256=cDMaqEW3aSDwhjJlsaVS4yEpYsmWo6yVXnLA9f4J_JY,44621
52
52
  dcicutils/progress_bar.py,sha256=UT7lxb-rVF_gp4yjY2Tg4eun1naaH__hB4_v3O85bcE,19468
53
53
  dcicutils/project_utils.py,sha256=qPdCaFmWUVBJw4rw342iUytwdQC0P-XKpK4mhyIulMM,31250
54
54
  dcicutils/qa_checkers.py,sha256=cdXjeL0jCDFDLT8VR8Px78aS10hwNISOO5G_Zv2TZ6M,20534
@@ -73,8 +73,8 @@ dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
73
73
  dcicutils/validation_utils.py,sha256=cMZIU2cY98FYtzK52z5WUYck7urH6JcqOuz9jkXpqzg,14797
74
74
  dcicutils/variant_utils.py,sha256=2H9azNx3xAj-MySg-uZ2SFqbWs4kZvf61JnK6b-h4Qw,4343
75
75
  dcicutils/zip_utils.py,sha256=_Y9EmL3D2dUZhxucxHvrtmmlbZmK4FpSsHEb7rGSJLU,3265
76
- dcicutils-8.8.6.1b9.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
77
- dcicutils-8.8.6.1b9.dist-info/METADATA,sha256=osE9U72LJCIMw0T0u827urDzvjR9AEteFIsCD7LObtk,3439
78
- dcicutils-8.8.6.1b9.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
79
- dcicutils-8.8.6.1b9.dist-info/entry_points.txt,sha256=51Q4F_2V10L0282W7HFjP4jdzW4K8lnWDARJQVFy_hw,270
80
- dcicutils-8.8.6.1b9.dist-info/RECORD,,
76
+ dcicutils-8.8.6.1b11.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
77
+ dcicutils-8.8.6.1b11.dist-info/METADATA,sha256=VlpuTBAxKkqXFztHeEfDLxXP_BBRVBbpjmQoaEjGuJo,3440
78
+ dcicutils-8.8.6.1b11.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
79
+ dcicutils-8.8.6.1b11.dist-info/entry_points.txt,sha256=51Q4F_2V10L0282W7HFjP4jdzW4K8lnWDARJQVFy_hw,270
80
+ dcicutils-8.8.6.1b11.dist-info/RECORD,,