diff options
author | willmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f> | 2012-01-08 15:43:58 +0000 |
---|---|---|
committer | willmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f> | 2012-01-08 15:43:58 +0000 |
commit | 531765118546803f502d1bbd89affc2d7d693342 (patch) | |
tree | 0c18d3599dd12049a8cefdae6cca4799f5c29637 /fs/osfs | |
parent | 8834161b2cf8eee026fc33c8251b4323cc907018 (diff) | |
download | pyfilesystem-531765118546803f502d1bbd89affc2d7d693342.tar.gz |
Some optimizations
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@735 67cdc799-7952-0410-af00-57a81ceafa0f
Diffstat (limited to 'fs/osfs')
-rw-r--r-- | fs/osfs/__init__.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/fs/osfs/__init__.py b/fs/osfs/__init__.py index 013b64e..f491e22 100644 --- a/fs/osfs/__init__.py +++ b/fs/osfs/__init__.py @@ -15,6 +15,7 @@ For example, to print all the files and directories in the OS root:: import os import os.path +from os.path import exists as _exists, isdir as _isdir, isfile as _isfile import sys import errno import datetime @@ -221,23 +222,21 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS): return super(OSFS,self).setcontents(path, contents, chunk_size) @convert_os_errors - def exists(self, path): - path = self.getsyspath(path) - return os.path.exists(path) + def exists(self, path): + return _exists(self.getsyspath(path)) @convert_os_errors - def isdir(self, path): - path = self.getsyspath(path) - return os.path.isdir(path) + def isdir(self, path): + return _isdir(self.getsyspath(path)) @convert_os_errors - def isfile(self, path): - path = self.getsyspath(path) - return os.path.isfile(path) + def isfile(self, path): + return _isfile(self.getsyspath(path)) @convert_os_errors - def listdir(self, path="./", wildcard=None, full=False, absolute=False, dirs_only=False, files_only=False): - paths = [self._decode_path(p) for p in os.listdir(self.getsyspath(path))] + def listdir(self, path="./", wildcard=None, full=False, absolute=False, dirs_only=False, files_only=False): + _decode_path = self._decode_path + paths = [_decode_path(p) for p in os.listdir(self.getsyspath(path))] return self._listdir_helper(path, paths, wildcard, full, absolute, dirs_only, files_only) @convert_os_errors |