浏览代码

[filebrowser] use get for handling missing key in resp… (#3121)

* [filebrowser] use get to access lastModified in response

* [filebrowser] fix python linting
Bjorn Alm 2 年之前
父节点
当前提交
8f6ee50509
共有 1 个文件被更改,包括 8 次插入8 次删除
  1. 8 8
      desktop/libs/azure/src/azure/abfs/abfsstats.py

+ 8 - 8
desktop/libs/azure/src/azure/abfs/abfsstats.py

@@ -22,12 +22,12 @@ from azure.abfs.__init__ import strip_path, abfsdatetime_to_timestamp
 from django.utils.encoding import smart_str
 
 LOG = logging.getLogger(__name__)
-CHAR_TO_OCT = {"---": 0, "--x" : 1, "-w-": 2, "-wx": 3, "r--" : 4, "r-x" : 5, "rw-" : 6,"rwx": 7}
+CHAR_TO_OCT = {"---": 0, "--x": 1, "-w-": 2, "-wx": 3, "r--": 4, "r-x": 5, "rw-": 6, "rwx": 7}
 
 
 class ABFSStat(object):
 
-  def __init__(self, isDir, atime, mtime, size, path, owner = '', group = '', mode = None):
+  def __init__(self, isDir, atime, mtime, size, path, owner='', group='', mode=None):
     self.name = strip_path(path)
     self.path = path
     self.isDir = isDir
@@ -65,15 +65,15 @@ class ABFSStat(object):
     return False
 
   @classmethod
-  def for_root(cls,path):
+  def for_root(cls, path):
     return cls(True, 0, 0, 0, path)
 
   @classmethod
-  def for_filesystems(cls,headers,resp, scheme):
+  def for_filesystems(cls, headers, resp, scheme):
     return cls(True, headers['date'], resp['lastModified'], 0, scheme + resp['name'])
 
   @classmethod
-  def for_directory(cls,headers,resp, path):
+  def for_directory(cls, headers, resp, path):
     try:
       size = int(resp['contentLength'])
     except:
@@ -86,17 +86,17 @@ class ABFSStat(object):
       permissions = ABFSStat.char_permissions_to_oct_permissions(resp['permissions'])
     except:
       permissions = None
-    return cls(isDir, headers['date'], resp['lastModified'], size, path, resp.get('owner'), resp.get('group'), mode = permissions)
+    return cls(isDir, headers['date'], resp.get('lastModified'), size, path, resp.get('owner'), resp.get('group'), mode=permissions)
 
   @classmethod
-  def for_single(cls,resp, path):
+  def for_single(cls, resp, path):
     size = int(resp['Content-Length'])
     isDir = resp['x-ms-resource-type'] == 'directory'
     try:
       permissions = ABFSStat.char_permissions_to_oct_permissions(resp['x-ms-permissions'])
     except:
       permissions = None
-    return cls(isDir, resp['date'],resp['Last-Modified'], size, path, resp.get('x-ms-owner'), resp.get('x-ms-group'), mode = permissions)
+    return cls(isDir, resp['date'], resp['Last-Modified'], size, path, resp.get('x-ms-owner'), resp.get('x-ms-group'), mode=permissions)
 
   @classmethod
   def for_filesystem(cls, resp, path):