Skip to content

Commit

Permalink
Simplified parsing as path
Browse files Browse the repository at this point in the history
  • Loading branch information
bccheung committed Mar 24, 2022
1 parent 14ab2ca commit 973c1b3
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions jacquard/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,7 @@ def as_path(self, parent=None, check_exist=False):
JacquardTypeError: If the value cannot be resolved to Path
"""
fp = Path(self.as_str()) if parent is None else (Path(parent) / Path(self.as_str()))
if check_exist:
if not fp.exists():
raise FileNotFoundError('File `%s` not found' % fp.as_posix())
return fp
return fp.resolve(strict=check_exist)

def as_set(self, sub_type=None):
"""Converts the value to a set.
Expand Down

0 comments on commit 973c1b3

Please sign in to comment.