Skip to content

Commit

Permalink
start of review
Browse files Browse the repository at this point in the history
  • Loading branch information
Magnus Lindholm committed Oct 17, 2023
1 parent ff52317 commit 27fd8b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 30 deletions.
2 changes: 0 additions & 2 deletions acacore/siegfried_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
"""Place for functions and classes that act as an entrance to siegfried"""
from . import identify
30 changes: 2 additions & 28 deletions acacore/siegfried_utils/identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
import subprocess
from logging import Logger
from pathlib import Path
from typing import Any
from typing import Optional
from typing import Tuple
from typing import Any, Optional, Tuple

from acacore.models.identification import Identification
from acacore.reference_files.ref_files import costum_sigs
from acacore.reference_files.ref_files import to_re_identify
from acacore.reference_files.ref_files import costum_sigs, to_re_identify


def aca_id_for_file_id(path: Path, file_id: Identification) -> Identification:
Expand Down Expand Up @@ -103,29 +100,6 @@ def get_aca_signature(bof: str, eof: str) -> Optional[dict]:
return None


def sf_id_puid(path: Path) -> Optional[str]:
"""Identify a file and return only its PUID using siegfried.
Args:
path (`Path`): Path to the file to identify.
Returns:
Optional[str]: The PUID of the file, or `None` if none is found
"""
id_result = run_sf_and_get_results_json(path)

puid: Optional[str] = None
for file_result in id_result.get("files", []):
match: dict = {}
for id_match in file_result.get("matches"):
if id_match.get("ns") == "pronom":
match = id_match
if match:
puid = None if match.get("id", "").lower() == "unknown" else match.get("id")
break
return puid


def sf_id_full(path: Path, log: Optional[Logger] = None) -> dict[Path, Identification]:
"""Identify multiple files using `siegfried`, and return a dictionary mapping the files path to a Identification datastructure containing the info obtained.
Expand Down

0 comments on commit 27fd8b7

Please sign in to comment.