Skip to content

Commit 7698c52

Browse files
committed
Simplifies code.
1 parent 53ce8d0 commit 7698c52

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

oci_mlflow/oci_object_storage.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,9 @@ def log_artifact(self, local_file: str, artifact_path: str = None):
123123
artifact_path:str
124124
Directory within the run's artifact directory in which to log the artifact.
125125
"""
126-
if artifact_path:
127-
dest_path = os.path.join(self.artifact_uri, artifact_path)
128-
else:
129-
dest_path = self.artifact_uri
130-
dest_path = os.path.join(dest_path, os.path.basename(local_file))
131-
126+
dest_path = os.path.join(
127+
self.artifact_uri, artifact_path or "", os.path.basename(local_file)
128+
)
132129
ArtifactUploader().upload(local_file, dest_path)
133130

134131
def log_artifacts(self, local_dir: str, artifact_path: str = None):
@@ -144,11 +141,7 @@ def log_artifacts(self, local_dir: str, artifact_path: str = None):
144141
Directory within the run's artifact directory in which to log the artifacts.
145142
"""
146143
artifact_uploader = ArtifactUploader()
147-
148-
if artifact_path:
149-
dest_path = os.path.join(self.artifact_uri, artifact_path)
150-
else:
151-
dest_path = artifact_path
144+
dest_path = os.path.join(self.artifact_uri, artifact_path or "")
152145
local_dir = os.path.abspath(local_dir)
153146

154147
for root, _, filenames in os.walk(local_dir):

0 commit comments

Comments
 (0)