diff options
author | Maksim Andrianov <maksimandrianov1@gmail.com> | 2018-11-14 15:39:05 +0300 |
---|---|---|
committer | Roman Kuznetsov <r.kuznetsow@gmail.com> | 2018-11-15 15:50:43 +0300 |
commit | 8f3cf7b1cfcdb6ed457d494437d8a19fc4abc59d (patch) | |
tree | d0fccf62a27fc441913f38aa200948f877f552e3 /tools | |
parent | cf328f8a68f68c9399a0ee644ea6b0e8944f62b9 (diff) |
Review fixes.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/python/hierarchy_to_countries.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/python/hierarchy_to_countries.py b/tools/python/hierarchy_to_countries.py index 96ab4c8005..b16a9918b2 100755 --- a/tools/python/hierarchy_to_countries.py +++ b/tools/python/hierarchy_to_countries.py @@ -25,7 +25,7 @@ import base64 class CountryDict(dict): def __init__(self, *args, **kwargs): dict.__init__(self, *args, **kwargs) - self.order = ['id', 'n', 'f', 'v', 'c', 's', 'h', 'rs', 'g'] + self.order = ['id', 'n', 'f', 'v', 'c', 's', 'sha1_base64', 'rs', 'g'] def __iter__(self): for key in self.order: @@ -47,7 +47,7 @@ def get_hash(path, name): with open(filename, 'rb') as f: for chunk in iter(lambda: f.read(4096), b""): h.update(chunk) - return base64.b64encode(h.hexdigest()) + return base64.b64encode(h.digest()) def get_size(path, name): if path == '0': @@ -158,7 +158,7 @@ with open(options.hierarchy, 'r') as f: else: name = last['f' if 'f' in last else nameattr] last['s'] = get_size(mwmpath, name) - last['h'] = get_hash(mwmpath, name) + last['sha1_base64'] = get_hash(mwmpath, name) if options.legacy: last['rs'] = 0 if last['s'] >= 0: @@ -186,7 +186,7 @@ with open(options.hierarchy, 'r') as f: del last['d'] name = last['f' if 'f' in last else nameattr] last['s'] = get_size(mwmpath, name) -last['h'] = get_hash(mwmpath, name) +last['sha1_base64'] = get_hash(mwmpath, name) if options.legacy: last['rs'] = 0 if last['s'] >= 0: |