MCPcopy Create free account
hub / github.com/apple/coremltools / _CheckAndCreateNewGroup

Method _CheckAndCreateNewGroup

deps/protobuf/python/mox.py:664–684  ·  view source on GitHub ↗

Checks if the last method (a possible group) is an instance of our group_class. Adds the current method to this group or creates a new one. Args: group_name: the name of the group. group_class: the class used to create instance of this new group

(self, group_name, group_class)

Source from the content-addressed store, hash-verified

662 return group
663
664 def _CheckAndCreateNewGroup(self, group_name, group_class):
665 """Checks if the last method (a possible group) is an instance of our
666 group_class. Adds the current method to this group or creates a new one.
667
668 Args:
669
670 group_name: the name of the group.
671 group_class: the class used to create instance of this new group
672 """
673 group = self.GetPossibleGroup()
674
675 # If this is a group, and it is the correct group, add the method.
676 if isinstance(group, group_class) and group.group_name() == group_name:
677 group.AddMethod(self)
678 return self
679
680 # Create a new group and add the method.
681 new_group = group_class(group_name)
682 new_group.AddMethod(self)
683 self._call_queue.append(new_group)
684 return self
685
686 def InAnyOrder(self, group_name="default"):
687 """Move this method into a group of unordered calls.

Callers 2

InAnyOrderMethod · 0.95
MultipleTimesMethod · 0.95

Calls 5

GetPossibleGroupMethod · 0.95
isinstanceFunction · 0.85
group_nameMethod · 0.80
AddMethodMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected