Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
PYTHON=python
TSCRIPT=fs/tests/runner.py

all: test

clean:
rm -f `find . -type f -name \*.py[co]`
rm -f `find . -type f -name \*.so`
rm -f `find . -type f -name \*.~`
rm -f `find . -type f -name \*.orig`
rm -f `find . -type f -name \*.bak`
rm -f `find . -type f -name \*.rej`
rm -rf `find . -type d -name __pycache__`
rm -rf *.egg-info
rm -rf build
rm -rf dist

install:
$(PYTHON) setup.py build
$(PYTHON) setup.py develop

test: install
$(PYTHON) $(TSCRIPT)
19 changes: 10 additions & 9 deletions fs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ def makedir(self, path, recursive=False, allow_recreate=False):
"""
raise UnsupportedError("make directory")

def remove(self, path):
def remove(self, path, **kwargs):
"""Remove a file from the filesystem.

:param path: Path of the resource to remove
Expand All @@ -654,7 +654,7 @@ def remove(self, path):
"""
raise UnsupportedError("remove resource")

def removedir(self, path, recursive=False, force=False):
def removedir(self, path, recursive=False, force=False, **kwargs):
"""Remove a directory from the filesystem

:param path: path of the directory to remove
Expand Down Expand Up @@ -803,7 +803,7 @@ def _setcontents(self,
chunk_size=1024 * 64,
progress_callback=None,
finished_callback=None,
bypass_lock=False):
**kwargs):
"""Does the work of setcontents. Factored out, so that `setcontents_async` can use it"""
if progress_callback is None:
progress_callback = lambda bytes_written: None
Expand All @@ -824,9 +824,9 @@ def _setcontents(self,
chunk = read(chunk_size)
if isinstance(chunk, six.text_type):
f = self.open(path, 'wt', encoding=encoding, errors=errors,
bypass_lock=bypass_lock)
**kwargs)
else:
f = self.open(path, 'wb', bypass_lock=bypass_lock)
f = self.open(path, 'wb', **kwargs)
write = f.write
try:
while chunk:
Expand All @@ -851,7 +851,7 @@ def _setcontents(self,
return bytes_written

def setcontents(self, path, data=b'', encoding=None, errors=None,
chunk_size=1024 * 64, bypass_lock=False):
chunk_size=1024 * 64, **kwargs):
"""A convenience method to create a new file from a string or file-like object

:param path: a path of the file to create
Expand All @@ -861,7 +861,7 @@ def setcontents(self, path, data=b'', encoding=None, errors=None,
:param chunk_size: Number of bytes to read in a chunk, if the implementation has to resort to a read / copy loop

"""
return self._setcontents(path, data, encoding=encoding, errors=errors, chunk_size=1024 * 64, bypass_lock=bypass_lock)
return self._setcontents(path, data, encoding=encoding, errors=errors, chunk_size=1024 * 64, **kwargs)

def setcontents_async(self,
path,
Expand Down Expand Up @@ -1113,7 +1113,7 @@ def getsize(self, path):
raise OperationFailedError("get size of resource", path)
return size

def copy(self, src, dst, overwrite=False, chunk_size=1024 * 64):
def copy(self, src, dst, overwrite=False, chunk_size=1024 * 64, **kwargs):
"""Copies a file from src to dst.

:param src: the source path
Expand Down Expand Up @@ -1213,7 +1213,8 @@ def move(self, src, dst, overwrite=False, chunk_size=16384):
bypass_lock=True)
self.remove(src, bypass_lock=True)

def movedir(self, src, dst, overwrite=False, ignore_errors=False, chunk_size=16384):
def movedir(self, src, dst, overwrite=False, ignore_errors=False,
chunk_size=16384, **kwargs):
"""moves a directory from one location to another.

:param src: source directory path
Expand Down
2 changes: 1 addition & 1 deletion fs/contrib/archivefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def getsize(self, path):
else:
return fs.getsize(delegate_path)

def remove(self, path):
def remove(self, path, **kwargs):
"""A remove() override that deletes an archive directly. It is not fooled
by a mounted archive. If the path is not an archive, the call is delegated."""
if libarchive.is_archive_name(path) and self.ismount(path):
Expand Down
9 changes: 5 additions & 4 deletions fs/contrib/davfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def new_close():
raise RemoteConnectionError("",msg=msg,details=e)

def setcontents(self,path, data=b'', encoding=None, errors=None,
chunk_size=1024 * 64, bypass_lock=False):
chunk_size=1024 * 64, **kwargs):
if isinstance(data, six.text_type):
data = data.encode(encoding=encoding, errors=errors)
resp = self._request(path, "PUT", data)
Expand Down Expand Up @@ -577,7 +577,7 @@ def remove(self,path):
raise_generic_error(response,"remove",path)
return True

def removedir(self,path,recursive=False,force=False):
def removedir(self,path,recursive=False,force=False,**kwargs):
if self.isfile(path):
raise ResourceInvalidError(path)
if not force and self.listdir(path):
Expand Down Expand Up @@ -679,7 +679,7 @@ def _info_from_propfind(self,res):
return info


def copy(self,src,dst,overwrite=False,chunk_size=None):
def copy(self, src, dst, overwrite=False, chunk_size=None, **kwargs):
if self.isdir(src):
msg = "Source is not a file: %(path)s"
raise ResourceInvalidError(src, msg=msg)
Expand Down Expand Up @@ -712,7 +712,8 @@ def move(self,src,dst,overwrite=False,chunk_size=None):
raise ResourceInvalidError(src, msg=msg)
self._move(src,dst,overwrite=overwrite)

def movedir(self,src,dst,overwrite=False,ignore_errors=False,chunk_size=0):
def movedir(self,src,dst,overwrite=False,ignore_errors=False,chunk_size=0,
**kwargs):
if self.isfile(src):
msg = "Source is not a directory: %(path)s"
raise ResourceInvalidError(src, msg=msg)
Expand Down
Loading