Skip to content

Commit 694631e

Browse files
committed
Fix behaviour of fs.wrap.WrapCachedDir methods isdir and isfile on missing files
1 parent f047b8e commit 694631e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

fs/wrap.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,17 @@ def getinfo(self, path, namespaces=None):
135135

136136
def isdir(self, path):
137137
# type: (Text) -> bool
138-
# FIXME(@althonos): this raises an error on non-existing file !
139-
return self.getinfo(path).is_dir
138+
try:
139+
return self.getinfo(path).is_dir
140+
except ResourceNotFound:
141+
return False
140142

141143
def isfile(self, path):
142144
# type: (Text) -> bool
143-
# FIXME(@althonos): this raises an error on non-existing file !
144-
return not self.getinfo(path).is_dir
145+
try:
146+
return not self.getinfo(path).is_dir
147+
except ResourceNotFound:
148+
return False
145149

146150

147151
class WrapReadOnly(WrapFS[_F], typing.Generic[_F]):

0 commit comments

Comments
 (0)