mirror of https://github.com/docker/docker-py.git
Added __eq__ method to Checkpoint class
Signed-off-by: sdimovv <36302090+sdimovv@users.noreply.github.com>
This commit is contained in:
parent
91d4484684
commit
c7bf137e5d
|
|
@ -33,7 +33,11 @@ class Checkpoint(Model):
|
||||||
checkpoint=self.id,
|
checkpoint=self.id,
|
||||||
checkpoint_dir=self.collection.checkpoint_dir,
|
checkpoint_dir=self.collection.checkpoint_dir,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
if isinstance(other, Checkpoint):
|
||||||
|
return self.id == other.id
|
||||||
|
return self.id == other
|
||||||
|
|
||||||
class CheckpointCollection(Collection):
|
class CheckpointCollection(Collection):
|
||||||
"""(Experimental)."""
|
"""(Experimental)."""
|
||||||
|
|
@ -94,7 +98,7 @@ class CheckpointCollection(Collection):
|
||||||
checkpoints = self.list()
|
checkpoints = self.list()
|
||||||
|
|
||||||
for checkpoint in checkpoints:
|
for checkpoint in checkpoints:
|
||||||
if checkpoint.id == id:
|
if checkpoint == id:
|
||||||
return checkpoint
|
return checkpoint
|
||||||
|
|
||||||
raise CheckpointNotFound(
|
raise CheckpointNotFound(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue