Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
analytics
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nomad-lab
analytics
Commits
00fcda88
Commit
00fcda88
authored
Apr 20, 2020
by
Adam Fekete
Browse files
Options
Downloads
Patches
Plain Diff
python script to generate metainfos
parent
28bf5837
Branches
Branches containing commit
No related tags found
1 merge request
!18
Metainfos
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci/generate_tutorials_json.py
+32
-0
32 additions, 0 deletions
.gitlab-ci/generate_tutorials_json.py
with
32 additions
and
0 deletions
.gitlab-ci/generate_tutorials_json.py
0 → 100644
+
32
−
0
View file @
00fcda88
import
json
import
sys
from
pathlib
import
Path
cwd
=
Path
(
__file__
).
parent
def
iter_folders
(
path
):
for
file
in
path
.
glob
(
'
**/metainfo.json
'
):
with
open
(
file
)
as
f
:
yield
json
.
load
(
f
)
def
save_into_file
(
data
:
dict
):
if
len
(
sys
.
argv
)
!=
2
:
print
(
"
Please define an json file as output!
"
)
exit
(
1
)
output
=
sys
.
argv
[
1
]
with
open
(
output
,
'
w
'
)
as
f
:
json
.
dump
(
data
,
f
,
indent
=
2
)
if
__name__
==
'
__main__
'
:
# Defining the relative path of the tutorials
path
=
cwd
/
'
../tutorials/
'
list_of_tutorials
=
{
'
tutorials
'
:
list
(
iter_folders
(
path
))}
print
(
json
.
dumps
(
list_of_tutorials
,
indent
=
2
))
save_into_file
(
list_of_tutorials
)
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
sign in
to comment