Skip to content

Commit

Permalink
Upgrade higlass-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
manzt committed Nov 12, 2024
1 parent ebe660d commit 876562f
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dynamic = ["version"]
readme = "README.md"
dependencies = [
"servir>=0.0.5",
"higlass-schema>=0.0.6",
"higlass-schema>=0.2.0",
"anywidget>=0.9.0",
"jinja2",
"jupyter-server-proxy>=3.0",
Expand Down
2 changes: 1 addition & 1 deletion src/higlass/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def ensure_list(x: T | list[T] | None) -> list[T]:

def copy_unique(model: ModelT) -> ModelT:
"""Creates a deep copy of a pydantic BaseModel with new UID."""
copy = model.__class__(**model.dict())
copy = model.__class__(**model.model_dump())
if hasattr(copy, "uid"):
setattr(copy, "uid", uid())
return copy
10 changes: 5 additions & 5 deletions src/higlass/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ def mapper(view):
raise ValueError("concat method must be 'vertical' or 'horizontal'.")

# gather views and adjust layout
views = [v.copy(deep=True) for v in b.views]
views = [v.model_copy(deep=True) for v in b.views]
offset = 0 if a.views is None else max(map(mapper, a.views))
for view in views:
curr = getattr(view.layout, field)
Expand All @@ -616,7 +616,7 @@ def mapper(view):
locks = getattr(b, lockattr)
if locks:
if getattr(a, lockattr) is None:
setattr(a, lockattr, locks.copy(deep=True))
setattr(a, lockattr, locks.model_copy(deep=True))
else:
getattr(a, lockattr).locksByViewUid.update(locks.locksByViewUid)
getattr(a, lockattr).locksDict.update(locks.locksDict)
Expand Down Expand Up @@ -806,16 +806,16 @@ def combine(t1: Track, t2: Track, uid: str | None = None, **kwargs) -> CombinedT
uid = utils.uid()

if isinstance(t1, CombinedTrack):
copy = CombinedTrack(**t1.dict())
copy.contents.append(t2.__class__(**t2.dict()))
copy = CombinedTrack(**t1.model_dump())
copy.contents.append(t2.__class__(**t2.model_dump()))
for key, val in kwargs.items():
setattr(copy, key, val)
return copy

return CombinedTrack(
type="combined",
uid=uid,
contents=[track.__class__(**track.dict()) for track in (t1, t2)],
contents=[track.__class__(**track.model_dump()) for track in (t1, t2)],
**kwargs,
)

Expand Down
50 changes: 42 additions & 8 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 876562f

Please sign in to comment.