mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-17 01:01:03 +02:00
Tidy up msgpack dumper
This commit is contained in:
parent
7711b4bfed
commit
f3d090cd52
2 changed files with 29 additions and 3 deletions
|
|
@ -2,8 +2,33 @@
|
||||||
|
|
||||||
import msgpack
|
import msgpack
|
||||||
import sys
|
import sys
|
||||||
|
import argparse
|
||||||
|
|
||||||
unpacker = msgpack.Unpacker(sys.stdin.buffer, raw=False)
|
def run(input_file):
|
||||||
for unpacked in unpacker:
|
|
||||||
print(unpacked)
|
with open(input_file, 'rb') as f:
|
||||||
|
|
||||||
|
unpacker = msgpack.Unpacker(f, raw=False)
|
||||||
|
|
||||||
|
for unpacked in unpacker:
|
||||||
|
print(unpacked)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
prog='tg-load-pdf',
|
||||||
|
description=__doc__,
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-i', '--input-file',
|
||||||
|
required=True,
|
||||||
|
help=f'Input file'
|
||||||
|
)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
run(**vars(args))
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ setuptools.setup(
|
||||||
"pulsar-client",
|
"pulsar-client",
|
||||||
"rdflib",
|
"rdflib",
|
||||||
"tabulate",
|
"tabulate",
|
||||||
|
"msgpack",
|
||||||
],
|
],
|
||||||
scripts=[
|
scripts=[
|
||||||
"scripts/tg-graph-show",
|
"scripts/tg-graph-show",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue