Compare commits
4 commits
38d00316e1
...
8993fbe4c1
| Author | SHA1 | Date | |
|---|---|---|---|
|
8993fbe4c1 |
|||
|
6c9b88a22f |
|||
|
7240d29b46 |
|||
|
28ea48ad66 |
5 changed files with 22 additions and 7 deletions
|
|
@ -22,4 +22,3 @@ from .meas_io import load_records as load_records
|
||||||
from .find import find_project as find_project
|
from .find import find_project as find_project
|
||||||
from .find import find_record as find_record
|
from .find import find_record as find_record
|
||||||
from .find import list_projects as list_projects
|
from .find import list_projects as list_projects
|
||||||
from .config import *
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ def create(path: str) -> None:
|
||||||
Create folder of backlogs.
|
Create folder of backlogs.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
dl.create(path)
|
create(path)
|
||||||
_create_db(os.path.join(path, 'backlogger.db'))
|
_create_db(os.path.join(path, 'backlogger.db'))
|
||||||
os.chmod(os.path.join(path, 'backlogger.db'), 0o666) # why does this not work?
|
os.chmod(os.path.join(path, 'backlogger.db'), 0o666) # why does this not work?
|
||||||
_create_config(path)
|
_create_config(path)
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,12 @@ the import of projects via TOML.
|
||||||
|
|
||||||
import tomllib as toml
|
import tomllib as toml
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
import datalad.api as dl
|
||||||
|
from .tracker import save
|
||||||
from .input import sfcf, openQCD
|
from .input import sfcf, openQCD
|
||||||
from .main import import_project, update_aliases
|
from .main import import_project, update_aliases
|
||||||
from .meas_io import write_measurement
|
from .meas_io import write_measurement
|
||||||
import datalad.api as dl
|
|
||||||
import os
|
import os
|
||||||
from .input.implementations import codes as known_codes
|
from .input.implementations import codes as known_codes
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
@ -150,7 +152,7 @@ def import_toml(path: str, file: str, copy_file: bool=True) -> None:
|
||||||
if copy_file:
|
if copy_file:
|
||||||
import_file = os.path.join(path, "toml_imports", uuid, file.split("/")[-1])
|
import_file = os.path.join(path, "toml_imports", uuid, file.split("/")[-1])
|
||||||
shutil.copy(file, import_file)
|
shutil.copy(file, import_file)
|
||||||
dl.save(import_file, message="Import using " + import_file, dataset=path)
|
save(path, files=[import_file], message="Import using " + import_file)
|
||||||
print("File copied to " + import_file)
|
print("File copied to " + import_file)
|
||||||
print("Imported project.")
|
print("Imported project.")
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from configparser import ConfigParser
|
||||||
from .trackers import datalad as dl
|
from .trackers import datalad as dl
|
||||||
|
|
||||||
|
|
||||||
def get_tracker(path):
|
def get_tracker(path: str) -> str:
|
||||||
config_path = os.path.join(path, '.corrlib')
|
config_path = os.path.join(path, '.corrlib')
|
||||||
config = ConfigParser()
|
config = ConfigParser()
|
||||||
if os.path.exists(config_path):
|
if os.path.exists(config_path):
|
||||||
|
|
@ -12,7 +12,7 @@ def get_tracker(path):
|
||||||
return tracker
|
return tracker
|
||||||
|
|
||||||
|
|
||||||
def get(path, file):
|
def get(path: str, file: str) -> None:
|
||||||
tracker = get_tracker(path)
|
tracker = get_tracker(path)
|
||||||
if tracker == 'datalad':
|
if tracker == 'datalad':
|
||||||
dl.get_file(path, file)
|
dl.get_file(path, file)
|
||||||
|
|
@ -21,9 +21,18 @@ def get(path, file):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def save(path, message, files):
|
def save(path: str, message: str, files: list[str]) -> None:
|
||||||
tracker = get_tracker(path)
|
tracker = get_tracker(path)
|
||||||
if tracker == 'datalad':
|
if tracker == 'datalad':
|
||||||
dl.save(files, message=message, dataset=path)
|
dl.save(files, message=message, dataset=path)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Tracker {tracker} is not supported.")
|
raise ValueError(f"Tracker {tracker} is not supported.")
|
||||||
|
|
||||||
|
|
||||||
|
def create(path: str) -> None:
|
||||||
|
tracker = get_tracker(path)
|
||||||
|
if tracker == 'datalad':
|
||||||
|
dl.create(path)
|
||||||
|
else:
|
||||||
|
raise ValueError(f"Tracker {tracker} is not supported.")
|
||||||
|
return
|
||||||
|
|
|
||||||
|
|
@ -18,3 +18,8 @@ def save(path, message, files= None):
|
||||||
files = [os.path.join(path, f) for f in files]
|
files = [os.path.join(path, f) for f in files]
|
||||||
dl.save(files, message=message, dataset=path)
|
dl.save(files, message=message, dataset=path)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def create(path):
|
||||||
|
dl.create(path)
|
||||||
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue