MCPcopy Create free account
hub / github.com/codemeta/codemeta / read_terms

Function read_terms

scripts/aggregate.py:36–52  ·  view source on GitHub ↗

Reads the crosswalk of one of the mappings, checks its integrity, and returns its list of terms, in the same order as the ones in properties_description.csv.

(prop_desc, filename)

Source from the content-addressed store, hash-verified

34 return list(zip(*cols))
35
36def read_terms(prop_desc, filename):
37 """Reads the crosswalk of one of the mappings, checks its integrity,
38 and returns its list of terms, in the same order as the ones
39 in properties_description.csv."""
40
41 # Read rows from a translation table in crosswalks.
42 with open(os.path.join(SOURCE_DIR, filename)) as fd:
43 rows = list(csv.reader(fd))
44
45 # Split the two rows of the translation table.
46 (codemeta_names, crosswalk_names) = columns_from_rows(rows)
47
48 # Check the names match, in order to avoid messing the aggregate
49 # table if there was a mistake in this table.
50 check_property_names_match(filename, prop_desc[1], codemeta_names)
51
52 return crosswalk_names
53
54def list_crosswalks():
55 """Returns the list of crosswalk files by auto-discovering them from the

Callers 1

aggregateFunction · 0.85

Calls 2

columns_from_rowsFunction · 0.85

Tested by

no test coverage detected