Dvc: Use path_isin instead of startswith to compare filepaths

Created on 20 Nov 2019  路  3Comments  路  Source: iterative/dvc

The PR #2798 introduced dvc.utils.fs.path_isin that can be used to compare child paths and parent paths and therefore, raw string compare with startswith can be replaced with this new function.

Refactor usage of startswith for paths with path_isin.

enhancement p2-medium refactoring

Most helpful comment

Looked through the codebase. The difference between path_isin and startswith is that, the former will be false if they are same path. The latter is being used here in the cases of where the path are same as well. Found 5/6 uses of startswith only.

All 3 comments

@efiop, can I take this? If yes, please assign me. :)

@skshetry Sure, go ahead 馃檪

Looked through the codebase. The difference between path_isin and startswith is that, the former will be false if they are same path. The latter is being used here in the cases of where the path are same as well. Found 5/6 uses of startswith only.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

analystanand picture analystanand  路  3Comments

shcheklein picture shcheklein  路  3Comments

dnabanita7 picture dnabanita7  路  3Comments

anotherbugmaster picture anotherbugmaster  路  3Comments

dmpetrov picture dmpetrov  路  3Comments