References:
        https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue
977885
def add_labels_to_pr(repo: GithubRepository,
                     pull_id: int,
                     *labels: str,
                     override_token: str = None) -> None:
    
    url = ("https://api.github.com/repos/{}/{}/issues/{}/labels"
           "?access_token={}".format(repo.organization,
                                     repo.name,
                                     pull_id,
                                     override_token or repo.access_token))
    response = requests.post(url, json=list(labels))

    if response.status_code != 200:
        raise RuntimeError(
            'Add labels failed. Code: {}. Content: {}.'.format(
                response.status_code, response.content))
339496
public function add_label()
    {
        $rcube = rcube::get_instance();

        if (method_exists($rcube->output, 'add_label')) {
            $args = func_get_args();
            if (count($args) == 1 && is_array($args[0])) {
                $args = $args[0];
            }

            $args = array_map(array($this, 'label_map_callback'), $args);
            $rcube->output->add_label($args);
        }
    }
122671
def update_label(signature, post_data):
    '''
    
    '''
    current_tag_infos = MPost2Label.get_by_uid(signature).objects()
    if 'tags' in post_data:
        pass
    else:
        return False

    tags_arr = [x.strip() for x in post_data['tags'].split(',')]
    for tag_name in tags_arr:
        if tag_name == '':
            pass
        else:
            MPost2Label.add_record(signature, tag_name, 1)

    for cur_info in current_tag_infos:
        if cur_info.tag_name in tags_arr:
            pass
        else:
            MPost2Label.remove_relation(signature, cur_info.tag_id)
347323
function addlabel(name, opts) {
    opts = opts || {};

    var type  = opts.type;
    var token = opts.token;
    var islet = opts.islet;

    // Define label in the current function in the current scope.
    if (type === "exception") {
      if (_.has(funct["(context)"], name)) {
        if (funct[name] !== true && !state.option.node) {
          warning("W002", state.tokens.next, name);
        }
      }
    }

    if (_.has(funct, name) && !funct["(global)"]) {
      if (funct[name] === true) {
        if (state.option.latedef) {
          if ((state.option.latedef === true && _.contains([funct[name], type], "unction")) ||
              !_.contains([funct[name], type], "unction")) {
            warning("W003", state.tokens.next, name);
          }
        }
      } else {
        if ((!state.option.shadow || _.contains([ "inner", "outer" ], state.option.shadow)) &&
            type !== "exception" || funct["(blockscope)"].getlabel(name)) {
          warning("W004", state.tokens.next, name);
        }
      }
    }

    if (funct["(context)"] && _.has(funct["(context)"], name) && type !== "function") {
      if (state.option.shadow === "outer") {
        warning("W123", state.tokens.next, name);
      }
    }

    // if the identifier is from a let, adds it only to the current blockscope
    if (islet) {
      funct["(blockscope)"].current.add(name, type, state.tokens.curr);
    } else {
      funct["(blockscope)"].shadow(name);
      funct[name] = type;

      if (token) {
        funct["(tokens)"][name] = token;
      }

      setprop(funct, name, { unused: opts.unused || false });

      if (funct["(global)"]) {
        global[name] = funct;
        if (_.has(implied, name)) {
          if (state.option.latedef) {
            if ((state.option.latedef === true && _.contains([funct[name], type], "unction")) ||
                !_.contains([funct[name], type], "unction")) {
              warning("W003", state.tokens.next, name);
            }
          }

          delete implied[name];
        }
      } else {
        scope[name] = funct;
      }
    }
  }
142780
def _generate_issue(self, run, entry, callablesCount):
        """"""

        trace_frames = []

        for p in entry["preconditions"]:
            tf = self._generate_issue_precondition(run, entry, p)
            trace_frames.append(tf)

        for p in entry["postconditions"]:
            tf = self._generate_issue_postcondition(run, entry, p)
            trace_frames.append(tf)

        features = set()
        for f in entry["features"]:
            features.update(self._generate_issue_feature_contents(entry, f))

        callable = entry["callable"]
        handle = self._get_issue_handle(entry)
        # TODO: record depth in issue_sink and issue_source assoc, but this can
        # be different per instance, so should be stored with the instance.
        initial_sources = {
            self._get_shared_text(SharedTextKind.SOURCE, s)
            for (s, _) in entry["initial_sources"]
        }
        final_sinks = {
            self._get_shared_text(SharedTextKind.SINK, s)
            for (s, _) in entry["final_sinks"]
        }

        issue = Issue.Record(
            id=IssueDBID(),
            code=entry["code"],
            handle=handle,
            status=IssueStatus.UNCATEGORIZED,
            first_seen=run.date,
            run_id=run.id,
        )

        self.graph.add_issue(issue)

        fix_info = None
        fix_info_id = None
        if entry.get("fix_info") is not None:
            fix_info = IssueInstanceFixInfo.Record(
                id=DBID(), fix_info=json.dumps(entry["fix_info"])
            )
            fix_info_id = fix_info.id

        message = self._get_shared_text(SharedTextKind.MESSAGE, entry["message"])
        filename_record = self._get_shared_text(
            SharedTextKind.FILENAME, entry["filename"]
        )
        callable_record = self._get_shared_text(SharedTextKind.CALLABLE, callable)

        instance = IssueInstance.Record(
            id=DBID(),
            issue_id=issue.id,
            location=self.get_location(entry),
            filename_id=filename_record.id,
            callable_id=callable_record.id,
            run_id=run.id,
            fix_info_id=fix_info_id,
            message_id=message.id,
            rank=0,
            min_trace_length_to_sources=self._get_minimum_trace_length(
                entry["postconditions"]
            ),
            min_trace_length_to_sinks=self._get_minimum_trace_length(
                entry["preconditions"]
            ),
            callable_count=callablesCount[callable],
        )

        for sink in final_sinks:
            self.graph.add_issue_instance_shared_text_assoc(instance, sink)
        for source in initial_sources:
            self.graph.add_issue_instance_shared_text_assoc(instance, source)

        if fix_info is not None:
            self.graph.add_issue_instance_fix_info(instance, fix_info)

        for trace_frame in trace_frames:
            self.graph.add_issue_instance_trace_frame_assoc(instance, trace_frame)

        for feature in features:
            feature = self._get_shared_text(SharedTextKind.FEATURE, feature)
            self.graph.add_issue_instance_shared_text_assoc(instance, feature)

        self.graph.add_issue_instance(instance)
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)
742984
def create_issue(title, body, repo, token):
    '''

    '''
    owner, name = repo.split('/')
    url = 'https://api.github.com/repos/%s/%s/issues' % (owner, name)
    
    data = {'title': title, 'body': body }

    headers = { "Authorization": "token %s" % token,
                "Accept": "application/vnd.github.symmetra-preview+json" }

    response = requests.post(url, data=json.dumps(data), headers=headers)

    if response.status_code in [201, 202]:
        url = response.json()['html_url']
        bot.info(url)
        return url

    elif response.status_code == 404:
        bot.error('Cannot create issue. Does your token have scope repo?')
        sys.exit(1)

    else:
        bot.error('Cannot create issue %s' %title)
        bot.error(response.content)
        sys.exit(1)
212103
def add_issue(self, data):
        

        issue = self.dispatcher(
            'add_issue',
            data,
            self._admintoken
        )

        return json.loads(issue)
406978
function tagIssue (client, repo, number, label) {
  return client.addLabel(repo, number, label).then(convertIssue);
}
1030111
def help_center_article_labels(self, id, **kwargs):
        ""
        api_path = "/api/v2/help_center/articles/{id}/labels.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
313083
def _format_issue(issue):
    '''
    
    '''
    ret = {'id': issue.get('id'),
           'issue_number': issue.get('number'),
           'state': issue.get('state'),
           'title': issue.get('title'),
           'user': issue.get('user').get('login'),
           'html_url': issue.get('html_url')}

    assignee = issue.get('assignee')
    if assignee:
        assignee = assignee.get('login')

    labels = issue.get('labels')
    label_names = []
    for label in labels:
        label_names.append(label.get('name'))

    milestone = issue.get('milestone')
    if milestone:
        milestone = milestone.get('title')

    ret['assignee'] = assignee
    ret['labels'] = label_names
    ret['milestone'] = milestone

    return ret
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
237576
public static InsnList addLabel(LabelNode labelNode) {
        Validate.notNull(labelNode);

        InsnList ret = new InsnList();
        ret.add(labelNode);

        return ret;
    }
1189807
function createIssue (items, repo, title, body, labels) {
  var item = todotxt.item({text: title, date: new Date(), number: items.length + 1});
  labels.forEach(item.addContext);

  if (items.options) {
    if (items.options.priority) {
      item.priority = items.options.priority;
    }
    if (items.options.context) {
      item.addContext(items.options.context);
    }
    if (items.options.project) {
      item.addProject(items.options.project);
    }
  }

  items.push(item);

  return write(items, repo).then(_.constant(convertIssue(item)));
}
366641
def AddClientLabels(self, client_id, owner, labels):
    """"""
    if client_id not in self.metadatas:
      raise db.UnknownClientError(client_id)

    labelset = self.labels.setdefault(client_id, {}).setdefault(owner, set())
    for l in labels:
      labelset.add(utils.SmartUnicode(l))
706281
def find_issues_to_add(all_issues, tag_name)
      all_issues.select do |issue|
        if issue["milestone"].nil?
          false
        else
          # check, that this milestone in tag list:
          milestone_is_tag = @filtered_tags.find do |tag|
            tag["name"] == issue["milestone"]["title"]
          end

          if milestone_is_tag.nil?
            false
          else
            issue["milestone"]["title"] == tag_name
          end
        end
      end
    end
1329897
def sender(self, issues):
        

        for issue in issues:
            state = self.get_state(issue.state)
            if issue.number:
                try:
                    gh_issue = self.repo.get_issue(issue.number)
                    original_state = gh_issue.state
                    if original_state == state:
                        action = 'Updated'
                    elif original_state == 'closed':
                        action = 'Reopened'
                    else:
                        action = 'Closed'

                    gh_issue.edit(title=issue.title,
                                  body=issue.body,
                                  labels=issue.labels,
                                  milestone=self.get_milestone(issue.milestone),
                                  assignee=self.get_assignee(issue.assignee),
                                  state=self.get_state(issue.state)
                                  )
                    print('{} #{}: {}'.format(action, gh_issue.number, gh_issue.title))
                except GithubException:
                    print('Not found #{}: {} (ignored)'.format(issue.number, issue.title))
                    continue
            else:
                gh_issue = self.repo.create_issue(title=issue.title,
                                                  body=issue.body,
                                                  labels=issue.labels,
                                                  milestone=self.get_milestone(issue.milestone),
                                                  assignee=self.get_assignee(issue.assignee))
                print('Created #{}: {}'.format(gh_issue.number, gh_issue.title))