Skip to content

Commit

Permalink
Merge c251393 into 9ab6410
Browse files Browse the repository at this point in the history
  • Loading branch information
ross-spencer committed Jun 23, 2019
2 parents 9ab6410 + c251393 commit 8ed209b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion metsrw/fsentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def dir(cls, label, children):
def from_fptr(cls, label, type_, fptr):
"""Return ``FSEntry`` object."""
return FSEntry(
fileid=fptr.fileid,
label=label,
type=type_,
path=fptr.path,
Expand All @@ -197,7 +198,7 @@ def __str__(self):
return "{s.type}: {s.path}".format(s=self)

def __repr__(self):
return "FSEntry(type={s.type!r}, path={s.path!r}, use={s.use!r}, label={s.label!r}, file_uuid={s.file_uuid!r}, checksum={s.checksum!r}, checksumtype={s.checksumtype!r})".format(
return "FSEntry(type={s.type!r}, path={s.path!r}, fileid={s._fileid!r}, use={s.use!r}, label={s.label!r}, file_uuid={s.file_uuid!r}, checksum={s.checksum!r}, checksumtype={s.checksumtype!r})".format(
s=self
)

Expand Down
6 changes: 4 additions & 2 deletions metsrw/mets.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

AIP_ENTRY_TYPE = "archival information package"
FPtr = namedtuple(
"FPtr", "file_uuid derived_from use path amdids checksum checksumtype"
"FPtr", "file_uuid derived_from use path amdids checksum checksumtype fileid"
)


Expand Down Expand Up @@ -455,7 +455,9 @@ def _analyze_fptr(fptr_elem, tree, entry_type):
group_uuid = file_elem.get("GROUPID", "").replace(utils.GROUP_ID_PREFIX, "", 1)
if group_uuid != file_uuid:
derived_from = group_uuid # Use group_uuid as placeholder
return FPtr(file_uuid, derived_from, use, path, amdids, checksum, checksumtype)
return FPtr(
file_uuid, derived_from, use, path, amdids, checksum, checksumtype, file_id
)

@staticmethod
def _add_dmdsecs_to_fs_entry(elem, fs_entry, tree):
Expand Down
1 change: 1 addition & 0 deletions tests/test_mets.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ def test_analyze_fptr(self):
# Test the integrity of the ``FPtr`` object returned.
fptr = mw._analyze_fptr(fptr_elem, tree, "directory")
assert fptr == metsrw.mets.FPtr(
fileid="AM68.csv-fc0e52ca-a688-41c0-a10b-c1d36e21e804",
file_uuid="fc0e52ca-a688-41c0-a10b-c1d36e21e804",
derived_from=None,
use="original",
Expand Down

0 comments on commit 8ed209b

Please sign in to comment.