Add a canned key

        :type key: str
        :param key: New canned key

        :type metadata: str
        :param metadata: Optional metadata

        :rtype: dict
        :return: A dictionnary containing canned key description
165099
def add_key(self, key, metadata=""):
        
        data = {
            'key': key,
            'metadata': metadata
        }

        return self.post('createKey', data)
47713
def add(self, term, field, metadata):
        """"""
        if term not in self.metadata:
            self.metadata[term] = {field: metadata}
            return

        if field not in self.metadata[term]:
            self.metadata[term][field] = metadata
            return

        for key in metadata.keys():
            if key in self.metadata[term][field]:
                self.metadata[term][field][key].extend(metadata[key])
            else:
                self.metadata[term][field][key] = metadata[key]
507702
public AnnotatedTextBuilder addGlobalMetaData(AnnotatedText.MetaDataKey key, String value) {
    metaData.put(key, value);
    return this;
  }
485189
def update_metadata(self, key: str, msg: MaildirMessage) -> None:
        
        subpath = self._lookup(key)
        subdir, name = os.path.split(subpath)
        new_subdir = msg.get_subdir()
        new_name = key + self.colon + msg.get_info()
        if subdir != new_subdir:
            raise ValueError('Message subdir may not be updated')
        elif name != new_name:
            new_subpath = os.path.join(msg.get_subdir(), new_name)
            old_path = os.path.join(self._path, subpath)
            new_path = os.path.join(self._path, new_subpath)
            os.rename(old_path, new_path)
            self._toc[key] = new_subpath
384439
def cli(ctx, value, metadata=""):
    
    return ctx.gi.cannedvalues.add_value(value, metadata=metadata)
232255
def encode_metadata(self):
        
        encoded_list = []
        for key, value in iteritems(self.metadata):
            key_str = str(key)  # dict keys may be of any object type.

            # confirm that the key does not contain unwanted characters.
            if re.search(r'^$|[\s,]+', key_str):
                msg = 'Upload-metadata key "{}" cannot be empty nor contain spaces or commas.'
                raise ValueError(msg.format(key_str))

            value_bytes = b(value)  # python 3 only encodes bytes
            encoded_list.append('{} {}'.format(key_str, b64encode(value_bytes).decode('ascii')))
        return encoded_list
372046
def read_metadata(self, key):
        
        if getattr(getattr(self.group, 'meta', None), key, None) is not None:
            return self.parent.select(self._get_metadata_path(key))
        return None
880503
def set_metadata(self, queue, metadata, clear=False):
        
        return self._manager.set_metadata(queue, metadata, clear=clear)
987301
def write_metadata(self, key, values):
        
        values = Series(values)
        self.parent.put(self._get_metadata_path(key), values, format='table',
                        encoding=self.encoding, errors=self.errors,
                        nan_rep=self.nan_rep)
1240659
def _get_metadata_path(self, key):
        
        return "{group}/meta/{key}/meta".format(group=self.group._v_pathname,
                                                key=key)
886611
def cli(ctx, id_number, new_value, metadata=""):
    
    return ctx.gi.cannedvalues.update_value(id_number, new_value, metadata=metadata)
529690
def remove_metadata_key(self, container, key):
        
        meta_dict = {key: ""}
        return self.set_metadata(container, meta_dict)
346759
public FileIndexBuilder putMetadata(String key, String value) {
        checkIfDestroyed();
        metadata.put(key, value);
        return this;
    }
885557
def append(self, key, item):
        
        with self._lock:
            if key in self._dict:
                self._dict[key].append(item)
            else:
                self._dict[key] = [item]
132237
def transfer_metadata_to_dict(self, meta):
        
        dic = {}
        arr = meta.strip(' ,').split(',')
        for i in arr:
            temp = i.split('=')
            key = temp[0].strip()
            value = temp[1].strip()
            dic[key] = value
        return dic
154050
private void addMetadataFromIFD(IFD ifd, String key, boolean exif) {
    metadata.add(key, ifd);
    for (TagValue tag : ifd.getMetadata().getTags()) {
      if (tag.getCardinality() == 1) {
        abstractTiffType t = tag.getValue().get(0);
        if (t.isIFD()) {
          addMetadataFromIFD((IFD) t, key, true);
        } else if (t.containsMetadata()) {
          try {
            Metadata meta = t.createMetadata();
            metadata.addMetadata(meta);
          } catch (Exception ex) {
            // TODO: What?
          }
        } else {
          if (exif)
            t.setContainer("EXIF");
          metadata.add(tag.getName(), t);
        }
      } else {
        if (exif)
          tag.setContainer("EXIF");
        metadata.add(tag.getName(), tag);
      }
    }
    if (ifd.hasNextIFD()) {
      addMetadataFromIFD(ifd.getNextIFD(), key, false);
    }
  }
377802
def create_key(policy=None, description=None, key_usage=None, region=None,
               key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    r = {}
    _policy = salt.serializers.json.serialize(policy)
    try:
        key_metadata = conn.create_key(
            _policy,
            description=description,
            key_usage=key_usage
        )
        r['key_metadata'] = key_metadata['KeyMetadata']
    except boto.exception.BotoServerError as e:
        r['error'] = __utils__['boto.get_error'](e)
    return r