From cd75631403e27abe928d63da51f58502f3fbe650 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 28 Nov 2017 19:14:04 -0800 Subject: [PATCH] Replace a string hack to regexp --- dvc/path/factory.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dvc/path/factory.py b/dvc/path/factory.py index d90b20b5a..85da563ab 100644 --- a/dvc/path/factory.py +++ b/dvc/path/factory.py @@ -1,4 +1,5 @@ import os +import re from dvc.config import ConfigI from dvc.path.data_item import DataItem, DataItemError, DataDirError @@ -77,4 +78,5 @@ class PathFactory(object): @staticmethod def state_path_to_dvc_path(state): - return os.path.relpath(state, ConfigI.STATE_DIR)[:-len(DataItem.STATE_FILE_SUFFIX)] + filename = os.path.relpath(state, ConfigI.STATE_DIR) + return re.sub(DataItem.STATE_FILE_SUFFIX + '$', '', filename)