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)
| 301 | |
| 302 | |
| 303 | def compare_modules(file_, imports): |
| 304 | """Compare modules in a file to imported modules in a project. |
| 305 | |
| 306 | Args: |
| 307 | file_ (str): File to parse for modules to be compared. |
| 308 | imports (tuple): Modules being imported in the project. |
| 309 | |
| 310 | Returns: |
| 311 | tuple: The modules not imported in the project, but do exist in the |
| 312 | specified file. |
| 313 | """ |
| 314 | modules = parse_requirements(file_) |
| 315 | |
| 316 | imports = [imports[i]["name"] for i in range(len(imports))] |
| 317 | modules = [modules[i]["name"] for i in range(len(modules))] |
| 318 | modules_not_imported = set(modules) - set(imports) |
| 319 | |
| 320 | return modules_not_imported |
| 321 | |
| 322 | |
| 323 | def diff(file_, imports): |
no test coverage detected