From e7e20e32beaf2117e085499b4ef95914816e9877 Mon Sep 17 00:00:00 2001 From: Miles Wells Date: Fri, 25 Oct 2024 19:30:15 +0300 Subject: [PATCH] Revert "add optional eid field to join to record" This reverts commit a418fd6215f6503e829b9e5e2b04baf32f5f2a31. --- one/converters.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/one/converters.py b/one/converters.py index 4c0f292e..20b80ea7 100644 --- a/one/converters.py +++ b/one/converters.py @@ -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 @@ -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 @@ -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: @@ -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'])