kszucs commented on code in PR #45089:
URL: https://github.com/apache/arrow/pull/45089#discussion_r2177762351


##########
python/pyarrow/_fs.pyx:
##########
@@ -424,7 +424,39 @@ cdef class FileSystem(_Weakrefable):
         return fs
 
     @staticmethod
-    def from_uri(uri):
+    def _fsspec_from_uri(uri):
+        """Instantiate FSSpecHandler and path for the given URI."""
+        try:
+            import fsspec
+        except ImportError:
+            raise ImportError(
+                "`fsspec` is required to handle `fsspec+<filesystem>://` and 
`hf://` URIs."
+            )
+        from .fs import FSSpecHandler
+
+        uri = uri.removeprefix("fsspec+")
+        fs, path = fsspec.url_to_fs(uri)
+        fs = PyFileSystem(FSSpecHandler(fs))
+
+        return fs, path
+
+    @staticmethod
+    def _native_from_uri(uri):
+        """Instantiate native FileSystem and path for the given URI."""
+        cdef:
+            c_string c_path
+            c_string c_uri
+            CResult[shared_ptr[CFileSystem]] result
+
+        if isinstance(uri, pathlib.Path):
+            # Make absolute
+            uri = uri.resolve().absolute()
+        c_uri = tobytes(_stringify_path(uri))
+        with nogil:
+            result = CFileSystemFromUriOrPath(c_uri, &c_path)
+        return FileSystem.wrap(GetResultValue(result)), frombytes(c_path)
+
+    def from_uri(uri, treat_path_as_prefix=False):

Review Comment:
   Not relevant anymore.



-- 
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