Skip to content

Commit

Permalink
Replace __or__ method with merge()
Browse files Browse the repository at this point in the history
While __or__ is fancy, using "merge" is more self-explanatory, and it
makes introspection easier.
  • Loading branch information
maresb committed Dec 10, 2023
1 parent 051b7ae commit 41ae11f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion conda_lock/conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def make_lock_files( # noqa: C901
deep=True,
update={"package": packages_not_to_lock},
)
new_lock_content = lock_content_to_persist | fresh_lock_content
new_lock_content = lock_content_to_persist.merge(fresh_lock_content)

if "lock" in kinds:
write_conda_lock_file(
Expand Down
5 changes: 1 addition & 4 deletions conda_lock/lockfile/v2prelim/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ class Lockfile(StrictModel):
package: List[LockedDependency]
metadata: LockMeta

def __or__(self, other: "Lockfile") -> "Lockfile":
return other.__ror__(self)

def __ror__(self, other: "Optional[Lockfile]") -> "Lockfile":
def merge(self, other: "Optional[Lockfile]") -> "Lockfile":
"""
merge self into other
"""
Expand Down

0 comments on commit 41ae11f

Please sign in to comment.