Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7163796
D3085.id10997.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D3085.id10997.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 30, 3:44 PM (6 h, 50 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219410
Attached To
D3085: scanner: ndjson output format
Event Timeline
Log In to Comment