From 19009f005a2a14b511c9042fcbe7dad466a0d2cb Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Fri, 24 Nov 2023 16:16:35 +0100 Subject: [PATCH] Replace __or__ method with merge() While __or__ is fancy, using "merge" is more self-explanatory, and it makes introspection easier. --- conda_lock/conda_lock.py | 2 +- conda_lock/lockfile/v2prelim/models.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/conda_lock/conda_lock.py b/conda_lock/conda_lock.py index 5ac4d5d73..631db834b 100644 --- a/conda_lock/conda_lock.py +++ b/conda_lock/conda_lock.py @@ -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( diff --git a/conda_lock/lockfile/v2prelim/models.py b/conda_lock/lockfile/v2prelim/models.py index 65c81cd33..6afcef9e8 100644 --- a/conda_lock/lockfile/v2prelim/models.py +++ b/conda_lock/lockfile/v2prelim/models.py @@ -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 """