diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-04-17 14:06:10 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-04-17 15:53:21 +0300 |
commit | f236aef565c1f9c99dcf24979830b232ab6749bc (patch) | |
tree | 0d1053ad8ef0b6f7de9a74485b641b81dd85c0c4 /abook-to-clab | |
parent | e325fc5e47e5ef34969a30fc6568a58a6026f39b (diff) | |
download | clab-f236aef565c1f9c99dcf24979830b232ab6749bc.tar.gz |
rewrite in rust
Diffstat (limited to 'abook-to-clab')
-rwxr-xr-x | abook-to-clab | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/abook-to-clab b/abook-to-clab deleted file mode 100755 index f182972..0000000 --- a/abook-to-clab +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/python - - -import ConfigParser -import os -import yaml -import sys - - -records = {} - -for filename in sys.argv[1:]: - cp = ConfigParser.ConfigParser() - cp.read([filename]) - for section in cp.sections(): - if section == 'format': - continue - obj = {} - for option in cp.options(section): - assert option not in obj - v = cp.get(section, option, raw=True) - if ',' in v: - vs = v.split(',') - obj[option] = dict((str(i), x) for i, x in enumerate(vs)) - else: - obj[option] = v - - assert type(obj['name']) is str - uid = ''.join(obj['name'].split()).lower() - if uid in records: - r = records[uid] - for key in obj: - if key in r: - v = r[key] - if type(v) is dict: - v[str(len(v) + 1)] = obj[key] - else: - r[key] = { '0': v, '1': obj[key] } - else: - r[key] = obj[key] - else: - records[uid] = obj - -for uid, r in records.iteritems(): - with open(os.path.join('db', uid + '.yaml'), 'w') as f: - yaml.safe_dump(r, stream=f, default_flow_style=False) - |