summaryrefslogtreecommitdiff
path: root/fs/expose
diff options
context:
space:
mode:
authorbtimby <btimby@67cdc799-7952-0410-af00-57a81ceafa0f>2012-04-19 17:23:44 +0000
committerbtimby <btimby@67cdc799-7952-0410-af00-57a81ceafa0f>2012-04-19 17:23:44 +0000
commit49c744fe60b4944fedaeb9a8a4e493d92f5ac30b (patch)
tree404e0fa7133900a75a48382d84f46367fa0ae31a /fs/expose
parente86519ea6d15577bdb8775c2edbe1ea6224c423f (diff)
downloadpyfilesystem-49c744fe60b4944fedaeb9a8a4e493d92f5ac30b.tar.gz
Some cleanup, more PEP8 stuff
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@772 67cdc799-7952-0410-af00-57a81ceafa0f
Diffstat (limited to 'fs/expose')
-rw-r--r--fs/expose/sftp.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/fs/expose/sftp.py b/fs/expose/sftp.py
index 2487e07..11b6d35 100644
--- a/fs/expose/sftp.py
+++ b/fs/expose/sftp.py
@@ -124,22 +124,21 @@ class SFTPServerInterface(paramiko.SFTPServerInterface):
path = path.decode(self.encoding)
info = self.fs.getinfo(path)
- get = info.get
stat = paramiko.SFTPAttributes()
stat.filename = basename(path).encode(self.encoding)
stat.st_size = info.get("size")
if 'st_atime' in info:
- stat.st_atime = get('st_atime')
+ stat.st_atime = info.get('st_atime')
elif 'accessed_time' in info:
- stat.st_atime = time.mktime(get("accessed_time").timetuple())
+ stat.st_atime = time.mktime(info.get("accessed_time").timetuple())
if 'st_mtime' in info:
- stat.st_mtime = get('st_mtime')
+ stat.st_mtime = info.get('st_mtime')
else:
if 'modified_time' in info:
- stat.st_mtime = time.mktime(get("modified_time").timetuple())
+ stat.st_mtime = time.mktime(info.get("modified_time").timetuple())
if isdir(self.fs, path, info):
stat.st_mode = 0777 | statinfo.S_IFDIR
@@ -152,7 +151,7 @@ class SFTPServerInterface(paramiko.SFTPServerInterface):
@report_sftp_errors
def remove(self, path):
- if not isinstance(path,unicode):
+ if not isinstance(path, unicode):
path = path.decode(self.encoding)
self.fs.remove(path)
return paramiko.SFTP_OK
@@ -178,7 +177,7 @@ class SFTPServerInterface(paramiko.SFTPServerInterface):
@report_sftp_errors
def rmdir(self, path):
- if not isinstance(path,unicode):
+ if not isinstance(path, unicode):
path = path.decode(self.encoding)
self.fs.removedir(path)
return paramiko.SFTP_OK
@@ -215,10 +214,10 @@ class SFTPHandle(paramiko.SFTPHandle):
super(SFTPHandle,self).__init__(flags)
mode = flags_to_mode(flags) + "b"
self.owner = owner
- if not isinstance(path,unicode):
+ if not isinstance(path, unicode):
path = path.decode(self.owner.encoding)
self.path = path
- self._file = owner.fs.open(path,mode)
+ self._file = owner.fs.open(path, mode)
@report_sftp_errors
def close(self):
@@ -240,7 +239,7 @@ class SFTPHandle(paramiko.SFTPHandle):
return self.owner.stat(self.path)
def chattr(self,attr):
- return self.owner.chattr(self.path,attr)
+ return self.owner.chattr(self.path, attr)
class SFTPRequestHandler(SocketServer.BaseRequestHandler):
@@ -260,7 +259,7 @@ class SFTPRequestHandler(SocketServer.BaseRequestHandler):
so.digests = ('hmac-sha1', )
so.compression = ('zlib@openssh.com', 'none')
self.transport.add_server_key(self.server.host_key)
- self.transport.set_subsystem_handler("sftp", paramiko.SFTPServer, SFTPServerInterface, self.server.fs, self.server.encoding)
+ self.transport.set_subsystem_handler("sftp", paramiko.SFTPServer, SFTPServerInterface, self.server.fs, encoding=self.server.encoding)
def handle(self):
"""