pitrou commented on code in PR #12848:
URL: https://github.com/apache/arrow/pull/12848#discussion_r852230370


##########
python/pyarrow/fs.py:
##########
@@ -346,18 +346,24 @@ def create_dir(self, path, recursive):
     def delete_dir(self, path):
         self.fs.rm(path, recursive=True)
 
-    def _delete_dir_contents(self, path):
-        for subpath in self.fs.listdir(path, detail=False):
+    def _delete_dir_contents(self, path, missing_dir_ok):
+        try:
+            subpaths = self.fs.listdir(path, detail=False)
+        except FileNotFoundError:
+            if missing_dir_ok:
+                return
+            raise
+        for subpath in subpaths:
             if self.fs.isdir(subpath):
                 self.fs.rm(subpath, recursive=True)
             elif self.fs.isfile(subpath):
                 self.fs.rm(subpath)
 
-    def delete_dir_contents(self, path):
+    def delete_dir_contents(self, path, missing_dir_ok):

Review Comment:
   I don't think either approach you suggest is better than the explicit 
compatibility breakage. This is indeed an annoyance for third-party 
implementations, but there are probably not many of them, and their authors 
should be competent enough to write the necessary compatibility handling code 
if required (basically by inspecting the PyArrow version).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to