diff options
author | hut <hut@lavabit.com> | 2010-05-05 22:45:22 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-05-05 22:45:22 +0200 |
commit | c6953a55e46aee37a854dff3be5d965b19a7341a (patch) | |
tree | 8ab0bfc30ce640e879f6d75b5dc639cf64101e4d /ranger/fsobject/directory.py | |
parent | da440d3a10b7ab05e9b55968344fff2cbc45da09 (diff) | |
download | ranger-c6953a55e46aee37a854dff3be5d965b19a7341a.tar.gz |
cleanups
Diffstat (limited to 'ranger/fsobject/directory.py')
-rw-r--r-- | ranger/fsobject/directory.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py index 43af772a..ca071510 100644 --- a/ranger/fsobject/directory.py +++ b/ranger/fsobject/directory.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -import os +import os.path from collections import deque from time import time @@ -34,9 +34,6 @@ def sort_by_directory(path): """returns 0 if path is a directory, otherwise 1 (for sorting)""" return 1 - path.is_directory -class NoDirectoryGiven(Exception): - pass - class Directory(FileSystemObject, Accumulator, SettingsAware): is_directory = True enterable = False @@ -69,10 +66,7 @@ class Directory(FileSystemObject, Accumulator, SettingsAware): } def __init__(self, path): - from os.path import isfile - - if isfile(path): - raise NoDirectoryGiven() + assert not os.path.isfile(path), "No directory given!" Accumulator.__init__(self) FileSystemObject.__init__(self, path) @@ -402,8 +396,8 @@ class Directory(FileSystemObject, Accumulator, SettingsAware): def __len__(self): """The number of containing files""" - if not self.accessible or not self.content_loaded: - raise ranger.fsobject.NotLoadedYet() + assert self.accessible + assert self.content_loaded assert self.files is not None return len(self.files) |