( cls, args: dict[str, Any], backwards_compatible_repo: list[Repository] = [], )
| 325 | |
| 326 | @classmethod |
| 327 | def parse_args( |
| 328 | cls, |
| 329 | args: dict[str, Any], |
| 330 | backwards_compatible_repo: list[Repository] = [], |
| 331 | ) -> Self: |
| 332 | config = cls() |
| 333 | |
| 334 | mirror_regions = args.get('mirror_regions', []) |
| 335 | if mirror_regions: |
| 336 | for region, urls in mirror_regions.items(): |
| 337 | config.mirror_regions.append(MirrorRegion(region, urls)) |
| 338 | |
| 339 | if args.get('custom_servers'): |
| 340 | config.custom_servers = CustomServer.parse_args(args['custom_servers']) |
| 341 | |
| 342 | # backwards compatibility with the new custom_repository |
| 343 | if 'custom_mirrors' in args: |
| 344 | config.custom_repositories = CustomRepository.parse_args(args['custom_mirrors']) |
| 345 | if 'custom_repositories' in args: |
| 346 | config.custom_repositories = CustomRepository.parse_args(args['custom_repositories']) |
| 347 | |
| 348 | if 'optional_repositories' in args: |
| 349 | config.optional_repositories = [Repository(r) for r in args['optional_repositories']] |
| 350 | |
| 351 | if backwards_compatible_repo: |
| 352 | for r in backwards_compatible_repo: |
| 353 | if r not in config.optional_repositories: |
| 354 | config.optional_repositories.append(r) |
| 355 | |
| 356 | return config |
nothing calls this directly
no test coverage detected