Fix kgtk compact --columns to match the documentation.
@@ -251,6 +251,8 @@ class KgtkCompact(KgtkFormat):
# Build the list of key column edges:
key_idx_list: typing.List[int] = [ ]
+
+ if len(self.key_column_names) == 0:
if kr.is_edge_file:
# Add the KGTK edge file required columns.
key_idx_list.append(kr.node1_column_idx)
@@ -262,9 +264,11 @@ class KgtkCompact(KgtkFormat):
elif kr.is_node_file:
# Add the KGTK node file required column:
key_idx_list.append(kr.id_column_idx)
- elif len(self.key_column_names) == 0:
+
+ else:
raise ValueError("The input file is neither an edge nor a node file. Key columns must be supplied.")
+ else:
# Append additional columns to the list of key column indices,
# silently removing duplicates, but complaining about unknown names.
#
