def update_resource_specs(): # Pool() uses cpu count if no number of processors is specified # Pool() only implements the Context Manager protocol from Python3.3 onwards, # so it will fail Python2.7 style linting, as well as throw AttributeError try: # pylint: disable=not-context-manager with multiprocessing.Pool() as pool: pool.starmap(update_resource_spec, SPEC_REGIONS.items()) except AttributeError: # Do it the long, slow way for region, url in SPEC_REGIONS.items(): update_resource_spec(region, url)
def update_resource_specs(): # Pool() uses cpu count if no number of processors is specified # Pool() only implements the Context Manager protocol from Python3.3 onwards, # so it will fail Python2.7 style linting, as well as throw AttributeError schema_cache = get_schema_value_types() try: # pylint: disable=not-context-manager with multiprocessing.Pool() as pool: # Patch from registry schema pool_tuple = [(k, v, schema_cache) for k, v in SPEC_REGIONS.items()] pool.starmap(update_resource_spec, pool_tuple) except AttributeError: # Do it the long, slow way for region, url in SPEC_REGIONS.items(): update_resource_spec(region, url, schema_cache)
def update_resource_specs(): """ Update Resource Specs """ for region, url in SPEC_REGIONS.items(): filename = os.path.join(os.path.dirname(cfnlint.__file__), 'data/CloudSpecs/%s.json' % region) LOGGER.debug('Downloading template %s into %s', url, filename) spec = json.loads(get_url_content(url)) # Patch the files spec = patch_spec(spec, 'all') spec = patch_spec(spec, region) with open(filename, 'w') as f: json.dump(spec, f, indent=2, sort_keys=True, separators=(',', ': '))