Skip to content

Commit

Permalink
Migrate more APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
manzt committed Nov 12, 2024
1 parent 998ac78 commit ed30bcc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/higlass/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,13 @@ def _repr_mimebundle_(self, include=None, exclude=None):
""" "Displays the view config in an IPython environment."""
renderer = display.renderers.get()
plugin_urls = [] if self.views is None else gather_plugin_urls(self.views)
return renderer(self.dict(), plugin_urls=plugin_urls)
return renderer(self.model_dump(), plugin_urls=plugin_urls)

def widget(self, **kwargs):
"""Create a Jupyter Widget display for this view config."""
from higlass._widget import HiGlassWidget

return HiGlassWidget(self.dict(), **kwargs)
return HiGlassWidget(self.model_dump(), **kwargs)

@classmethod
def from_url(cls, url: str, **kwargs):
Expand All @@ -416,7 +416,7 @@ def from_url(cls, url: str, **kwargs):
with urllib.urlopen(request) as response:
raw = response.read()

return cls.parse_raw(raw)
return cls.model_validate_json(raw)

def locks(
self,
Expand Down Expand Up @@ -745,16 +745,16 @@ def view(
if layout is None:
layout = hgs.Layout(x=x, y=y, w=width, h=height)
else:
layout = hgs.Layout(**layout.dict())
layout = hgs.Layout(**layout.model_dump())

if tracks is None:
data = defaultdict(list)
else:
data = defaultdict(list, tracks.dict())
data = defaultdict(list, tracks.model_dump())

for track in _tracks:
if isinstance(track, hgs.Tracks):
track = track.dict()
track = track.model_dump()
for position, track_list in track.items():
data[position].extend(track_list)
else:
Expand Down

0 comments on commit ed30bcc

Please sign in to comment.