From 512120bb6e393948fa1229f601ee77c007cc7e4e Mon Sep 17 00:00:00 2001 From: jessekrubin Date: Thu, 2 Nov 2023 07:11:14 -0700 Subject: [PATCH] cli fix --- python/utiles/cli.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/python/utiles/cli.py b/python/utiles/cli.py index ee7a19d1..f444c73a 100644 --- a/python/utiles/cli.py +++ b/python/utiles/cli.py @@ -297,9 +297,19 @@ def feature_gen() -> Iterable[Dict[str, Any]]: else: def feature_gen() -> Iterable[Dict[str, Any]]: - yield json.loads(first_line) + def _cleanline(line: str): + # strip newlines + line = line.strip() + # strip spaces + line = line.strip() + if line.startswith('"'): + line = line.strip('"') + return line + yield json.loads(_cleanline(first_line)) for line in src: - yield json.loads(line) + yield json.loads( + _cleanline(line) + ) for obj in feature_gen(): if isinstance(obj, list):