Source code

Download source archive ↓

src/galaxy_jq_max_by_key.py

1from contract import Adapter
2from jq_adapters import execute
3
4adapter = Adapter('max_by(.[$key])', ('source',), 'jsonl', {'key': {'type': 'string', 'default': 'rank', 'description': 'Object property name used as the key.', 'maxLength': 64}}, execute)
5
6def process(context):
7    adapter.process(context)
8
9def infer_outputs(inputs, params):
10    return adapter.infer_outputs(inputs, params)
11
12def preview_outputs(inputs, params, limits):
13    return adapter.preview_outputs(inputs, params, limits)
14
15if __name__ == "__main__":
16    adapter.main()