diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2014-03-01 15:26:01 +0000 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2014-03-01 15:26:41 +0000 |
commit | c3295231b072e12656426bb7d5eb04672b2cc3ab (patch) | |
tree | 55817744b1a5803e95a9f7a868f828ca5f2f0b05 | |
parent | 57f8d56361b5a2442da31f8f82bb7f8d351b3e0b (diff) | |
download | python-fastimport-git-c3295231b072e12656426bb7d5eb04672b2cc3ab.tar.gz |
Remove unused helpers.
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | fastimport/helpers.py | 43 |
2 files changed, 4 insertions, 43 deletions
@@ -1,5 +1,9 @@ 0.9.3 UNRELEASED + * Remove unused and untested helper single_plural, + invert_dict, invert_dictset and defines_to_dict. + (Jelmer Vernooij) + 0.9.2 2012-04-03 * Remove reftracker and idmapfile, which are bzr-specific. diff --git a/fastimport/helpers.py b/fastimport/helpers.py index 52c5b88..b30a779 100644 --- a/fastimport/helpers.py +++ b/fastimport/helpers.py @@ -16,49 +16,6 @@ """Miscellaneous useful stuff.""" -def single_plural(n, single, plural): - """Return a single or plural form of a noun based on number.""" - if n == 1: - return single - else: - return plural - - -def defines_to_dict(defines): - """Convert a list of definition strings to a dictionary.""" - if defines is None: - return None - result = {} - for define in defines: - kv = define.split('=', 1) - if len(kv) == 1: - result[define.strip()] = 1 - else: - result[kv[0].strip()] = kv[1].strip() - return result - - -def invert_dict(d): - """Invert a dictionary with keys matching each value turned into a list.""" - # Based on recipe from ASPN - result = {} - for k, v in d.iteritems(): - keys = result.setdefault(v, []) - keys.append(k) - return result - - -def invert_dictset(d): - """Invert a dictionary with keys matching a set of values, turned into lists.""" - # Based on recipe from ASPN - result = {} - for k, c in d.iteritems(): - for v in c: - keys = result.setdefault(v, []) - keys.append(k) - return result - - def _common_path_and_rest(l1, l2, common=[]): # From http://code.activestate.com/recipes/208993/ if len(l1) < 1: return (common, l1, l2) |