summaryrefslogtreecommitdiff
path: root/morphlib/morphologyfinder.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2014-07-11 14:25:40 +0100
committerRichard Maw <richard.maw@codethink.co.uk>2014-07-11 14:25:40 +0100
commitce1fedb4e5ab82105853c4f3a8e05fb83f62c18e (patch)
tree6a738f64b517992eed10c3d5891bbb27840202e4 /morphlib/morphologyfinder.py
parentfe4486c1ec69c520a2c0aee7b52c35b57808120e (diff)
parent597f2a19363b7e91b928d814627c9236779998fb (diff)
downloadmorph-ce1fedb4e5ab82105853c4f3a8e05fb83f62c18e.tar.gz
Merge remote-tracking branch 'origin/baserock/richardmaw/S11284/morphologies-by-path-v4'
Reviewed-by: Sam Thursfield Reviewed-by: Lars Wirzenius
Diffstat (limited to 'morphlib/morphologyfinder.py')
-rw-r--r--morphlib/morphologyfinder.py21
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))