Clear empty field groups
353525
private function clearEmptyGroups()
    {
        foreach (Craft::$app->fields->getAllGroups() as $group) {
            if (count($group->getFields()) == 0) {
                Craft::$app->fields->deleteGroup($group);
            }
        }
    }
594487
private static Field[] removeMetaFields(Field[] fields) {
		Field[] realFields = new Field[fields.length - 1];
		//We'll delete at least one, sometimes more than one field (because there's at least the r$type field).
		int i = 0;
		for (Field field : fields) {
			if (!field.getName().startsWith(Constants.PREFIX)) {
				realFields[i++] = field;
			}
		}
		if (i < realFields.length) {
			realFields = Utils.arrayCopyOf(realFields, i);
		}
		if (GlobalConfiguration.assertsMode) {
			Utils.assertTrue(i == realFields.length, "Bug in removeMetaFields, created array of wrong length");
		}
		return realFields;
	}
784513
private void removeEmptyGroups() {
        // We have to do this because RosterGroup.removeEntry removes the entry immediately
        // (locally) and the group could remain empty.
        // TODO Check the performance/logic for rosters with large number of groups
        for (RosterGroup group : getGroups()) {
            if (group.getEntryCount() == 0) {
                groups.remove(group.getName());
            }
        }
    }
483801
def _strip_empty_keys(self, params):
        
        keys = [k for k, v in params.items() if v == '']
        for key in keys:
            del params[key]
1074946
def empty(Bucket, MFA=None, RequestPayer=None, region=None, key=None,
          keyid=None, profile=None):
    '''
    

    '''

    stuff = list_object_versions(Bucket, region=region, key=key, keyid=keyid,
                                 profile=profile)
    Delete = {}
    Delete['Objects'] = [{'Key': v['Key'], 'VersionId': v['VersionId']} for v in stuff.get('Versions', [])]
    Delete['Objects'] += [{'Key': v['Key'], 'VersionId': v['VersionId']} for v in stuff.get('DeleteMarkers', [])]
    if Delete['Objects']:
        ret = delete_objects(Bucket, Delete, MFA=MFA, RequestPayer=RequestPayer,
                             region=region, key=key, keyid=keyid, profile=profile)
        failed = ret.get('failed', [])
        if failed:
            return {'deleted': False, 'failed': ret[failed]}
    return {'deleted': True}
924140
public final void clear(int field)
    {
        if (areFieldsVirtuallySet) {
            computeFields();
        }
        fields[field] = 0;
        stamp[field] = UNSET;
        isTimeSet = areFieldsSet = areAllFieldsSet = areFieldsVirtuallySet = false;
    }
910327
def cleaniddfield(acomm):
    """"""
    for key in list(acomm.keys()):
        val = acomm[key]
        acomm[key.lower()] = val
    for key in list(acomm.keys()):
        val = acomm[key]
        if key != key.lower():
            acomm.pop(key)
    return acomm
1092689
def _SkipGroup(buffer, pos, end):
  """"""

  while 1:
    (tag_bytes, pos) = ReadTag(buffer, pos)
    new_pos = SkipField(buffer, pos, end, tag_bytes)
    if new_pos == -1:
      return pos
    pos = new_pos
541483
def full_clean(self, *args, **kwargs):
        
        super().full_clean(*args, **kwargs)
        for field in self.errors:
            if field != NON_FIELD_ERRORS:
                self.apply_widget_invalid_options(field)
1086420
public function clearModified()
    {
        if (isset($this->data['fields'])) {
            $this->clearFieldsModified();
        }

        if (isset($this->data['embeddedsOne'])) {
            $this->clearEmbeddedsOneChanged();
            foreach ($this->data['embeddedsOne'] as $name => $embedded) {
                if ($embedded) {
                    $embedded->clearModified();
                }
            }
        }

        if (isset($this->data['embeddedsMany'])) {
            foreach ($this->data['embeddedsMany'] as $name => $group) {
                $group->clearAdd();
                $group->clearRemove();
                $group->clearSaved();
            }
        }
    }
1071231
def __get_item_sh_fields_empty(self, rol, undefined=False):
        
        # If empty_field is None, the fields do not appear in index patterns
        empty_field = '' if not undefined else '-- UNDEFINED --'
        return {
            rol + "_id": empty_field,
            rol + "_uuid": empty_field,
            rol + "_name": empty_field,
            rol + "_user_name": empty_field,
            rol + "_domain": empty_field,
            rol + "_gender": empty_field,
            rol + "_gender_acc": None,
            rol + "_org_name": empty_field,
            rol + "_bot": False
        }
434181
function clearField (index, properties) {
  // Aliased fields reflect values on other fields and do not need to be cleared.
  if (properties.isAlias === true) {
    return
  }

  // If the property value is already not set, there's nothing to do.
  if (typeof this[properties.name] === 'undefined') {
    return
  }

  // In case of object & array, they must be initialized immediately.
  if (properties.type === 'object') {
    if (this[properties.name] !== null && this[properties.name].clear) {
      this[properties.name].clear()
      writeValue.call(this[_privateKey]._this, undefined, properties)
    } else {
      writeValue.call(this[_privateKey]._this, undefined, properties)
    }

    // Native arrays are never used so that toArray can be globally supported.
    // Additionally, other properties such as unique rely on passing through Document.
  } else if (properties.type === 'array') {
    this[properties.name].length = 0

    // Other field types can simply have their value set to undefined.
  } else {
    writeValue.call(this[_privateKey]._this, undefined, properties)
  }
}
578307
def rm_empty_fields(x):
    
    # No logger here because the function is recursive.
    # Int types don't matter. Return as-is.
    if not isinstance(x, int) and not isinstance(x, float):
        if isinstance(x, str) or x is None:
            try:
                # Remove new line characters and carriage returns
                x = x.rstrip()
            except AttributeError:
                # None types don't matter. Keep going.
                pass
            if x in EMPTY:
                # Substitute empty entries with ""
                x = ''
        elif isinstance(x, list):
            # Recurse once for each item in the list
            for i, v in enumerate(x):
                x[i] = rm_empty_fields(x[i])
            # After substitutions, remove empty entries.
            for i in x:
                # Many 0 values are important (coordinates, m/m/m/m). Don't remove them.
                if not i and i not in [0, 0.0]:
                    x.remove(i)
        elif isinstance(x, dict):
            # First, go through and substitute "" (empty string) entry for any values in EMPTY
            for k, v in x.items():
                x[k] = rm_empty_fields(v)
            # After substitutions, go through and delete the key-value pair.
            # This has to be done after we come back up from recursion because we cannot pass keys down.
            for key in list(x.keys()):
                if not x[key] and x[key] not in [0, 0.0]:
                    del x[key]
    return x
329006
def remove_field(self, field_name):
        """"""
        field = self._fields.pop(field_name, None)
        if field is not None and field.default is not None:
            if six.callable(field.default):
                self._default_callables.pop(field.key, None)
            else:
                self._defaults.pop(field.key, None)
1331585
protected void removeEmptyResourceFields() {

        Set<Component> componentsToRemove = new HashSet<Component>();
        int count = 0;
        Component lastElement = null;

        for (Component c : m_resources) {
            if (c instanceof CmsRemovableFormRow<?>) {
                count++;
                AbstractField<?> field = (AbstractField<?>)((CmsRemovableFormRow)c).getInput();
                String value = (String)(field.getValue());
                if (value.isEmpty()) {
                    componentsToRemove.add(c);
                    lastElement = c;
                }
            }
        }

        //if all fields are empty -> keep one of them to attach validator to
        if (componentsToRemove.size() == count) {
            componentsToRemove.remove(lastElement);
        }

        if (count == 0) {
            addResource("");
        }

        for (Component c : componentsToRemove) {
            m_resources.removeComponent(c);
            m_componentsToValidate.remove(c);
        }
    }
2387
def _trim_fields(self, docs):
        '''
        
        '''
        for doc in docs:
            for field in self._ignore_fields:
                if field in doc:
                    del(doc[field])
        return docs
448729
public void clearListField(String fieldName) {
		Object val = getFieldValue(fieldName, true); // internal
		if (val instanceof List<?>)
			((List<?>)val).clear();
		else if (val != null && val.getClass().isArray()) {
			DOField fld = getDomainObjectType().getFieldByName(fieldName);
			String ctn = fld.getComponentTypeName();
			Class<?> clazz;
			try {
				clazz = getDomainObjectType().getDomainModel().getClassForName(ctn);
				tryInitListOrArray(null, fld, clazz);
			} catch (ClassNotFoundException e) {
				throw new RuntimeException(e);
			}
		} else {
			if (!getDomainObjectType().getFieldByName(fieldName).isListOrArray())
				throw new RuntimeException("field: [" + fieldName + "] is neither list nor array");
			if (val == null)
				throw new RuntimeException("list or array field: [" + fieldName + "] is null");
		}
	}