Determine if the groups need to be changed
559197
def _group_changes(cur, wanted, remove=False):
    '''
    
    '''
    old = set(cur)
    new = set(wanted)
    if (remove and old != new) or (not remove and not new.issubset(old)):
        return True
    return False
43162
private void updateStateAndNotify() {
        Boolean oldGroupValid = groupValid;
        groupValid = true;
        for (Boolean valid : fields.values()) {
            groupValid &= valid;
        }
        if (groupValid != oldGroupValid) {
            eventBus.fireEvent(new ValidationChangedEvent(groupValid));
        }
    }
779548
protected function resetSubGroups()
    {
        $reset = false;
        foreach ($this->parent->getGroups() as $group) {
            if ($reset) {
                $group->reset();
            }

            if ($group === $this) {
                $reset = true;
            }
        }
    }
32197
def on_bandwidth_group_change(self, bandwidth_group):
        
        if not isinstance(bandwidth_group, IBandwidthGroup):
            raise TypeError("bandwidth_group can only be an instance of type IBandwidthGroup")
        self._call("onBandwidthGroupChange",
                     in_p=[bandwidth_group])
258080
def change_channel_group(self, group):
        """"""
        assert self._probe is not None
        self._channels = _probe_channels(self._probe, group)
        self._positions = _probe_positions(self._probe, group)
293601
private void doGroupCheck() {
        if (!hasTabs()) return;

        for (String groupName : getGroupNames()) {
            String tabName = getGroupedAttribtes(groupName).get(0).getTabName();
            for (PropertyBinding propBinding : getGroupedAttribtes(groupName)) {
                if (!tabName.equals(propBinding.getTabName())) {
                    throw new RuntimeException("FormItem " + propBinding.getJavaName() + " must be on the same tab with all members of its subgroup.");
                }
            }
        }
    }
1026042
public function refreshGroupSettings()
    {
        $group = $this->currentUser->getGroup();
        if ($group instanceof Group) {
            $group->applyGroupToModel($this, false);
        }
    }
541745
public void setCurrentGroup(int groupId){
        if(mCurrentGroup != groupId){
            int oldGroupId = mCurrentGroup;
            mCurrentGroup = groupId;
            mGroupChanged = true;
            dispatchOnToolbarGroupChanged(oldGroupId, mCurrentGroup);
            animateOut();
        }
    }
279232
def create_or_update_groups(self):
        

        for name in self.group_names:
            try:
                Group.objects.get(name=name)
            except ObjectDoesNotExist:
                Group.objects.create(name=name)
        Group.objects.exclude(name__in=self.group_names).delete()

        if self.verbose:
            names = [obj.name for obj in Group.objects.all().order_by("name")]
            sys.stdout.write(f"  Groups are: {', '.join(names)}\n")
670653
private static void checkTransitionGroups(Map<Circuit, Collection<TileRef>> circuits,
                                              Circuit circuit,
                                              MapTile map,
                                              TileRef ref)
    {
        final MapTileGroup mapGroup = map.getFeature(MapTileGroup.class);
        final MapTileTransition mapTransition = map.getFeature(MapTileTransition.class);
        final String group = mapGroup.getGroup(ref);
        for (final String groupTransition : mapGroup.getGroups())
        {
            if (mapTransition.getTransitives(group, groupTransition).size() == 1)
            {
                final Circuit transitiveCircuit = new Circuit(circuit.getType(), group, groupTransition);
                getTiles(circuits, transitiveCircuit).add(ref);
            }
        }
    }
1295135
def update_resourcegroup(group,**kwargs):
    

    group_i                 = _get_group(group.id)
    group_i.name            = group.name
    group_i.description     = group.description
    group_i.status          = group.status

    db.DBSession.flush()

    return group_i
871792
function findGroupsByCheck(groups, compareFn) {
    var foundGroups = groups.filter(compareFn);
    groups.forEach(function(group) {
        var subFound = findGroupsByCheck(group.getGroups(), compareFn);
        if (subFound.length > 0) {
            foundGroups = foundGroups.concat(subFound);
        }
    });
    return foundGroups;
}
90991
function updateIssuesGroups() {
		// Get all groups.
		var groupHeaderElements = document.querySelectorAll('[data-groupName]');

		for (var i = 0; i < groupHeaderElements.length; i++) {
			var groupHeader = groupHeaderElements[i];
			var issuesGroupId = groupHeader.getAttribute('data-expandableElement');
			var groupName = groupHeader.getAttribute('data-groupName');
			var groupNumber = groupHeader.getAttribute('data-groupNumber');
			// Get all rules for the current group.
			var rules = document.querySelectorAll('#' + issuesGroupId + ' > tr');
			var numberOfUnfilteredIssues = 0;
			var numberOfUnfilteredRules = 0;

			// Hide the rule section if no issues. Otherwise update count.
			for (var k = 0; k < rules.length; k++) {
				var rule = rules[k];
				var unfilteredIssuesForRule = rule.querySelectorAll('tr.filterable:not(.filtered)');
				var numberOfUnfilteredIssuesForRule = unfilteredIssuesForRule.length;
				if (numberOfUnfilteredIssuesForRule === 0) {
					rule.classList.add('filtered');
				} else {
					numberOfUnfilteredRules++;
					numberOfUnfilteredIssues += numberOfUnfilteredIssuesForRule;
					rule.querySelector('span.rule-issue-number').innerText = '(' + numberOfUnfilteredIssuesForRule + ' issues)';
				}
			}

			// Hide the group section if no issues. Otherwise update count.
			if (numberOfUnfilteredRules === 0) {
				groupHeader.classList.add('filtered');
			} else {
				groupHeader.classList.remove('filtered');
				groupHeader.querySelector('span').innerText = ' ' + groupNumber + '. ' + groupName + ' (' + numberOfUnfilteredRules + ' rules, ' + numberOfUnfilteredIssues + ' issues)';
			}
		}
	}
535642
public function ChangeShippingGroup()
    {
        $oBasket = TShopBasket::GetInstance();
        $this->oActiveShippingGroup = $oBasket->GetActiveShippingGroup();
        // check if the group is still valid. if not, reload using default
        if (!$this->oActiveShippingGroup || false == $this->oActiveShippingGroup->IsAvailable()) {
            $oBasket->SetActiveShippingGroup(null);
            $oBasket->SetBasketRecalculationFlag(true);
            $this->oActiveShippingGroup = $oBasket->GetActiveShippingGroup();
        }
        $iShippingGroupId = null;
        if (array_key_exists('shop_shipping_group_id', $this->aRequestData)) { //shop_payment_methode_id?
            $iShippingGroupId = $this->aRequestData['shop_shipping_group_id'];
            /** @var $oShippingGroup TdbShopShippingGroup */
            $this->oActiveShippingGroup = TdbShopShippingGroup::GetNewInstance();
            if (!$this->oActiveShippingGroup->Load($iShippingGroupId)) {
                // if the requested group was not found, fetch default from basket again
                if (is_null($this->oActiveShippingGroup)) {
                    $this->oActiveShippingGroup = $oBasket->GetActiveShippingGroup();
                }
            } else {
                $oBasket->SetActiveShippingGroup($this->oActiveShippingGroup);
                $oBasket->SetBasketRecalculationFlag(true);
            }
        }
    }
943624
def user_in_any_group(user, groups):
    """"""
    return user_is_superuser(user) or any(user_in_group(user, group) for group in groups)
554188
def has_group_perms(self, perm, obj, approved):
        
        if not self.group:
            return False

        if self.use_smart_cache:
            content_type_pk = Permission.objects.get_content_type(obj).pk

            def _group_has_perms(cached_perms):
                # Check to see if the permission is in the cache.
                return cached_perms.get((
                    obj.pk,
                    content_type_pk,
                    perm,
                    approved,
                ))

            # Check to see if the permission is in the cache.
            return _group_has_perms(self._group_perm_cache)

        # Actually hit the DB, no smart cache used.
        return Permission.objects.group_permissions(
            self.group,
            perm, obj,
            approved,
        ).filter(
            object_id=obj.pk,
        ).exists()
1105553
def _members_changed(
        sender, instance, action, reverse, model, pk_set, **kwargs):
    
    if action == "post_add":
        if not reverse:
            group = instance
            for person in model.objects.filter(pk__in=pk_set):
                log.change(person, "Added person to group %s" % group)
                log.change(group, "Added person %s to group" % person)
                _add_person_to_group(person, group)
        else:
            person = instance
            for group in model.objects.filter(pk__in=pk_set):
                log.change(person, "Added person to group %s" % group)
                log.change(group, "Added person %s to group" % person)
                _add_person_to_group(person, group)

    elif action == "post_remove":
        if not reverse:
            group = instance
            for person in model.objects.filter(pk__in=pk_set):
                log.change(person, "Removed person from group %s" % group)
                log.change(group, "Removed person %s from group" % person)
                _remove_person_from_group(person, group)
        else:
            person = instance
            for group in model.objects.filter(pk__in=pk_set):
                log.change(person, "Removed person from group %s" % group)
                log.change(group, "Removed person %s from group" % person)
                _remove_person_from_group(person, group)

    elif action == "pre_clear":
        # This has to occur in pre_clear, not post_clear, as otherwise
        # we won't see what groups need to be removed.
        if not reverse:
            group = instance
            log.change(group, "Removed all people from group")
            for person in group.members.all():
                log.change(group, "Removed person %s from group" % person)
                _remove_person_from_group(person, group)
        else:
            person = instance
            log.change(person, "Removed person from all groups")
            for group in person.groups.all():
                log.change(group, "Removed person %s from group" % person)
                _remove_person_from_group(person, group)