Skip to content

Commit 29341d1

Browse files
committed
- Updated the copyright date and version number
- Potential fix for #235 which support same name mapping
1 parent fb1fb65 commit 29341d1

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

about_code_tool/genabout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ def main(parser, options, args):
800800
if mapping_config:
801801
mappings = get_mappings(location=None)
802802
input_data = apply_mappings(input_data, mappings)
803-
user_keys = mappings.values()
803+
user_keys = mappings.keys()
804804

805805
gen.validate(input_data)
806806

about_code_tool/help.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919

2020
__about_spec_version__ = '1.0'
2121

22-
__version__ = '2.2.0'
22+
__version__ = '2.2.1'
2323

2424
__copyright__ = """
25-
Copyright (c) 2013-2015 nexB Inc. All rights reserved.
25+
Copyright (c) 2013-2016 nexB Inc. All rights reserved.
2626
2727
Licensed under the Apache License, Version 2.0 (the "License");
2828
you may not use this file except in compliance with the License.

about_code_tool/util.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ def get_mappings(location=None):
197197
key, sep, value = line.partition(':')
198198
about_key = key.strip().replace(' ', '_')
199199
user_key = value.strip()
200-
mappings[user_key] = about_key
200+
#mappings[user_key] = about_key
201+
mappings[about_key] = user_key
201202

202203
except Exception as e:
203204
print(repr(e))
@@ -218,10 +219,15 @@ def apply_mappings(abouts, mappings=None):
218219
mapped_abouts = []
219220
for about in abouts:
220221
mapped_about = {}
221-
for key, value in about.items():
222-
# we default to the key if the key is not in the mappings
223-
mapped = mappings.get(key, key)
224-
mapped_about[mapped] = value
222+
for key in about:
223+
mapped = []
224+
for mapping_keys, input_keys in mappings.items():
225+
if key == input_keys:
226+
mapped.append(mapping_keys)
227+
if not mapped:
228+
mapped.append(key)
229+
for mapped_key in mapped:
230+
mapped_about[mapped_key] = about[key]
225231
mapped_abouts.append(mapped_about)
226232
return mapped_abouts
227233

0 commit comments

Comments
 (0)