Page MenuHomeSoftware Heritage

D3085.id10997.diff
No OneTemporary

D3085.id10997.diff

diff --git a/mypy.ini b/mypy.ini
--- a/mypy.ini
+++ b/mypy.ini
@@ -11,5 +11,5 @@
[mypy-pytest.*]
ignore_missing_imports = True
-# [mypy-add_your_lib_here.*]
-# ignore_missing_imports = True
+[mypy-ndjson.*]
+ignore_missing_imports = True
diff --git a/requirements.txt b/requirements.txt
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,6 +4,7 @@
vcversioner
requests
aiohttp
+ndjson
plotly
pandas
numpy
diff --git a/swh/scanner/cli.py b/swh/scanner/cli.py
--- a/swh/scanner/cli.py
+++ b/swh/scanner/cli.py
@@ -76,7 +76,7 @@
@click.option(
"-f",
"--format",
- type=click.Choice(["text", "json", "sunburst"], case_sensitive=False),
+ type=click.Choice(["text", "json", "ndjson", "sunburst"], case_sensitive=False),
default="text",
help="select the output format",
)
diff --git a/swh/scanner/model.py b/swh/scanner/model.py
--- a/swh/scanner/model.py
+++ b/swh/scanner/model.py
@@ -10,9 +10,10 @@
from typing import Any, Dict, Tuple, Iterable
from enum import Enum
+import ndjson
+
from .plot import sunburst
from .exceptions import InvalidObjectType
-
from swh.model.identifiers import DIRECTORY, CONTENT
@@ -60,6 +61,9 @@
if format == "json":
print(json.dumps(self.toDict(), indent=4, sort_keys=True))
+ if format == "ndjson":
+ print(ndjson.dumps(dict_path for dict_path in self.iterate()))
+
elif format == "text":
isatty = sys.stdout.isatty()

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 30, 3:44 PM (1 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219410

Event Timeline