File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 22import os
33import traceback
44from datetime import datetime
5+ from pathlib import Path
56from typing import List , LiteralString , Optional , Tuple
67
78import pandas as pd
@@ -155,9 +156,11 @@ def get_disjoint_groups(disjoint_files):
155156 disjoint_files = os .path .join ("data" , "chebi-disjoints.owl" )
156157 disjoint_pairs , disjoint_groups = [], []
157158 for file in disjoint_files :
158- if file .split ("." )[- 1 ] == "csv" :
159+ if isinstance (file , Path ):
160+ file = str (file )
161+ if file .endswith (".csv" ):
159162 disjoint_pairs += pd .read_csv (file , header = None ).values .tolist ()
160- elif file .split ("." )[ - 1 ] == " owl" :
163+ elif file .endswith (".owl" ) :
161164 with open (file , "r" ) as f :
162165 plaintext = f .read ()
163166 segments = plaintext .split ("<" )
You can’t perform that action at this time.
0 commit comments