MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / get

Method get

deeplabcut/pose_estimation_pytorch/registry.py:167–198  ·  view source on GitHub ↗

Get the registry record. Args: key: The class name in string format. Returns: class: The corresponding class. Example: >>> from deeplabcut.pose_estimation_pytorch.registry import Registry >>> registry = Registry("models")

(self, key)

Source from the content-addressed store, hash-verified

165 return self._children
166
167 def get(self, key):
168 """Get the registry record.
169
170 Args:
171 key: The class name in string format.
172
173 Returns:
174 class: The corresponding class.
175
176 Example:
177 >>> from deeplabcut.pose_estimation_pytorch.registry import Registry
178 >>> registry = Registry("models")
179 >>> class Model:
180 >>> pass
181 >>> registry.register_module(Model, "Model")
182 >>> assert registry.get("Model") == Model
183 """
184 scope, real_key = self.split_scope_key(key)
185 if scope is None or scope == self._scope:
186 # get from self
187 if real_key in self._module_dict:
188 return self._module_dict[real_key]
189 else:
190 # get from self._children
191 if scope in self._children:
192 return self._children[scope].get(real_key)
193 else:
194 # goto root
195 parent = self.parent
196 while parent.parent is not None:
197 parent = parent.parent
198 return parent.get(key)
199
200 def build(self, *args, **kwargs):
201 """Builds an instance from the registry.

Callers 15

__contains__Method · 0.95
dfsFunction · 0.45
unique_e501_filesFunction · 0.45
mainFunction · 0.45
_load_github_eventFunction · 0.45
determine_diff_rangeFunction · 0.45
validate_selected_pathsFunction · 0.45
decideFunction · 0.45
_render_file_lineFunction · 0.45
_lane_labelFunction · 0.45
create_job_summaryFunction · 0.45

Calls 1

split_scope_keyMethod · 0.95

Tested by 15

_load_github_eventFunction · 0.36
determine_diff_rangeFunction · 0.36
validate_selected_pathsFunction · 0.36
decideFunction · 0.36
_render_file_lineFunction · 0.36
_lane_labelFunction · 0.36
create_job_summaryFunction · 0.36
write_github_outputFunction · 0.36
test_reader_set_frameFunction · 0.36
test_headFunction · 0.36