@@ -624,7 +624,7 @@ def get_metadata_content(
624624 self ,
625625 artifact_path_or_content : Union [str , bytes ],
626626 path_type : MetadataArtifactPathType ,
627- ):
627+ ) -> bytes :
628628 """
629629 returns the content of the metadata artifact
630630
@@ -639,29 +639,24 @@ def get_metadata_content(
639639
640640 Returns
641641 -------
642- metadata artifact content
642+ bytes
643+ metadata artifact content in bytes
643644 """
644645
645646 if path_type == MetadataArtifactPathType .CONTENT :
646647 return artifact_path_or_content
647648
648- elif path_type == MetadataArtifactPathType .LOCAL :
649- if not utils .is_path_exists (artifact_path_or_content ):
650- raise FileNotFoundError (
651- f"File not found: { artifact_path_or_content } . "
652- )
653-
654- with open (artifact_path_or_content , "rb" ) as f :
655- contents = f .read ()
656- logger .info (f"The metadata artifact content - { contents } " )
657-
658- return contents
659-
660- elif path_type == MetadataArtifactPathType .OSS :
649+ elif (
650+ path_type == MetadataArtifactPathType .LOCAL
651+ or path_type == MetadataArtifactPathType .OSS
652+ ):
661653 if not utils .is_path_exists (artifact_path_or_content ):
662654 raise FileNotFoundError (f"File not found: { artifact_path_or_content } " )
655+ signer = (
656+ default_signer () if path_type == MetadataArtifactPathType .OSS else {}
657+ )
663658 contents = read_file (
664- file_path = artifact_path_or_content , auth = default_signer ()
659+ file_path = artifact_path_or_content , auth = signer
665660 ).encode ()
666661 logger .debug (f"The metadata artifact content - { contents } " )
667662
0 commit comments