4040
4141def asset_viewer (asset_guid : str , server_name :str , platform_url :str , user :str ):
4242
43- def build_classifications (classification : dict ) -> str :
43+ def build_classifications (classification : dict ) -> Markdown :
4444
4545 class_md = ""
4646 for c in classification :
@@ -49,7 +49,7 @@ def build_classifications(classification: dict) -> str:
4949 continue
5050 class_md += f"* Classification: { c_type } \n "
5151 class_props = c .get ("classificationProperties" ,"---" )
52- if type (class_props ) is dict :
52+ if type (class_props ) is list :
5353 for prop in class_props .keys ():
5454 class_md += f"\t * { prop } : { class_props [prop ]} \n "
5555 if class_md == "" :
@@ -125,6 +125,7 @@ def build_nested_elements(nested_element: dict) -> Markdown:
125125 asset_relationships = asset_graph ["relationships" ]
126126 asset_class_md = build_classifications (asset_classifications )
127127
128+
128129 asset_properties = asset_graph ["extendedProperties" ]
129130 prop_md = "\n * Extended Properties:\n "
130131 for prop in asset_properties :
@@ -189,24 +190,24 @@ def build_nested_elements(nested_element: dict) -> Markdown:
189190 f"* Created by: { relationship_created_by } at time { relationship_creation_time } \n "
190191 )
191192 rel_end1_md = (
192- f"\n ** End1:** \n "
193- f"\n \ t * Type: { rel_end1_type } \n "
193+ f"* End1:\n "
194+ f"\t * Type: { rel_end1_type } \n "
194195 f"\t * GUID: { rel_end1_guid } \n "
195196 f"\t * Unique Name: { rel_end1_unique_name } \n "
196197 )
197198
198- # if rel_end1_class_md is not None:
199- # rel_end1_md = rel_end1_md + rel_end1_class_md
199+ if rel_end1_class_md is not None :
200+ rel_end1_md = rel_end1_class_md + rel_end1_md
200201
201202 rel_end2_md = (
202- f"\n ** End2:** \n "
203- f"\n \ t * Type: { rel_end2_type } \n "
203+ f"* End2:\n "
204+ f"\t * Type: { rel_end2_type } \n "
204205 f"\t * GUID: { rel_end2_guid } \n "
205206 f"\t * Unique Name: { rel_end2_unique_name } \n "
206207 )
207208
208- # if rel_end2_class_md is not None:
209- # rel_end1_md = rel_end1_md + rel_end2_class_md
209+ if rel_end2_class_md is not None :
210+ rel_end1_md = rel_end2_class_md + rel_end1_md
210211 #
211212 # for prop in relationship_properties.keys():
212213 # relationship_md += f"* {prop}: {relationship_properties[prop]}\n"
@@ -228,7 +229,7 @@ def build_nested_elements(nested_element: dict) -> Markdown:
228229 print_exception_response (e )
229230
230231
231- if __name__ == "__main__" :
232+ def main () :
232233 parser = argparse .ArgumentParser ()
233234
234235 parser .add_argument ("--server" , help = "Name of the server to display status for" )
@@ -242,3 +243,6 @@ def build_nested_elements(nested_element: dict) -> Markdown:
242243
243244 asset_guid = Prompt .ask ("Enter the Asset GUID to view:" , default = "8e35b39e-6ee7-4d60-aff5-4b09406c5e79" )
244245 asset_viewer (asset_guid ,server , url , userid )
246+
247+ if __name__ == "__main__" :
248+ main ()
0 commit comments