def __init__( self, config: dict = {}, downloader: Downloader = Downloader.instance(), ) -> None: self.config = config self.downloader = downloader self.data = {} if 'source' in config: # If this has an external source attached to it, let's try to # install it resource_template = ResourceTemplate.from_json( config, downloader=downloader) # Avoid building context if we can since it may result in downloading # unnecessary external data resource = resource_template.render(**self.default_context) if resource.target_path.exists(): self.resource = resource else: self.resource = resource_template.render(**self.context) self.install() else: self.resource = None self.load()
def __init__( self, urls: List[str], match: str, ttl: int = 86400, downloader: Downloader = Downloader.instance(), ): self.urls = urls self.match = match self.ttl = ttl self.downloader = downloader self.download_dir = Path( f'{tempfile.gettempdir()}/discovery/{self.name}') self._loaded = False
def __init__( self, base_url: str, metadata_url: str, paths: Dict[str, str], ttl: int = 86400, downloader: Downloader = Downloader.instance(), ): self.base_url = base_url self.metadata_url = metadata_url.format(base=base_url) self.paths = paths self.ttl = ttl self.downloader = downloader self.download_dir = Path( f'{tempfile.gettempdir()}/discovery/{self.name}') self._mappings = None
def __init__(self, config: dict = {}, downloader: Downloader = Downloader.instance(), ) -> None: self.config = config self.downloader = downloader if 'source' in config: # If this has an external source attached to it, let's try to # install it self.resource_template = ResourceTemplate.from_json( config, downloader=downloader, ) self.install() else: self.resource_template = None self.load()
def __init__( self, source_url_template: str, target_path_template: Optional[str], download_path_template: Optional[str] = None, downloader: Downloader = Downloader.instance(), install_action: BaseAction = Copy(), discovery: Optional[BaseDiscovery] = None, file_identifier: str = 'crc', default_context: dict = {}, ): self.source_url_template = source_url_template self.target_path_template = target_path_template self.download_path_template = download_path_template self.downloader = downloader self.install_action = install_action self.discovery = discovery self.file_identifier = file_identifier self.default_context = default_context