Compare modules in a file to imported modules in a project. Args: file_ (str): File to parse for modules to be compared. imports (tuple): Modules being imported in the project. Returns: tuple: The modules not imported in the project, but do exist in the
(file_, imports)
| 359 | |
| 360 | |
| 361 | def compare_modules(file_, imports): |
| 362 | """Compare modules in a file to imported modules in a project. |
| 363 | |
| 364 | Args: |
| 365 | file_ (str): File to parse for modules to be compared. |
| 366 | imports (tuple): Modules being imported in the project. |
| 367 | |
| 368 | Returns: |
| 369 | tuple: The modules not imported in the project, but do exist in the |
| 370 | specified file. |
| 371 | """ |
| 372 | modules = parse_requirements(file_) |
| 373 | |
| 374 | imports = [imports[i]["name"] for i in range(len(imports))] |
| 375 | modules = [modules[i]["name"] for i in range(len(modules))] |
| 376 | modules_not_imported = set(modules) - set(imports) |
| 377 | |
| 378 | return modules_not_imported |
| 379 | |
| 380 | |
| 381 | def diff(file_, imports): |
no test coverage detected