You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
outdir = os.path.abspath(sys.argv[2] if len(sys.argv) > 2 else '.')
factor = int(sys.argv[3]) if len(sys.argv) > 3 else 2
print('Reading ids from file:', infile)
data = json.load(open(infile))
ids = list(data.keys())
nids = len(ids)
nlayers = math.ceil(math.log(nids, factor))
print(f'Processing {len(ids)} ids, across {nlayers} layers with {factor} ids per layer...')
tags = [{'values': [item for sublist in [ids[sliceidx : sliceidx + factor ** layeridx] for sliceidx in range(0, nids, factor ** (layeridx + 1))] for item in sublist]} for layeridx in range(0, nlayers)]
print(f'Writing {len(tags)} tags to directory:', outdir)