Skip to content

Commit afdcf8c

Browse files
committed
Fix documentation-related errors found by pydocstyle
1 parent a433d9e commit afdcf8c

23 files changed

Lines changed: 194 additions & 158 deletions

fs/base.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ def readbytes(self, path):
598598

599599
def download(self, path, file, chunk_size=None, **options):
600600
# type: (Text, BinaryIO, Optional[int], **Any) -> None
601-
"""Copies a file from the filesystem to a file-like object.
601+
"""Copy a file from the filesystem to a file-like object.
602602
603603
This may be more efficient that opening and copying files
604604
manually if the filesystem supplies an optimized method.
@@ -741,7 +741,7 @@ def getsyspath(self, path):
741741
# type: (Text) -> Text
742742
"""Get the *system path* of a resource.
743743
744-
Parameters:
744+
Arguments:
745745
path (str): A path on the filesystem.
746746
747747
Returns:
@@ -777,10 +777,9 @@ def getsyspath(self, path):
777777

778778
def getospath(self, path):
779779
# type: (Text) -> bytes
780-
"""Get a *system path* to a resource, encoded in the operating
781-
system's prefered encoding.
780+
"""Get the *system path* to a resource, in the OS' prefered encoding.
782781
783-
Parameters:
782+
Arguments:
784783
path (str): A path on the filesystem.
785784
786785
Returns:
@@ -809,7 +808,7 @@ def gettype(self, path):
809808
# type: (Text) -> ResourceType
810809
"""Get the type of a resource.
811810
812-
Parameters:
811+
Arguments:
813812
path (str): A path on the filesystem.
814813
815814
Returns:
@@ -847,7 +846,7 @@ def geturl(self, path, purpose="download"):
847846
# type: (Text, Text) -> Text
848847
"""Get the URL to a given resource.
849848
850-
Parameters:
849+
Arguments:
851850
path (str): A path on the filesystem
852851
purpose (str): A short string that indicates which URL
853852
to retrieve for the given path (if there is more than
@@ -868,7 +867,7 @@ def hassyspath(self, path):
868867
# type: (Text) -> bool
869868
"""Check if a path maps to a system path.
870869
871-
Parameters:
870+
Arguments:
872871
path (str): A path on the filesystem.
873872
874873
Returns:
@@ -886,7 +885,7 @@ def hasurl(self, path, purpose="download"):
886885
# type: (Text, Text) -> bool
887886
"""Check if a path has a corresponding URL.
888887
889-
Parameters:
888+
Arguments:
890889
path (str): A path on the filesystem.
891890
purpose (str): A purpose parameter, as given in
892891
`~fs.base.FS.geturl`.
@@ -911,7 +910,7 @@ def isdir(self, path):
911910
# type: (Text) -> bool
912911
"""Check if a path maps to an existing directory.
913912
914-
Parameters:
913+
Arguments:
915914
path (str): A path on the filesystem.
916915
917916
Returns:
@@ -930,7 +929,7 @@ def isempty(self, path):
930929
A directory is considered empty when it does not contain
931930
any file or any directory.
932931
933-
Parameters:
932+
Arguments:
934933
path (str): A path to a directory on the filesystem.
935934
936935
Returns:
@@ -947,7 +946,7 @@ def isfile(self, path):
947946
# type: (Text) -> bool
948947
"""Check if a path maps to an existing file.
949948
950-
Parameters:
949+
Arguments:
951950
path (str): A path on the filesystem.
952951
953952
Returns:
@@ -963,7 +962,7 @@ def islink(self, path):
963962
# type: (Text) -> bool
964963
"""Check if a path maps to a symlink.
965964
966-
Parameters:
965+
Arguments:
967966
path (str): A path on the filesystem.
968967
969968
Returns:
@@ -1009,7 +1008,7 @@ def movedir(self, src_path, dst_path, create=False):
10091008
# type: (Text, Text, bool) -> None
10101009
"""Move directory ``src_path`` to ``dst_path``.
10111010
1012-
Parameters:
1011+
Arguments:
10131012
src_path (str): Path of source directory on the filesystem.
10141013
dst_path (str): Path to destination directory.
10151014
create (bool): If `True`, then ``dst_path`` will be created
@@ -1443,8 +1442,7 @@ def touch(self, path):
14431442

14441443
def validatepath(self, path):
14451444
# type: (Text) -> Text
1446-
"""Check if a path is valid, returning a normalized absolute
1447-
path.
1445+
"""Validate a path, returning a normalized absolute path on sucess.
14481446
14491447
Many filesystems have restrictions on the format of paths they
14501448
support. This method will check that ``path`` is valid on the

fs/compress.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ def write_zip(
4646
compression (int): Compression to use (one of the constants
4747
defined in the `zipfile` module in the stdlib). Defaults
4848
to `zipfile.ZIP_DEFLATED`.
49-
encoding (str):
50-
The encoding to use for filenames. The default is ``"utf-8"``,
51-
use ``"CP437"`` if compatibility with WinZip is desired.
49+
encoding (str): The encoding to use for filenames. The default
50+
is ``"utf-8"``, use ``"CP437"`` if compatibility with WinZip
51+
is desired.
5252
walker (~fs.walk.Walker, optional): A `Walker` instance, or `None`
5353
to use default walker. You can use this to specify which files
5454
you want to compress.
@@ -116,6 +116,7 @@ def write_tar(
116116
"""Write the contents of a filesystem to a tar file.
117117
118118
Arguments:
119+
src_fs (~fs.base.FS): The source filesystem to compress.
119120
file (str or io.IOBase): Destination file, may be a file
120121
name or an open file object.
121122
compression (str, optional): Compression to use, or `None`

fs/copy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def copy_file_internal(
150150
dst_path, # type: Text
151151
):
152152
# type: (...) -> None
153-
"""Low level copy, that doesn't call manage_fs or lock.
153+
"""Copy a file at low level, without calling `manage_fs` or locking.
154154
155155
If the destination exists, and is a file, it will be first truncated.
156156
@@ -160,7 +160,7 @@ def copy_file_internal(
160160
Arguments:
161161
src_fs (FS): Source filesystem.
162162
src_path (str): Path to a file on the source filesystem.
163-
dst_fs (FS: Destination filesystem.
163+
dst_fs (FS): Destination filesystem.
164164
dst_path (str): Path to a file on the destination filesystem.
165165
166166
"""

fs/errors.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
class MissingInfoNamespace(AttributeError):
5858
"""An expected namespace is missing."""
5959

60-
def __init__(self, namespace):
60+
def __init__(self, namespace): # noqa: D107
6161
# type: (Text) -> None
6262
self.namespace = namespace
6363
msg = "namespace '{}' is required for this attribute"
@@ -73,7 +73,7 @@ class FSError(Exception):
7373

7474
default_message = "Unspecified error"
7575

76-
def __init__(self, msg=None):
76+
def __init__(self, msg=None): # noqa: D107
7777
# type: (Optional[Text]) -> None
7878
self._msg = msg or self.default_message
7979
super(FSError, self).__init__()
@@ -101,7 +101,7 @@ class BulkCopyFailed(FSError):
101101

102102
default_message = "One or more copy operations failed (see errors attribute)"
103103

104-
def __init__(self, errors):
104+
def __init__(self, errors): # noqa: D107
105105
self.errors = errors
106106
super(BulkCopyFailed, self).__init__()
107107

@@ -111,7 +111,7 @@ class CreateFailed(FSError):
111111

112112
default_message = "unable to create filesystem, {details}"
113113

114-
def __init__(self, msg=None, exc=None):
114+
def __init__(self, msg=None, exc=None): # noqa: D107
115115
# type: (Optional[Text], Optional[Exception]) -> None
116116
self._msg = msg or self.default_message
117117
self.details = "" if exc is None else text_type(exc)
@@ -139,7 +139,7 @@ class PathError(FSError):
139139

140140
default_message = "path '{path}' is invalid"
141141

142-
def __init__(self, path, msg=None):
142+
def __init__(self, path, msg=None): # noqa: D107
143143
# type: (Text, Optional[Text]) -> None
144144
self.path = path
145145
super(PathError, self).__init__(msg=msg)
@@ -159,7 +159,7 @@ class NoURL(PathError):
159159

160160
default_message = "path '{path}' has no '{purpose}' URL"
161161

162-
def __init__(self, path, purpose, msg=None):
162+
def __init__(self, path, purpose, msg=None): # noqa: D107
163163
# type: (Text, Text, Optional[Text]) -> None
164164
self.purpose = purpose
165165
super(NoURL, self).__init__(path, msg=msg)
@@ -190,7 +190,7 @@ def __init__(
190190
path=None, # type: Optional[Text]
191191
exc=None, # type: Optional[Exception]
192192
msg=None, # type: Optional[Text]
193-
):
193+
): # noqa: D107
194194
# type: (...) -> None
195195
self.path = path
196196
self.exc = exc
@@ -243,7 +243,7 @@ class ResourceError(FSError):
243243

244244
default_message = "failed on path {path}"
245245

246-
def __init__(self, path, exc=None, msg=None):
246+
def __init__(self, path, exc=None, msg=None): # noqa: D107
247247
# type: (Text, Optional[Exception], Optional[Text]) -> None
248248
self.path = path
249249
self.exc = exc
@@ -326,7 +326,7 @@ class IllegalBackReference(ValueError):
326326
327327
"""
328328

329-
def __init__(self, path):
329+
def __init__(self, path): # noqa: D107
330330
# type: (Text) -> None
331331
self.path = path
332332
msg = ("path '{path}' contains back-references outside of filesystem").format(

fs/ftpfs.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -347,18 +347,6 @@ def seek(self, pos, whence=Seek.set):
347347

348348
class FTPFS(FS):
349349
"""A FTP (File Transport Protocol) Filesystem.
350-
351-
Arguments:
352-
host (str): A FTP host, e.g. ``'ftp.mirror.nl'``.
353-
user (str): A username (default is ``'anonymous'``).
354-
passwd (str): Password for the server, or `None` for anon.
355-
acct (str): FTP account.
356-
timeout (int): Timeout for contacting server (in seconds,
357-
defaults to 10).
358-
port (int): FTP port number (default 21).
359-
proxy (str, optional): An FTP proxy, or ``None`` (default)
360-
for no proxy.
361-
362350
"""
363351

364352
_meta = {
@@ -381,6 +369,20 @@ def __init__(
381369
proxy=None, # type: Optional[Text]
382370
):
383371
# type: (...) -> None
372+
"""Create a new `FTPFS` instance.
373+
374+
Arguments:
375+
host (str): A FTP host, e.g. ``'ftp.mirror.nl'``.
376+
user (str): A username (default is ``'anonymous'``).
377+
passwd (str): Password for the server, or `None` for anon.
378+
acct (str): FTP account.
379+
timeout (int): Timeout for contacting server (in seconds,
380+
defaults to 10).
381+
port (int): FTP port number (default 21).
382+
proxy (str, optional): An FTP proxy, or ``None`` (default)
383+
for no proxy.
384+
385+
"""
384386
super(FTPFS, self).__init__()
385387
self._host = host
386388
self._user = user
@@ -494,9 +496,9 @@ def _get_ftp(self):
494496
return self._ftp
495497

496498
@property
497-
def features(self):
499+
def features(self): # noqa: D401
498500
# type: () -> Dict[Text, Text]
499-
"""dict: features of the remote FTP server."""
501+
"""`dict`: Features of the remote FTP server."""
500502
self._get_ftp()
501503
return self._features
502504

0 commit comments

Comments
 (0)