Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hpc-compendium
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ZIH
hpcsupport
hpc-compendium
Commits
734edb75
Commit
734edb75
authored
2 years ago
by
Martin Schroschk
Browse files
Options
Downloads
Patches
Plain Diff
Remove script using pandas and numpy
parent
afb0e9a4
No related branches found
No related tags found
2 merge requests
!811
Automated merge from preview to main
,
!799
Created a new check-TOC.py without importing pd, and yaml
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc.zih.tu-dresden.de/util/check-TOC-equals-page-headings.py
+0
-44
0 additions, 44 deletions
doc.zih.tu-dresden.de/util/check-TOC-equals-page-headings.py
with
0 additions
and
44 deletions
doc.zih.tu-dresden.de/util/check-TOC-equals-page-headings.py
deleted
100644 → 0
+
0
−
44
View file @
afb0e9a4
"""
#!/usr/bin/env python
Check for consistency between TOC and page headings.
Provide as an command line argument the path to the mkdocs.yml file.
Author: Taras Lazariv
"""
import
os
import
sys
import
yaml
import
pandas
as
pd
def
list_and_read_files
(
path
):
"
List files in a directory recursively and read the first line of each file
"
files
=
[]
firstline
=
[]
for
root
,
_
,
filenames
in
os
.
walk
(
path
):
for
filename
in
filenames
:
if
filename
.
endswith
(
'
.md
'
):
files
.
append
(
os
.
path
.
join
(
root
.
split
(
'
/
'
)[
-
1
],
filename
))
firstline
.
append
(
open
(
os
.
path
.
join
(
root
,
filename
)).
readline
().
strip
().
replace
(
'
#
'
,
''
))
df
=
pd
.
DataFrame
({
'
file
'
:
files
,
'
firstline
'
:
firstline
})
return
df
def
main
():
"
Main function
"
path
=
os
.
getcwd
()
df
=
list_and_read_files
(
path
)
nav_section
=
dict
()
with
open
(
sys
.
argv
[
1
],
'
r
'
)
as
file
:
for
line
in
file
:
line
=
line
.
rstrip
()
if
line
.
endswith
(
'
.md
'
):
nav_section
.
update
(
yaml
.
safe_load
(
line
)[
0
])
nav_df
=
pd
.
DataFrame
(
nav_section
.
items
(),
columns
=
[
'
title
'
,
'
file
'
])
with
pd
.
option_context
(
'
display.max_rows
'
,
None
):
# more options can be specified also
complete_nav_df
=
pd
.
merge
(
df
,
nav_df
,
on
=
'
file
'
,
how
=
'
outer
'
)
print
(
complete_nav_df
.
loc
[
~
(
complete_nav_df
[
'
firstline
'
]
==
complete_nav_df
[
'
title
'
])])
if
__name__
==
'
__main__
'
:
main
()
\ No newline at end of file
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