Checks if there's an EntityType in the target location with the same label. If so, keeps adding
a postfix until the label is unique.
772098
private EntityType assignUniqueLabel(EntityType entityType, CopyState state) {
    Set<String> existingLabels;
    Package targetPackage = state.targetPackage();
    if (targetPackage != null) {
      existingLabels =
          stream(targetPackage.getEntityTypes()).map(EntityType::getLabel).collect(toSet());
    } else {
      existingLabels =
          dataService
              .query(ENTITY_TYPE_META_DATA, EntityType.class)
              .eq(EntityTypeMetadata.PACKAGE, null)
              .findAll()
              .map(EntityType::getLabel)
              .collect(toSet());
    }
    entityType.setLabel(LabelGenerator.generateUniqueLabel(entityType.getLabel(), existingLabels));
    return entityType;
  }
816046
private boolean equalsSimpleTypeNames(MethodIdentifier identifier, MethodResult methodResult) {
        MethodIdentifier originalIdentifier = methodResult.getOriginalMethodSignature();

        return originalIdentifier.getMethodName().equals(identifier.getMethodName()) &&
                matchesTypeBestEffort(originalIdentifier.getReturnType(), identifier.getReturnType()) &&
                parameterMatch(originalIdentifier.getParameters(), identifier.getParameters());
    }
387698
private static void checkNonDebugLabel(final Label label) {
        Field f = getLabelStatusField();
        int status = 0;
        try {
            status = f == null ? 0 : ((Integer) f.get(label)).intValue();
        } catch (IllegalAccessException e) {
            throw new Error("Internal error");
        }
        if ((status & 0x01) != 0) {
            throw new IllegalArgumentException(
                    "Labels used for debug info cannot be reused for control flow");
        }
    }
510219
function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) {
            // TODO (drosen): De-duplicate code between related functions.
            if (source === target) {
                return -1 /* True */;
            }
            if (!(isMatchingSignature(source, target, partialMatch))) {
                return 0 /* False */;
            }
            // Check that the two signatures have the same number of type parameters. We might consider
            // also checking that any type parameter constraints match, but that would require instantiating
            // the constraints with a common set of type arguments to get relatable entities in places where
            // type parameters occur in the constraints. The complexity of doing that doesn't seem worthwhile,
            // particularly as we're comparing erased versions of the signatures below.
            if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) {
                return 0 /* False */;
            }
            // Spec 1.0 Section 3.8.3 & 3.8.4:
            // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N
            source = getErasedSignature(source);
            target = getErasedSignature(target);
            var result = -1 /* True */;
            if (!ignoreThisTypes) {
                var sourceThisType = getThisTypeOfSignature(source);
                if (sourceThisType) {
                    var targetThisType = getThisTypeOfSignature(target);
                    if (targetThisType) {
                        var related = compareTypes(sourceThisType, targetThisType);
                        if (!related) {
                            return 0 /* False */;
                        }
                        result &= related;
                    }
                }
            }
            var targetLen = target.parameters.length;
            for (var i = 0; i < targetLen; i++) {
                var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]);
                var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfParameter(target.parameters[i]);
                var related = compareTypes(s, t);
                if (!related) {
                    return 0 /* False */;
                }
                result &= related;
            }
            if (!ignoreReturnTypes) {
                result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
            }
            return result;
        }
244854
def update_check(self, entity, check, label=None, name=None, disabled=None,
            metadata=None, monitoring_zones_poll=None, timeout=None,
            period=None, target_alias=None, target_hostname=None,
            target_receiver=None):
        
        entity.update_check(check, label=label, name=name, disabled=disabled,
                metadata=metadata, monitoring_zones_poll=monitoring_zones_poll,
                timeout=timeout, period=period, target_alias=target_alias,
                target_hostname=target_hostname,
                target_receiver=target_receiver)
135406
public static void validateAttachmentLabel(String label)
      throws MonomerException {

    if (label.equalsIgnoreCase(Attachment.PAIR_ATTACHMENT)) {
      return;
    }
    char[] chars = label.toCharArray();

    if (!(String.valueOf(chars[0])).equals("R")) {
      throw new MonomerException("Invalid Attachment Label format");
    }
    for (int i = 1; i < chars.length; i++) {
      char c = chars[i];
      if (!(String.valueOf(c)).matches("[0-9]")) {
        throw new MonomerException("Invalid Attachment Label format");
      }
    }
  }
475418
private void checkUniqueLocation(final Part part) {
		isUnique = isUnique == null ? true : isUnique;
		isUnique = (uniqueLocation == null || uniqueLocation.equals(ignorePropertyCase(part))) ? isUnique : false;
		if (!geoFields.isEmpty()) {
			Assert.isTrue(isUnique, "Different location fields are used - Distance is ambiguous");
		}
		uniqueLocation = ignorePropertyCase(part);
	}
529137
public RuntimeTypeAdapterFactory<T> registerSubtype(Class<? extends T> type, String label) {
    if (type == null || label == null) {
      throw new NullPointerException();
    }
    if (subtypeToLabel.containsKey(type) || labelToSubtype.containsKey(label)) {
      throw new IllegalArgumentException("types and labels must be unique");
    }
    labelToSubtype.put(label, type);
    subtypeToLabel.put(type, label);
    return this;
  }
382306
public static void bindLabel (final Value<String> value, final HasText target)
    {
        value.addListenerAndTrigger(new Value.Listener<String>() {
            public void valueChanged (String value) {
                // avoid updating the target if the value is already the same; in the case where
                // the target is a TextBox, setting the text will move the cursor to the end of the
                // text, which is annoying if a value is being updated on every character edit
                if (!target.getText().equals(value)) {
                    target.setText(value);
                }
            }
        });
    }
595981
def _has_example(self, label):
        """"""
        if label in self._raw_examples:
            return True
        else:
            for field in self.all_fields:
                dt, _ = unwrap_nullable(field.data_type)
                if not is_user_defined_type(dt) and not is_void_type(dt):
                    continue
                if label == field.name:
                    return True
            else:
                return False
963300
private boolean validateExistingTopicTags(final ITopicNode topicNode, final BaseTopicWrapper<?> topic) {
        // Ignore validating revision topics
        if (topicNode.getRevision() != null) {
            return true;
        }

        boolean valid = true;
        final List<String> tagNames = topicNode.getTags(true);
        if (!tagNames.isEmpty()) {
            final Set<TagWrapper> tags = new HashSet<TagWrapper>();
            for (final String tagName : tagNames) {
                // Check if the app should be shutdown
                if (isShuttingDown.get()) {
                    shutdown.set(true);
                    return false;
                }
                // Get the tag from the database
                TagWrapper tag = null;
                try {
                    tag = tagProvider.getTagByName(tagName);
                } catch (NotFoundException e) {

                }

                // Check that it exists
                if (tag != null) {
                    tags.add(tag);
                }
            }

            // Add all the existing tags
            if (topic.getTags() != null) {
                tags.addAll(topic.getTags().getItems());
            }

            // Check that the mutex value entered is correct
            final Map<Integer, List<TagWrapper>> mapping = EntityUtilities.getCategoryMappingFromTagList(tags);
            for (final Entry<Integer, List<TagWrapper>> catEntry : mapping.entrySet()) {
                final CategoryWrapper cat = categoryProvider.getCategory(catEntry.getKey());
                final List<TagWrapper> catTags = catEntry.getValue();

                // Check if the app should be shutdown
                if (isShuttingDown.get()) {
                    shutdown.set(true);
                    return false;
                }

                // Check that only one tag has been set if the category is mutually exclusive
                if (cat.isMutuallyExclusive() && catTags.size() > 1) {
                    log.error(String.format(ProcessorConstants.ERROR_TOPIC_TOO_MANY_CATS_MSG, topicNode.getLineNumber(), cat.getName(),
                            topicNode.getText()));
                    valid = false;
                }
            }
        }
        return valid;
    }
759069
function(hasCustomMarkup, labelAttrs, defaultLabelAttrs, builtinDefaultLabelAttrs) {

        if (labelAttrs === null) return null;
        if (labelAttrs === undefined) {

            if (defaultLabelAttrs === null) return null;
            if (defaultLabelAttrs === undefined) {

                if (hasCustomMarkup) return undefined;
                return builtinDefaultLabelAttrs;
            }

            if (hasCustomMarkup) return defaultLabelAttrs;
            return joint.util.merge({}, builtinDefaultLabelAttrs, defaultLabelAttrs);
        }

        if (hasCustomMarkup) return joint.util.merge({}, defaultLabelAttrs, labelAttrs);
        return joint.util.merge({}, builtinDefaultLabelAttrs, defaultLabelAttrs, labelAttrs);
    }
784155
def special_target_typecheck(value):
    
    result = True
    # if key:Optional exists, it must be a dict object
    result &= isinstance(value.get(TARGET_OPTIONAL_FIELD, dict()), dict)
    return result
809620
boolean hasIncomingEdgesWithLabel(AtlasVertex vertex, String label) throws AtlasBaseException {
        boolean foundEdges = false;
        Iterator<AtlasEdge> inEdges = vertex.getEdges(AtlasEdgeDirection.IN).iterator();

        while (inEdges.hasNext()) {
            AtlasEdge edge = inEdges.next();

            if (label.equals(edge.getLabel())) {
                foundEdges = true;
                break;
            }
        }
        return foundEdges;
    }
386856
static boolean containsDisallowedLeLabelForHistogram(List<String> labelNames, Type type) {
    if (!Type.HISTOGRAM.equals(type)) {
      return false;
    }
    for (String label : labelNames) {
      if (LABEL_NAME_BUCKET_BOUND.equals(label)) {
        return true;
      }
    }
    return false;
  }
838516
public boolean checkInstanceOf(Context context, CharSequence targetClassName,
            CharSequence loaderPackage, CharSequence referenceClassName) {
        if ((targetClassName == null) || (referenceClassName == null)) {
            return false;
        }

        // Try a shortcut for efficiency.
        if (TextUtils.equals(targetClassName, referenceClassName)) {
            return true;
        }

        final Class<?> referenceClass = loadOrGetCachedClass(
                context, referenceClassName, loaderPackage);
        if (referenceClass == null) {
            return false;
        }

        return checkInstanceOf(context, targetClassName, loaderPackage, referenceClass);
    }
1102817
def check_pending_labels(ast):
    
    result = True
    visited = set()
    pending = [ast]

    while pending:
        node = pending.pop()

        if node is None or node in visited:  # Avoid recursive infinite-loop
            continue

        visited.add(node)
        for x in node.children:
            pending.append(x)

        if node.token != 'VAR' or (node.token == 'VAR' and node.class_ is not CLASS.unknown):
            continue

        tmp = global_.SYMBOL_TABLE.get_entry(node.name)
        if tmp is None or tmp.class_ is CLASS.unknown:
            syntax_error(node.lineno, 'Undeclared identifier "%s"'
                         % node.name)
        else:
            assert tmp.class_ == CLASS.label
            node.to_label(node)

        result = result and tmp is not None

    return result