MCPcopy
hub / github.com/ray-project/ray / __getitem__

Method __getitem__

python/ray/dag/input_node.py:152–166  ·  view source on GitHub ↗
(self, key: Union[int, str])

Source from the content-addressed store, hash-verified

150 return self.input_attribute_nodes[key]
151
152 def __getitem__(self, key: Union[int, str]) -> Any:
153 assert isinstance(key, (str, int)), (
154 "Please only use int index or str as first-level key to "
155 "access fields of dag input."
156 )
157
158 input_type = None
159 if self.input_type is not None and key in self.input_type:
160 input_type = type_to_string(self.input_type[key])
161
162 if key not in self.input_attribute_nodes:
163 self.input_attribute_nodes[key] = InputAttributeNode(
164 self, key, "__getitem__", input_type
165 )
166 return self.input_attribute_nodes[key]
167
168 def __enter__(self):
169 self.set_context(IN_CONTEXT_MANAGER, True)

Callers 1

getMethod · 0.45

Calls 2

type_to_stringFunction · 0.90
InputAttributeNodeClass · 0.85

Tested by

no test coverage detected