Skip to content

Commit 051124c

Browse files
author
Travis Cunningham
committed
Merge pull request #3 from smartfile/bypass-lock-arg
Bypass lock arg
2 parents d733cab + 240b0e3 commit 051124c

29 files changed

+410
-364
lines changed

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
PYTHON=python
2+
TSCRIPT=fs/tests/runner.py
3+
4+
all: test
5+
6+
clean:
7+
rm -f `find . -type f -name \*.py[co]`
8+
rm -f `find . -type f -name \*.so`
9+
rm -f `find . -type f -name \*.~`
10+
rm -f `find . -type f -name \*.orig`
11+
rm -f `find . -type f -name \*.bak`
12+
rm -f `find . -type f -name \*.rej`
13+
rm -rf `find . -type d -name __pycache__`
14+
rm -rf *.egg-info
15+
rm -rf build
16+
rm -rf dist
17+
18+
install:
19+
$(PYTHON) setup.py build
20+
$(PYTHON) setup.py develop
21+
22+
test: install
23+
$(PYTHON) $(TSCRIPT)

fs/base.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ def makedir(self, path, recursive=False, allow_recreate=False):
641641
"""
642642
raise UnsupportedError("make directory")
643643

644-
def remove(self, path):
644+
def remove(self, path, **kwargs):
645645
"""Remove a file from the filesystem.
646646
647647
:param path: Path of the resource to remove
@@ -654,7 +654,7 @@ def remove(self, path):
654654
"""
655655
raise UnsupportedError("remove resource")
656656

657-
def removedir(self, path, recursive=False, force=False):
657+
def removedir(self, path, recursive=False, force=False, **kwargs):
658658
"""Remove a directory from the filesystem
659659
660660
:param path: path of the directory to remove
@@ -803,7 +803,7 @@ def _setcontents(self,
803803
chunk_size=1024 * 64,
804804
progress_callback=None,
805805
finished_callback=None,
806-
bypass_lock=False):
806+
**kwargs):
807807
"""Does the work of setcontents. Factored out, so that `setcontents_async` can use it"""
808808
if progress_callback is None:
809809
progress_callback = lambda bytes_written: None
@@ -824,9 +824,9 @@ def _setcontents(self,
824824
chunk = read(chunk_size)
825825
if isinstance(chunk, six.text_type):
826826
f = self.open(path, 'wt', encoding=encoding, errors=errors,
827-
bypass_lock=bypass_lock)
827+
**kwargs)
828828
else:
829-
f = self.open(path, 'wb', bypass_lock=bypass_lock)
829+
f = self.open(path, 'wb', **kwargs)
830830
write = f.write
831831
try:
832832
while chunk:
@@ -851,7 +851,7 @@ def _setcontents(self,
851851
return bytes_written
852852

853853
def setcontents(self, path, data=b'', encoding=None, errors=None,
854-
chunk_size=1024 * 64, bypass_lock=False):
854+
chunk_size=1024 * 64, **kwargs):
855855
"""A convenience method to create a new file from a string or file-like object
856856
857857
:param path: a path of the file to create
@@ -861,7 +861,7 @@ def setcontents(self, path, data=b'', encoding=None, errors=None,
861861
:param chunk_size: Number of bytes to read in a chunk, if the implementation has to resort to a read / copy loop
862862
863863
"""
864-
return self._setcontents(path, data, encoding=encoding, errors=errors, chunk_size=1024 * 64, bypass_lock=bypass_lock)
864+
return self._setcontents(path, data, encoding=encoding, errors=errors, chunk_size=1024 * 64, **kwargs)
865865

866866
def setcontents_async(self,
867867
path,
@@ -1113,7 +1113,7 @@ def getsize(self, path):
11131113
raise OperationFailedError("get size of resource", path)
11141114
return size
11151115

1116-
def copy(self, src, dst, overwrite=False, chunk_size=1024 * 64):
1116+
def copy(self, src, dst, overwrite=False, chunk_size=1024 * 64, **kwargs):
11171117
"""Copies a file from src to dst.
11181118
11191119
:param src: the source path
@@ -1213,7 +1213,8 @@ def move(self, src, dst, overwrite=False, chunk_size=16384):
12131213
bypass_lock=True)
12141214
self.remove(src, bypass_lock=True)
12151215

1216-
def movedir(self, src, dst, overwrite=False, ignore_errors=False, chunk_size=16384):
1216+
def movedir(self, src, dst, overwrite=False, ignore_errors=False,
1217+
chunk_size=16384, **kwargs):
12171218
"""moves a directory from one location to another.
12181219
12191220
:param src: source directory path

fs/contrib/archivefs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def getsize(self, path):
318318
else:
319319
return fs.getsize(delegate_path)
320320

321-
def remove(self, path):
321+
def remove(self, path, **kwargs):
322322
"""A remove() override that deletes an archive directly. It is not fooled
323323
by a mounted archive. If the path is not an archive, the call is delegated."""
324324
if libarchive.is_archive_name(path) and self.ismount(path):

fs/contrib/davfs/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def new_close():
346346
raise RemoteConnectionError("",msg=msg,details=e)
347347

348348
def setcontents(self,path, data=b'', encoding=None, errors=None,
349-
chunk_size=1024 * 64, bypass_lock=False):
349+
chunk_size=1024 * 64, **kwargs):
350350
if isinstance(data, six.text_type):
351351
data = data.encode(encoding=encoding, errors=errors)
352352
resp = self._request(path, "PUT", data)
@@ -577,7 +577,7 @@ def remove(self,path):
577577
raise_generic_error(response,"remove",path)
578578
return True
579579

580-
def removedir(self,path,recursive=False,force=False):
580+
def removedir(self,path,recursive=False,force=False,**kwargs):
581581
if self.isfile(path):
582582
raise ResourceInvalidError(path)
583583
if not force and self.listdir(path):
@@ -679,7 +679,7 @@ def _info_from_propfind(self,res):
679679
return info
680680

681681

682-
def copy(self,src,dst,overwrite=False,chunk_size=None):
682+
def copy(self, src, dst, overwrite=False, chunk_size=None, **kwargs):
683683
if self.isdir(src):
684684
msg = "Source is not a file: %(path)s"
685685
raise ResourceInvalidError(src, msg=msg)
@@ -712,7 +712,8 @@ def move(self,src,dst,overwrite=False,chunk_size=None):
712712
raise ResourceInvalidError(src, msg=msg)
713713
self._move(src,dst,overwrite=overwrite)
714714

715-
def movedir(self,src,dst,overwrite=False,ignore_errors=False,chunk_size=0):
715+
def movedir(self,src,dst,overwrite=False,ignore_errors=False,chunk_size=0,
716+
**kwargs):
716717
if self.isfile(src):
717718
msg = "Source is not a directory: %(path)s"
718719
raise ResourceInvalidError(src, msg=msg)

0 commit comments

Comments
 (0)