Skip to content

Commit

Permalink
more consistent property, doc tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Feb 7, 2018
1 parent 0b4dcd4 commit bc1f0c7
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 27 deletions.
2 changes: 1 addition & 1 deletion fs/base.py
Expand Up @@ -45,7 +45,7 @@ class FS(object):
_meta = {}

# most FS will use default walking algorithms
walker_class=Walker
walker_class = Walker

def __init__(self):
"""Create a filesystem. See help(type(self)) for accurate signature.
Expand Down
5 changes: 4 additions & 1 deletion fs/compress.py
Expand Up @@ -148,7 +148,10 @@ def write_tar(src_fs,
current_time = time.time()
walker = walker or Walker()
with _tar:
gen_walk = walker.info(src_fs, namespaces=["details", "stat", "access"])
gen_walk = walker.info(
src_fs,
namespaces=["details", "stat", "access"]
)
for path, info in gen_walk:
# Tar names must be relative
tar_name = relpath(path)
Expand Down
1 change: 0 additions & 1 deletion fs/filesize.py
Expand Up @@ -17,7 +17,6 @@
__all__ = ['traditional', 'decimal', 'binary']



def _to_str(size, suffixes, base):
try:
size = int(size)
Expand Down
4 changes: 2 additions & 2 deletions fs/ftpfs.py
Expand Up @@ -342,9 +342,9 @@ def user(self):
@property
def host(self):
return (
self.proxy
if self.proxy is not None else
self._host
if self.proxy is None else
self.proxy
)

@classmethod
Expand Down
1 change: 1 addition & 0 deletions fs/opener/errors.py
Expand Up @@ -2,6 +2,7 @@
"""Errors raised when attempting to open a filesystem.
"""


class ParseError(ValueError):
"""Attempt to parse an invalid FS URL.
"""
Expand Down
1 change: 0 additions & 1 deletion fs/permissions.py
Expand Up @@ -16,7 +16,6 @@ def make_mode(init):
class _PermProperty(object):
"""Creates simple properties to get/set permissions.
"""

def __init__(self, name):
self._name = name
self.__doc__ = "Boolean for '{}' permission.".format(name)
Expand Down
2 changes: 1 addition & 1 deletion fs/tempfs.py
Expand Up @@ -4,7 +4,7 @@
(``/tmp`` on linux). The contents are deleted when the filesystem
is closed.
A `TempFS` is a good way of preparing a directory structure in advance,
A `TempFS` is a good way of preparing a directory structure in advance,
that you can later copy. It can also be used as a temporary data store.
"""
Expand Down
21 changes: 1 addition & 20 deletions fs/zipfs.py
Expand Up @@ -76,7 +76,7 @@ def seek(self, offset, whence=Seek.set):
offset += self._pos
if whence == Seek.current or whence == Seek.set:
if offset < 0:
raise ValueError("Negative seek position {}".format(offset))
raise ValueError("Negative seek position {}".format(offset))
elif whence == Seek.end:
if offset > 0:
raise ValueError("Positive seek position {}".format(offset))
Expand Down Expand Up @@ -391,22 +391,3 @@ def getbytes(self, path):
zip_name = self._path_to_zip_name(path)
zip_bytes = self._zip.read(zip_name)
return zip_bytes


if __name__ == "__main__": # pragma: nocover
from fs.tree import render
from fs.opener import open_fs

with ZipFS('tests.zip') as zip_fs:
print(zip_fs.listdir('/'))
print(zip_fs.listdir('/tests/'))
print(zip_fs.gettext('tests/ttt/settings.ini'))
render(zip_fs)
print(zip_fs)
print(repr(zip_fs))

with ZipFS("zipfs.zip", write=True) as zip_fs:
zip_fs.makedirs('foo/bar')
zip_fs.settext('foo/bar/baz.txt', 'Hello, World')
print(zip_fs)
print(repr(zip_fs))

0 comments on commit bc1f0c7

Please sign in to comment.