MCPcopy
hub / github.com/docker/docker-py / prepare_model

Method prepare_model

docker/models/resource.py:81–92  ·  view source on GitHub ↗

Create a model from a set of attributes.

(self, attrs)

Source from the content-addressed store, hash-verified

79 raise NotImplementedError
80
81 def prepare_model(self, attrs):
82 """
83 Create a model from a set of attributes.
84 """
85 if isinstance(attrs, Model):
86 attrs.client = self.client
87 attrs.collection = self
88 return attrs
89 elif isinstance(attrs, dict):
90 return self.model(attrs=attrs, client=self.client, collection=self)
91 else:
92 raise Exception(f"Can't create {self.model.__name__} from {attrs}")

Callers 15

getMethod · 0.80
listMethod · 0.80
getMethod · 0.80
listMethod · 0.80
createMethod · 0.80
getMethod · 0.80
listMethod · 0.80
getMethod · 0.80
createMethod · 0.80
getMethod · 0.80
listMethod · 0.80
getMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected