#!/usr/bin/env python
# -*- coding: utf-8 -*-

import cPickle as pickle
import bz2
import json
import argparse

def transform_json_to_pkl(args):
    with open(args.json_input, 'r') as json_file:
        json_str = json_file.read()
        metadata = json.loads(json_str)

        for marker in metadata["markers"]:
            metadata["markers"][marker]["ext"] = set(metadata["markers"][marker]["ext"])

    pkl_output = bz2.BZ2File(args.pkl_output, 'w')
    pickle.dump(metadata, pkl_output, pickle.HIGHEST_PROTOCOL)
    pkl_output.close()

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--json_input', required=True)
    parser.add_argument('--pkl_output', required=True)
    
    args = parser.parse_args()

    transform_json_to_pkl(args)

@@ -105,16 +105,17 @@
 gparse%0A%0A
+%0A
 def tran
@@ -313,32 +313,44 @@
 %22%5D:%0A            
+a_set = set(
 metadata%5B%22marker
@@ -367,23 +367,30 @@
 %5D%5B%22ext%22%5D
- = set(
+)%0A            
 metadata
@@ -415,17 +415,24 @@
 %5D%5B%22ext%22%5D
-)
+ = a_set
 %0A%0A    pk
@@ -680,24 +680,24 @@
 uired=True)%0A
+
     parser.a
@@ -743,13 +743,8 @@
 ue)%0A
-    %0A
     

Fix flake8 for tools/metaphlan2/transform_json_to_pkl.py