Returns a list of info_file paths Args: splits (list of strings): each item is a path to a .json file or a path to a .txt file containing a list of paths to .json's.
(splits)
| 268 | |
| 269 | |
| 270 | def parse_splits_list(splits): |
| 271 | """ Returns a list of info_file paths |
| 272 | Args: |
| 273 | splits (list of strings): each item is a path to a .json file |
| 274 | or a path to a .txt file containing a list of paths to .json's. |
| 275 | """ |
| 276 | |
| 277 | if isinstance(splits, str): |
| 278 | splits = splits.split() |
| 279 | info_files = [] |
| 280 | for split in splits: |
| 281 | ext = os.path.splitext(split)[1] |
| 282 | if ext=='.json': |
| 283 | info_files.append(split) |
| 284 | elif ext=='.txt': |
| 285 | info_files += [info_file.rstrip() for info_file in open(split, 'r')] |
| 286 | else: |
| 287 | raise NotImplementedError('%s not a valid info_file type'%split) |
| 288 | return info_files |
| 289 | |
| 290 |
no outgoing calls
no test coverage detected