FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codemeta/scripts/split.py at master · codemeta/codemeta · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
codemeta
/
codemeta
Public
Notifications
You must be signed in to change notification settings
Fork
100
Star
351
Code
Issues
106
Pull requests
12
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
codemeta
/
scripts
/
split.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
39 lines (30 loc) · 1.09 KB
Breadcrumbs
codemeta
/
scripts
/
split.py
Copy path
File metadata and controls
39 lines (30 loc) · 1.09 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import
csv
from
pathlib
import
Path
REPO_DIR
=
Path
(
__file__
).
parent
.
parent
PROP_DESC_PATH
=
REPO_DIR
/
"properties_description.csv"
"""The CSV file where the leftmost columns of the aggregate crosswalk table
are (parent type, property name, type, and description."""
SOURCE_DIR
=
REPO_DIR
/
"crosswalks"
"""The directories where all other .csv files are."""
CROSSWALK_PATH
=
REPO_DIR
/
"crosswalk.csv"
"""The path/name of the file where the aggregate crosswalk table is
written."""
with
open
(
CROSSWALK_PATH
)
as
fd
:
reader
=
csv
.
reader
(
fd
)
lines
=
list
(
reader
)
cols
=
list
(
zip
(
*
lines
))
props
=
cols
[
1
]
for
col
in
cols
[
4
:]:
col_name
=
col
[
0
]
filename
=
SOURCE_DIR
/
f"
{
col_name
}
.csv"
filename
.
unlink
(
missing_ok
=
True
)
with
open
(
filename
,
'a'
)
as
fd
:
writer
=
csv
.
writer
(
fd
)
for
(
prop
,
trans
)
in
zip
(
props
,
col
):
writer
.
writerow
((
prop
,
trans
))
PROP_DESC_PATH
.
unlink
(
missing_ok
=
True
)
with
open
(
PROP_DESC_PATH
,
'a'
)
as
fd
:
writer
=
csv
.
writer
(
fd
,
lineterminator
=
'
\n
'
)
prop_desc
=
zip
(
*
cols
[
0
:
4
])
for
row
in
prop_desc
:
writer
.
writerow
(
row
)
Back
|
FazBrowse Home
|
New Git URL