Skip to content

Commit

Permalink
imports [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
kszucs committed Sep 24, 2019
1 parent 5200af1 commit dd41d21
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 23 deletions.
68 changes: 68 additions & 0 deletions python/pyarrow/_fs.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# cython: language_level = 3

import six

from pyarrow.compat import frombytes, tobytes
from pyarrow.includes.common cimport *
from pyarrow.includes.libarrow cimport PyDateTime_from_TimePoint
from pyarrow.lib import _detect_compression
from pyarrow.lib cimport *


cpdef enum FileType:
NonExistent = <int8_t> CFileType_NonExistent
Unknown = <int8_t> CFileType_Unknown
File = <int8_t> CFileType_File
Directory = <int8_t> CFileType_Directory


cdef class FileStats:
cdef:
CFileStats stats

@staticmethod
cdef FileStats wrap(CFileStats stats)


cdef class Selector:
cdef:
CSelector selector


cdef class FileSystem:
cdef:
shared_ptr[CFileSystem] wrapped
CFileSystem* fs

cdef init(self, const shared_ptr[CFileSystem]& wrapped)


cdef class LocalFileSystem(FileSystem):
cdef:
CLocalFileSystem* localfs

cdef init(self, const shared_ptr[CFileSystem]& wrapped)


cdef class SubTreeFileSystem(FileSystem):
cdef:
CSubTreeFileSystem* subtreefs

cdef init(self, const shared_ptr[CFileSystem]& wrapped)
20 changes: 0 additions & 20 deletions python/pyarrow/_fs.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,9 @@ cdef inline c_string _path_as_bytes(path) except *:
return tobytes(path)


cpdef enum FileType:
NonExistent = <int8_t> CFileType_NonExistent
Unknown = <int8_t> CFileType_Unknown
File = <int8_t> CFileType_File
Directory = <int8_t> CFileType_Directory


cdef class FileStats:
"""FileSystem entry stats"""

cdef CFileStats stats

def __init__(self):
raise TypeError('dont initialize me')

Expand Down Expand Up @@ -147,7 +138,6 @@ cdef class Selector:
recursive : bool, default False
Whether to recurse into subdirectories.
"""
cdef CSelector selector

def __init__(self, base_dir, bint allow_non_existent=False,
bint recursive=False):
Expand Down Expand Up @@ -183,10 +173,6 @@ cdef class Selector:
cdef class FileSystem:
"""Abstract file system API"""

cdef:
shared_ptr[CFileSystem] wrapped
CFileSystem* fs

def __init__(self):
raise TypeError("FileSystem is an abstract class, instantiate one of "
"the subclasses instead: LocalFileSystem or "
Expand Down Expand Up @@ -475,9 +461,6 @@ cdef class LocalFileSystem(FileSystem):
except when deleting an entry).
"""

cdef:
CLocalFileSystem* localfs

def __init__(self):
cdef shared_ptr[CLocalFileSystem] wrapped
wrapped = make_shared[CLocalFileSystem]()
Expand All @@ -499,9 +482,6 @@ cdef class SubTreeFileSystem(FileSystem):
filesystem.
"""

cdef:
CSubTreeFileSystem* subtreefs

def __init__(self, base_path, FileSystem base_fs):
cdef:
c_string pathstr
Expand Down
7 changes: 4 additions & 3 deletions python/pyarrow/_s3.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import six

from pyarrow.compat import frombytes, tobytes
from pyarrow.includes.common cimport *
from pyarrow.includes.libarrow cimport PyDateTime_from_TimePoint
from pyarrow.lib import _detect_compression
from pyarrow.lib cimport *
from pyarrow.includes.libarrow cimport *
from pyarrow.includes.libarrow_s3 cimport *
from pyarrow._fs cimport FileSystem
from pyarrow.lib cimport check_status


cdef class S3FileSystem(FileSystem):
Expand Down

0 comments on commit dd41d21

Please sign in to comment.