repositories#
Implements custom data repositories and patches the pooch DOI resolver.
This module is based on source code from the pooch project!
Copyright (c) 2018 The Pooch Developers All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the copyright holders nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- class irdl.repositories.DSpaceRepository(doi, archive_url)#
Bases:
DataRepository- property api_response#
- download_url(file_name)#
Use the repository API to get the download URL for a file given the archive URL.
- classmethod initialize(doi, archive_url)#
Initialize the data repository if the given URL points to a corresponding repository.
Initializes a data repository object. This is done as part of a chain of responsibility. If the class cannot handle the given repository URL, it returns None. Otherwise a DSpaceRepository instance is returned.
- populate_registry(pooch)#
Populate the registry using the data repository’s API.
- Parameters:
- pooch
pooch.Pooch The pooch instance that the registry will be added to.
- pooch
- irdl.repositories.doi_to_repository(doi)#
Instantiate a data repository instance from a given DOI.
This function implements the chain of responsibility dispatch to the correct data repository class.
- Parameters:
- doi
str The DOI of the archive.
- doi
- Returns:
- data_repository
DataRepository The data repository object.
- data_repository