changeset 2924:59aea54e74a8

memory: minor style change
author Goffi <goffi@goffi.org>
date Fri, 26 Apr 2019 11:57:26 +0200
parents 1fd3ecb3351a
children 03a09e16bf28
files sat/memory/memory.py
diffstat 1 files changed, 21 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/sat/memory/memory.py	Fri Apr 26 11:57:26 2019 +0200
+++ b/sat/memory/memory.py	Fri Apr 26 11:57:26 2019 +0200
@@ -1315,26 +1315,11 @@
 
     @defer.inlineCallbacks
     def getFiles(
-        self,
-        client,
-        peer_jid,
-        file_id=None,
-        version=None,
-        parent=None,
-        path=None,
-        type_=None,
-        file_hash=None,
-        hash_algo=None,
-        name=None,
-        namespace=None,
-        mime_type=None,
-        owner=None,
-        access=None,
-        projection=None,
-        unique=False,
-        perms_to_check=(C.ACCESS_PERM_READ,),
-    ):
-        """retrieve files with with given filters
+        self, client, peer_jid, file_id=None, version=None, parent=None, path=None,
+        type_=None, file_hash=None, hash_algo=None, name=None, namespace=None,
+        mime_type=None, owner=None, access=None, projection=None, unique=False,
+        perms_to_check=(C.ACCESS_PERM_READ,)):
+        """Retrieve files with with given filters
 
         @param peer_jid(jid.JID, None): jid trying to access the file
             needed to check permission.
@@ -1347,6 +1332,15 @@
         @param parent(unicode, None): id of the directory containing the files
             None to ignore
             empty string to look for root files/directories
+        @param path(unicode, None): path to the directory containing the files
+        @param type_(unicode, None): type of file filter, can be one of C.FILE_TYPE_*
+        @param file_hash(unicode, None): hash of the file to retrieve
+        @param hash_algo(unicode, None): algorithm use for file_hash
+        @param name(unicode, None): name of the file to retrieve
+        @param namespace(unicode, None): namespace of the files to retrieve
+        @param mime_type(unicode, None): filter on this mime type
+        @param owner(jid.JID, None): if not None, only get files from this owner
+        @param access(dict, None): get file with given access (see [setFile])
         @param projection(list[unicode], None): name of columns to retrieve
             None to retrieve all
         @param unique(bool): if True will remove duplicates
@@ -1356,12 +1350,14 @@
         other params are the same as for [setFile]
         @return (list[dict]): files corresponding to filters
         @raise exceptions.NotFound: parent directory not found (when path is specified)
-        @raise exceptions.PermissionError: peer_jid can't use perms_to_check for one of the file
+        @raise exceptions.PermissionError: peer_jid can't use perms_to_check for one of
+                                           the file
             on the path
         """
         if peer_jid is None and perms_to_check or perms_to_check is None and peer_jid:
             raise exceptions.InternalError(
-                "if you want to disable permission check, both peer_jid and perms_to_check must be None"
+                u"if you want to disable permission check, both peer_jid and "
+                u"perms_to_check must be None"
             )
         if owner is not None:
             owner = owner.userhostJID()
@@ -1375,7 +1371,7 @@
                 # the parent directory is not found
                 raise failure.Failure(exceptions.NotFound())
         if parent and peer_jid:
-            # if parent is given directly and permission check is need,
+            # if parent is given directly and permission check is requested,
             # we need to check all the parents
             parent_data = yield self.storage.getFiles(client, file_id=parent)
             try:
@@ -1404,7 +1400,7 @@
         )
 
         if peer_jid:
-            #  if permission are checked, we must remove all file tha use can't access
+            # if permission are checked, we must remove all file that user can't access
             to_remove = []
             for file_data in files:
                 try:
@@ -1422,7 +1418,7 @@
             namespace=None, mime_type=None, created=None, modified=None, owner=None,
             access=None, extra=None, peer_jid=None, perms_to_check=(C.ACCESS_PERM_WRITE,)
             ):
-        """set a file metadata
+        """Set a file metadata
 
         @param name(unicode): basename of the file
         @param file_id(unicode): unique id of the file