Create or update a label
501193
def label(self, name, color, update=True):
        
        url = '%s/labels' % self
        data = dict(name=name, color=color)
        response = self.http.post(
            url, json=data, auth=self.auth, headers=self.headers
        )
        if response.status_code == 201:
            return True
        elif response.status_code == 422 and update:
            url = '%s/%s' % (url, name)
            response = self.http.patch(
                url, json=data, auth=self.auth, headers=self.headers
            )
        response.raise_for_status()
        return False
822285
def _on_change(self):
        """"""
        font = self.__generate_font_tuple()
        self._example_label.configure(font=font)
544115
def set_label(label)
      if label.bytes.length > MAX_LABEL_LENGTH
        raise LabelTooLong.new("Label length in bytes must be below or equal to #{MAX_LABEL_LENGTH}")
      end
      while self.label != label
        send_message!(Protocol::Device::SetLabel.new(label: label.encode('utf-8')), wait_for: Protocol::Device::StateLabel)
      end
      self
    end
1005404
def add_label(self, name, addr):
        

        # set the label
        self._symbolization_needed = True

        self.symbol_manager.new_label(addr, name=name, force=True)
1289732
def setLabel(self, text=None, units=None, unitPrefix=None, **args):
        
        show_label = False
        if text is not None:
            self.labelText = text
            show_label = True
        if units is not None:
            self.labelUnits = units
            show_label = True
        if show_label:
            self.showLabel()
        if unitPrefix is not None:
            self.labelUnitPrefix = unitPrefix
        if len(args) > 0:
            self.labelStyle = args
        self.label.setHtml(self.labelString())
        self._adjustSize()
        self.picture = None
        self.update()
130741
static String generateUniqueLabel(String label, Set<String> existingLabels) {
    StringBuilder newLabel = new StringBuilder(label);
    while (existingLabels.contains(newLabel.toString())) {
      newLabel.append(POSTFIX);
    }
    return newLabel.toString();
  }
573010
synchronized public void addLabel(String label) {
        if (!labelMap.contains(label)) {
            labelMap.add(labelCounter++, label);
        }
    }
614015
def editContactItem(self, contact, label, number):
        
        contact.label = label
        contact.number = number
1261715
function _updateOverwriteLabel(event, editor, newstate, doNotAnimate) {
        if ($statusOverwrite.text() === (newstate ? Strings.STATUSBAR_OVERWRITE : Strings.STATUSBAR_INSERT)) {
            // label already up-to-date
            return;
        }

        $statusOverwrite.text(newstate ? Strings.STATUSBAR_OVERWRITE : Strings.STATUSBAR_INSERT);

        if (!doNotAnimate) {
            AnimationUtils.animateUsingClass($statusOverwrite[0], "flash", 1500);
        }
    }
143519
def create_label(self, name, color, description=github.GithubObject.NotSet):
        
        assert isinstance(name, (str, unicode)), name
        assert isinstance(color, (str, unicode)), color
        assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
        post_parameters = {
            "name": name,
            "color": color,
        }
        if description is not github.GithubObject.NotSet:
            post_parameters["description"] = description
        headers, data = self._requester.requestJsonAndCheck(
            "POST",
            self.url + "/labels",
            input=post_parameters,
            headers={'Accept': Consts.mediaTypeLabelDescriptionSearchPreview}
        )
        return github.Label.Label(self._requester, headers, data, completed=True)
647249
def setText(self, label, default='', description='Set Text', format='text'):
        

        obj = self.load(label)
        if obj == None:
            obj=default
            self.save(obj, label)  # initialize with default

        textw = Text(value=obj, description=description)
        hndl = interact(self.save, obj=textw, label=fixed(label), format=fixed(format))
647097
def add_label(self, name, color):
        """"""
        color_upper = color.upper()
        if not self._color_re.match(color_upper):
            raise ValueError('Invalid color: {}'.format(color))

        labels_tag = self.root[0]
        last_id = int(labels_tag[-1].get('id'))
        new_id = str(last_id + 1)

        new_label = etree.Element('label', id=new_id, color=color_upper)
        new_label.text = name

        labels_tag.append(new_label)
1146480
def createLabel(self, name):
        
        if self.findLabel(name):
            raise exception.LabelException('Label exists')
        node = _node.Label()
        node.name = name
        self._labels[node.id] = node # pylint: disable=protected-access
        return node
963575
public void setLabel(String label) {
        this.label.setText(label);

        if (!getPlaceholder().isEmpty()) {
            this.label.setStyleName(CssName.ACTIVE);
        }
    }
1165935
def editlabel(self, project_id, name, new_name=None, color=None):
        
        data = {'name': name, 'new_name': new_name, 'color': color}

        request = requests.put(
            '{0}/{1}/labels'.format(self.projects_url, project_id), data=data,
            verify=self.verify_ssl, auth=self.auth, headers=self.headers, timeout=self.timeout)

        if request.status_code == 200:
            return request.json()
        else:
            return False
835588
def add_item(self, label, s):
        
        self.append(Command('item', options=label))
        self.append(s)
595897
function autoAlignLabel() {
			// Auto-align label, depending on it's position
			if (!settings.hasOwnProperty("label") || (settings.hasOwnProperty("label") && !settings.label.hasOwnProperty("align"))) {
				switch(options.label.position) {
				case "left":
					options.label.align = "right";
					break;
				case "right":
					options.label.align = "left";
					break;
				default:
					options.label.align = "center";
				}

				if (options.label.rotate === "left") {
					options.label.align = "right";
				} else if (options.label.rotate === "right") {
					options.label.align = "left";
				}
			}

			if (!settings.hasOwnProperty("label") || (settings.hasOwnProperty("label") && !settings.label.hasOwnProperty("offset"))) {
				if (options.label.position === "left" || options.label.position === "right") {
					options.label.offset = {
						x: 10,
						y: 15
					};
				}
			}
		}