(self, specifiedpath)
| 449 | del extensions[malicious] |
| 450 | |
| 451 | def get_specified(self, specifiedpath): |
| 452 | if not os.path.exists(specifiedpath): |
| 453 | result = { |
| 454 | 'extensions': [] |
| 455 | } |
| 456 | with open(specifiedpath, 'w') as outfile: |
| 457 | json.dump(result, outfile, cls=vsc.MagicJsonEncoder, indent=4) |
| 458 | log.info( |
| 459 | f'Created empty list of custom extensions to mirror at {specifiedpath}') |
| 460 | return |
| 461 | else: |
| 462 | with open(specifiedpath, 'r') as fp: |
| 463 | specifiedextensions = json.load(fp) |
| 464 | if specifiedextensions and 'extensions' in specifiedextensions: |
| 465 | specified = [] |
| 466 | for packagename in specifiedextensions['extensions']: |
| 467 | extension = self.search_by_extension_name(packagename) |
| 468 | if extension: |
| 469 | log.info(f'Adding extension to mirror {packagename}') |
| 470 | specified.append(extension) |
| 471 | else: |
| 472 | log.debug( |
| 473 | f'get_custom failed finding a recommended extension by name for {packagename}. This extension has likely been removed.') |
| 474 | return specified |
| 475 | |
| 476 | def search_by_text(self, searchtext): |
| 477 | if searchtext == '*': |
no test coverage detected