tomoscan.tests.datasets.GitlabProject#
- class tomoscan.tests.datasets.GitlabProject(host, project_id, cache_dir, token=None, branch_name='main')#
Bases:
objectsimple manager to download a file or a folder from a gitlab project. If the project is not public then a token must be provided.
All downloaded files will be stored in __cache__ folder. If the file is already in the __cache__ then it will be picked drectly from there.
- __init__(host, project_id, cache_dir, token=None, branch_name='main')#
Methods
__init__(host, project_id, cache_dir[, ...])clear_cache()download_file(file_path, output)if the download / REST API fails the backup is to do a git clone of the project with the requested branch under nxtomomill/test/utils/__archive__
download_folder(folder, output[, overwrite])- type overwrite:
bool
get_dataset(name)download dataset.
return file extension using LFS
is_file(file_path)parse_lfs_extensions(attributes)parse content of .gitattributes to retrieve files using lfs extension
Attributes
branch_name- rtype:
str
cache_dir- rtype:
str
host- rtype:
str
projectproject_id- rtype:
int
token- download_file(file_path, output)#
if the download / REST API fails the backup is to do a git clone of the project with the requested branch under nxtomomill/test/utils/__archive__
- download_folder(folder, output, overwrite=True)#
- Parameters:
overwrite (
bool) – if the file already exists overwrite it if the download / REST API fails the backup is to do a git clone of the project with the requested branch under nxtomomill/test/utils/__archive__
- get_dataset(name)#
download dataset. Name is the path to the dataset. for now user must notify if the dataset is a folder or not I guess we can get this information from gitlab and the REST API but to be done latter as an improvement
- Return type:
str | None
- get_lfs_extensions()#
return file extension using LFS
- Return type:
tuple
- static parse_lfs_extensions(attributes)#
parse content of .gitattributes to retrieve files using lfs extension