Check to see if the label is allowed.
963294
def _check_label(self, label):
        """"""

        if not isinstance(label, str):
            label = str(label)

        if label.lower() in _forbidden_labels:
            raise ValueError("'{}' is forbidden to be used as a label"
                             .format(label))
        if not re.match("^[a-z,A-Z,0-9,_]*$", label):
            raise ValueError("label '{}' is forbidden - only alphabetic, numeric, and '_' characters are allowed in labels".format(label))
        if len(self.filter(twig=label, check_visible=False)):
            raise ValueError("label '{}' is already in use".format(label))
        if label[0] in ['_']:
            raise ValueError("first character of label is a forbidden character")
287092
def permitted?(requested_flags = 0)
      current_user_roles.any?{|ug| ug.admin?} ||
      current_model_permissions.any?{|cp| cp.permitted?(requested_flags)}
    end
918170
private boolean checkHostPart(final String label, final Problems problems, final String compName) {
		boolean result = true;
		if (label.length() > 63) {
			problems.add(ValidationBundle.getMessage(HostNameValidator.class, "LABEL_TOO_LONG", label)); // NOI18N
			result = false;
		}
		if (label.length() == 0) {
			problems.add(ValidationBundle.getMessage(HostNameValidator.class, "LABEL_EMPTY", compName, label)); // NOI18N
		}
		if (result) {
			try {
				Integer.parseInt(label);
				problems.add(ValidationBundle.getMessage(HostNameValidator.class, "NUMBER_PART_IN_HOSTNAME", label)); // NOI18N
				result = false;
			} catch (final NumberFormatException e) {
				// do nothing
			}
			if (result) {
				if (result) {
					result = new EncodableInCharsetValidator().validate(problems, compName, label);
					if (result) {
						for (final char c : label.toLowerCase().toCharArray()) {
							if (c >= 'a' && c <= 'z' || c >= '0' && c <= '9' || c == '-') { // NOI18N
								continue;
							}
							problems.add(ValidationBundle.getMessage(HostNameValidator.class, "BAD_CHAR_IN_HOSTNAME", new String(new char[] { c }))); // NOI18N
							result = false;
						}
					}
				}
			}
		}
		return result;
	}
73476
def _validate_constraints(constraints, label, add_error):
    
    if constraints is None:
        return
    msg = '{} has invalid constraints {}'.format(label, constraints)
    if not isstring(constraints):
        add_error(msg)
        return
    sep = ',' if ',' in constraints else None
    for constraint in constraints.split(sep):
        try:
            key, value = constraint.split('=')
        except (TypeError, ValueError):
            add_error(msg)
            return
        if key not in _CONSTRAINTS:
            add_error(msg)
1212164
def labels(self, labels):
        
        allowed_values = ["raw data", "documentation", "visualization", "clean data", "script", "report"]
        if not set(labels).issubset(set(allowed_values)):
            raise ValueError(
                "Invalid values for `labels` [{0}], must be a subset of [{1}]"
                .format(", ".join(map(str, set(labels)-set(allowed_values))),
                        ", ".join(map(str, allowed_values)))
            )

        self._labels = labels
1083862
def _checkAttribs(self, strict):
        """"""
        if self.choice:
            warning("Choice values not allowed for real-type parameter " +
                    self.name, strict)
            self.choice = None
1328647
def label(self, value):
        
        # Fixed width label formatting
        value = value[:self.pad_size] if self.pad_size else value
        try:
            padding = ' ' * (self.pad_size - len(value)) if self.pad_size else ''
        except TypeError:
            padding = ''

        self._formatted = ' {v}{p} '.format(v=value, p=padding)
155314
private void checkLabels(boolean forGenerative, String... label)
	{
		for (int i = 0; i < (forGenerative ? label.length - 1 : label.length); i++)
		{
			if (!hasLabel(label[i])) throw new IllegalArgumentException(
				"Label neither found, nor generated: " + label[i]);
		}
	}
1291124
public function hasLabel($label)
    {
        if (null !== $label) {
            $l = (string) $label;
            if ($this->labels->contains($l)) {
                return true;
            }
        }

        return false;
    }
821127
def _validate_annotations(annotations, label, add_error):
    
    if annotations is None:
        return
    if not isdict(annotations):
        add_error('{} has invalid annotations {}'.format(label, annotations))
        return
    # Check that all the annotations keys are strings.
    if not all(map(isstring, annotations)):
        add_error(
            '{} has invalid annotations: keys must be strings'.format(label))
55058
def check_label_pr(level = :fail)
      message = 'The PR should have at least one label added to it.'

      report(level, message) if github.pr_labels.nil? || github.pr_labels.empty?
    end
840606
def _is_allowed_command(self, command):
        """"""
        cmds = self._meta_data['allowed_commands']
        if command not in self._meta_data['allowed_commands']:
            error_message = "The command value {0} does not exist. " \
                            "Valid commands are {1}".format(command, cmds)
            raise InvalidCommand(error_message)
248316
def _as_label(self, index_or_label):
        """"""
        if isinstance(index_or_label, str):
            return index_or_label
        if isinstance(index_or_label, numbers.Integral):
            return self.labels[index_or_label]
        else:
            raise ValueError(str(index_or_label) + ' is not a label or index')
271194
public function hasLabel($label = null)
    {
        if (null !== $label) {
            foreach ($this->getLabels() as $k => $v) {
                if ($v == $label) {
                    return true;
                }
            }
        }

        if (null === $label && !empty($this->labels)) {
            return true;
        }

        return false;
    }
323170
def check_label_shape(self, label_shape):
        """"""
        if not len(label_shape) == 2:
            raise ValueError('label_shape should have length 2')
        if label_shape[0] < self.label_shape[0]:
            msg = 'Attempts to reduce label count from %d to %d, not allowed.' \
                % (self.label_shape[0], label_shape[0])
            raise ValueError(msg)
        if label_shape[1] != self.provide_label[0][1][2]:
            msg = 'label_shape object width inconsistent: %d vs %d.' \
                % (self.provide_label[0][1][2], label_shape[1])
            raise ValueError(msg)
770383
function validatePrintMax(candidate, lowerBound, label) {
  if (typeof candidate !== 'number' || Number.isNaN(candidate)) {
    throw new Error('"' + label + '" must be a number');
  } else if (candidate < lowerBound) {
    throw new Error('"' + label + '" too small');
  }
}
23957
def label(self):
        ""
        if self._label:
            return self._label
        else:
            if len(self):
                label = get_ndmapping_label(self, 'label')
                return '' if label is None else label
            else:
                return ''