diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2013-11-15 15:54:55 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2013-11-22 13:49:25 +0000 |
commit | bf45b293195de34917387fa34874dd33a71fb4ba (patch) | |
tree | adabd2f166bf75e915c88d51d76d7dfd18411178 | |
parent | 994f06bc33ff2829e261eeec8b21ae1904967fc9 (diff) | |
download | morph-bf45b293195de34917387fa34874dd33a71fb4ba.tar.gz |
MorphologySet: Export traverse_specs method
The set of helpers isn't helping for re-usability, since every new use
for the traverse_specs method is different enough that it is only used
in one place.
So just export traverse_specs itself and be done with it.
-rw-r--r-- | morphlib/morphset.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/morphlib/morphset.py b/morphlib/morphset.py index 9ef1e804..6aabbde5 100644 --- a/morphlib/morphset.py +++ b/morphlib/morphset.py @@ -124,7 +124,7 @@ class MorphologySet(object): raise ChunkNotInStratumError(stratum_morph['name'], chunk_name) return repo_url, ref, morph - def _traverse_specs(self, cb_process, cb_filter=lambda s: True): + def traverse_specs(self, cb_process, cb_filter=lambda s: True): '''Higher-order function for processing every spec. This traverses every spec in all the morphologies, so all chunk, @@ -202,7 +202,7 @@ class MorphologySet(object): spec['ref'] = new_ref return True - self._traverse_specs(process_spec, wanted_spec) + self.traverse_specs(process_spec, wanted_spec) def list_refs(self): '''Return a set of all the (repo, ref) pairs in the MorphologySet. @@ -220,7 +220,7 @@ class MorphologySet(object): known.add((spec['repo'], spec['ref'])) return False - self._traverse_specs(process_spec, wanted_spec) + self.traverse_specs(process_spec, wanted_spec) return known @@ -242,7 +242,7 @@ class MorphologySet(object): spec['ref'] = new_ref return True - self._traverse_specs(process_spec, wanted_spec) + self.traverse_specs(process_spec, wanted_spec) def petrify_chunks(self, resolutions): '''Update _every_ chunk's ref to the value resolved in resolutions. @@ -272,7 +272,7 @@ class MorphologySet(object): spec['ref'] = resolutions[tup] return True - self._traverse_specs(process_chunk_spec, wanted_chunk_spec) + self.traverse_specs(process_chunk_spec, wanted_chunk_spec) def unpetrify_all(self): '''If a spec is petrified, unpetrify it. @@ -286,4 +286,4 @@ class MorphologySet(object): spec['ref'] = spec.pop('unpetrify-ref') return True - self._traverse_specs(process_spec, wanted_spec) + self.traverse_specs(process_spec, wanted_spec) |