Skip to content

Commit b68aea0

Browse files
authored
Revise datajoint import name (#1116)
* Revise datajoint import name * Update changelog
1 parent 1480c24 commit b68aea0

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dj.FreeTable(dj.conn(), "common_session.session_group").drop()
2121
- Add docstrings to all public methods #1076
2222
- Update DataJoint to 0.14.2 #1081
2323
- Allow restriction based on parent keys in `Merge.fetch_nwb()` #1086
24+
- Import `datajoint.dependencies.unite_master_parts` -> `topo_sort` #1116
2425

2526
### Pipelines
2627

src/spyglass/utils/dj_graph.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
from datajoint import FreeTable, Table
1515
from datajoint.condition import make_condition
16-
from datajoint.dependencies import unite_master_parts
1716
from datajoint.hash import key_hash
1817
from datajoint.user_tables import TableMeta
1918
from datajoint.utils import get_master, to_camel_case
@@ -35,6 +34,11 @@
3534
unique_dicts,
3635
)
3736

37+
try: # Datajoint 0.14.2+ uses topo_sort instead of unite_master_parts
38+
from datajoint.dependencies import topo_sort as dj_topo_sort
39+
except ImportError:
40+
from datajoint.dependencies import unite_master_parts as dj_topo_sort
41+
3842

3943
class Direction(Enum):
4044
"""Cascade direction enum. Calling Up returns True. Inverting flips."""
@@ -474,7 +478,7 @@ def _topo_sort(
474478
if not self._is_out(node, warn=False)
475479
]
476480
graph = self.graph.subgraph(nodes) if subgraph else self.graph
477-
ordered = unite_master_parts(list(topological_sort(graph)))
481+
ordered = dj_topo_sort(list(topological_sort(graph)))
478482
if reverse:
479483
ordered.reverse()
480484
return [n for n in ordered if n in nodes]

tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ def frequent_imports():
394394
from spyglass.lfp.analysis.v1 import LFPBandSelection
395395
from spyglass.mua.v1.mua import MuaEventsV1
396396
from spyglass.ripple.v1.ripple import RippleTimesV1
397+
from spyglass.spikesorting.analysis.v1.unit_annotation import UnitAnnotation
397398
from spyglass.spikesorting.v0.figurl_views import SpikeSortingRecordingView
398399

399400
return (
@@ -403,6 +404,7 @@ def frequent_imports():
403404
RippleTimesV1,
404405
SortedSpikesIndicatorSelection,
405406
SpikeSortingRecordingView,
407+
UnitAnnotation,
406408
UnitMarksIndicatorSelection,
407409
)
408410

0 commit comments

Comments
 (0)