diff options
Diffstat (limited to 'morphlib/morphologyfinder.py')
-rw-r--r-- | morphlib/morphologyfinder.py | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/morphlib/morphologyfinder.py b/morphlib/morphologyfinder.py index affa0e97..87c0de1a 100644 --- a/morphlib/morphologyfinder.py +++ b/morphlib/morphologyfinder.py @@ -1,4 +1,4 @@ -# Copyright (C) 2013 Codethink Limited +# Copyright (C) 2013-2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -34,38 +34,29 @@ class MorphologyFinder(object): self.gitdir = gitdir self.ref = ref - def read_morphology(self, name): + def read_morphology(self, filename): '''Return the un-parsed text of a morphology. For the given morphology name, locate and return the contents of the morphology as a string. - Also returns a string describing where in the repository the - morphology is located. - Parsing of this morphology into a form useful for manipulating is handled by the MorphologyLoader class. ''' - filename = '%s.morph' % name - return self.gitdir.read_file(filename, self.ref), filename + return self.gitdir.read_file(filename, self.ref) def list_morphologies(self): - '''Return the names of all morphologies in the (repo, ref). + '''Return the filenames of all morphologies in the (repo, ref). Finds all morphologies in the git directory at the specified - ref. Morphology names are returned instead of filenames, - so the implementation may change how morphologies are stored - in git repositories. + ref. ''' def is_morphology_path(path): return path.endswith('.morph') - def transform_path_to_name(path): - return path[:-len('.morph')] - - return (transform_path_to_name(path) + return (path for path in self.gitdir.list_files(self.ref) if is_morphology_path(path)) |