Skip to content

Commit

Permalink
Revert "add optional eid field to join to record"
Browse files Browse the repository at this point in the history
This reverts commit a418fd6.
  • Loading branch information
k1o0 committed Oct 25, 2024
1 parent a418fd6 commit e7e20e3
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions one/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def path2url(self, filepath):
return
return unwrap(self.record2url)(record)

def record2url(self, record, eid=None):
def record2url(self, record):
"""Convert a session or dataset record to a remote URL.
NB: Requires online instance
Expand All @@ -299,9 +299,6 @@ def record2url(self, record, eid=None):
record : pd.Series, pd.DataFrame
A datasets or sessions cache record. If DataFrame, iterate over and returns list.
eid: str
Optional: Session UUID. If the record comes from a cache table, the session field
needs joining and omitting this argument will result in an error
Returns
-------
str, list
Expand All @@ -311,7 +308,7 @@ def record2url(self, record, eid=None):
assert webclient, 'No Web client found for instance'
# FIXME Should be OneAlyx converter only
if isinstance(record, pd.DataFrame):
return [self.record2url(r, eid=eid) for _, r in record.iterrows()]
return [self.record2url(r) for _, r in record.iterrows()]
elif isinstance(record, pd.Series):
is_session_record = 'rel_path' not in record
if is_session_record:
Expand All @@ -322,11 +319,7 @@ def record2url(self, record, eid=None):
else:
raise TypeError(
f'record must be pandas.DataFrame or pandas.Series, got {type(record)} instead')
if not (isinstance(record.name, tuple) and len(record.name) == 2):
if eid is None:
raise ValueError(
f"Record \n {record} \n Can't be converted to URL without the eid argument")
record.name = (eid, record.name)
assert isinstance(record.name, tuple) and len(record.name) == 2
eid, uuid = record.name # must be (eid, did)
session_path = self.eid2path(eid)
url = PurePosixPath(get_alf_path(session_path), record['rel_path'])
Expand Down

0 comments on commit e7e20e3

Please sign in to comment.