Skip to content
Snippets Groups Projects
Verified Commit 2b7fd173 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

STY: auto formatting

parent 7c5617d3
No related branches found
No related tags found
1 merge request!8Code coverage
Pipeline #59615 failed
......@@ -87,6 +87,6 @@ def trigger_crawler(target_dir: str) -> tuple[bool, list[db.Entity]]:
cfood_file_name=ruqad_crawler_settings.joinpath('cfood.yaml'),
identifiables_definition_file=ruqad_crawler_settings.joinpath(
'identifiables.yaml'),
remove_prefix="/"+os.path.basename(target_dir))
remove_prefix="/" + os.path.basename(target_dir))
return (True, ent_qc)
......@@ -44,11 +44,12 @@ def _generate_pages(manager) -> dict:
+ str(response['code']))
n_pages = response["_pagination"]["total_pages"]
for ii in range(n_pages):
query_params.update({"page": ii+1})
query_params.update({"page": ii + 1})
yield manager.search.search_resources("record", **query_params).json()
def collect_records_created_after(manager: KadiManager, cut_off_date: datetime.datetime) -> list(int):
def collect_records_created_after(manager: KadiManager,
cut_off_date: datetime.datetime) -> list(int):
"""
Iterates page-wise over the responses of the Kadi API until records are reached that are older
than the given cut_off_date.
......@@ -89,6 +90,7 @@ def download_eln_for(manager: KadiManager, rid: int, path: str) -> None:
rec = manager.record(id=rid)
rec.export(path=path, export_type='ro-crate')
class KadiManager(_KadiManager):
"""Fix KadiManager to respect context root in url."""
......@@ -96,6 +98,7 @@ class KadiManager(_KadiManager):
super().__init__(**kwargs)
self.host = f'{kwargs["host"]}/api/v1'
def main():
with KadiManager(instance='demo') as manager:
cut_off_date = datetime.fromisoformat(
......
......@@ -42,6 +42,7 @@ KADIARGS = {
SKIP_QUALITY_CHECK = os.getenv("SKIP_QUALITY_CHECK") is not None
def monitor():
"""Continuously monitor the Kadi instance given in the environment variables.
......@@ -82,7 +83,7 @@ def monitor():
if os.path.exists(os.path.join(cdir, "artifacts.zip")):
shutil.move(os.path.join(cdir, "artifacts.zip"),
os.path.join(remote_dir_path, "report.zip"))
#else:
# else:
# Path(os.path.join(remote_dir_path, "report.zip")).touch()
shutil.move(os.path.join(cdir, "export.eln"),
os.path.join(remote_dir_path, "export.eln"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment