Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

Commit 46f758c

Browse files
robertwbaaltay
authored andcommitted
Update filehandling utilities
----Release Notes---- [] ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=123667095
1 parent c586bac commit 46f758c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

google/cloud/dataflow/io/fileio.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,18 @@ def rmdir(path):
282282
except OSError as err:
283283
raise IOError(err)
284284

285+
@staticmethod
286+
def rm(path):
287+
if path.startswith('gs://'):
288+
# pylint: disable=g-import-not-at-top
289+
from google.cloud.dataflow.io import gcsio
290+
gcsio.GcsIO().delete(path)
291+
else:
292+
try:
293+
os.remove(path)
294+
except OSError as err:
295+
raise IOError(err)
296+
285297
@staticmethod
286298
def glob(path):
287299
if path.startswith('gs://'):

0 commit comments

Comments
 (0)