Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-scanner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jérémy Bobbio (Lunar)
swh-scanner
Commits
3f00bb00
Commit
3f00bb00
authored
4 years ago
by
Daniele Serafini
Browse files
Options
Downloads
Patches
Plain Diff
flat json output with known and swhid values
parent
bbf296f7
No related branches found
Branches containing commit
Tags
v0.1.1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/scanner/model.py
+1
-22
1 addition, 22 deletions
swh/scanner/model.py
with
1 addition
and
22 deletions
swh/scanner/model.py
+
1
−
22
View file @
3f00bb00
...
...
@@ -58,7 +58,7 @@ class Tree:
def
show
(
self
,
format
)
->
None
:
"""
Show tree in different formats
"""
if
format
==
"
json
"
:
print
(
json
.
dumps
(
self
.
getTree
(),
indent
=
4
,
sort_keys
=
True
))
print
(
json
.
dumps
(
self
.
toDict
(),
indent
=
4
,
sort_keys
=
True
))
elif
format
==
"
text
"
:
isatty
=
sys
.
stdout
.
isatty
()
...
...
@@ -157,27 +157,6 @@ class Tree:
if
child_node
.
otype
==
DIRECTORY
:
yield
from
child_node
.
iterate
()
def
getTree
(
self
):
"""
Walk through the tree to discover content or directory that have
a persistent identifier. If a persistent identifier is found it saves
the path with the relative PID.
Returns:
child_tree: the tree with the content/directory found
"""
child_tree
=
{}
for
path
,
child_node
in
self
.
children
.
items
():
rel_path
=
str
(
child_node
.
path
.
relative_to
(
self
.
path
))
if
child_node
.
swhid
:
child_tree
[
rel_path
]
=
child_node
.
swhid
else
:
next_tree
=
child_node
.
getTree
()
if
next_tree
:
child_tree
[
rel_path
]
=
next_tree
return
child_tree
def
__getSubDirsInfo
(
self
,
root
,
directories
):
"""
Fills the directories given in input with the contents information
stored inside the directory child, only if they have contents.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment