Add sha metadata to content
516639
def git_sha_metadata(content, git_content):
    '''
    
    '''
    if not content.settings['GIT_SHA_METADATA']:
        return

    if not git_content.is_committed():
        return

    content.metadata['gitsha_newest'] = str(git_content.get_newest_commit())
    content.metadata['gitsha_oldest'] = str(git_content.get_oldest_commit())
331866
def put_metadata(metadata_dict, address=None, tx_hash=None, block_hash=None, api_key=None, private=True, coin_symbol='btc'):
    '''
    
    '''
    assert is_valid_coin_symbol(coin_symbol), coin_symbol
    assert api_key
    assert metadata_dict and isinstance(metadata_dict, dict), metadata_dict

    kwarg = get_valid_metadata_identifier(
        coin_symbol=coin_symbol,
        address=address,
        tx_hash=tx_hash,
        block_hash=block_hash,
        )

    url = make_url(coin_symbol, meta=True, **kwarg)

    params = {'token': api_key}
    if private:
        params['private'] = 'true'

    r = requests.put(url, json=metadata_dict, params=params, verify=True, timeout=TIMEOUT_IN_SECONDS)
    return get_valid_json(r, allow_204=True)
842726
def publish_post(self):
        
        payload = {'content': self.content_base64.decode('utf-8')}

        sha_blob = self.get_sha_blob()
        if sha_blob:
            commit_msg = 'ghPublish UPDATE: {}'.format(self.title)
            payload.update(sha=sha_blob)
            payload.update(message=commit_msg)
        else:
            commit_msg = 'ghPublish ADD: {}'.format(self.title)
            payload.update(message=commit_msg)

        r = requests.put(self.api_url,
                         auth=self.get_auth_details(),
                         data=json.dumps(payload))
        try:
            url = r.json()['content']['html_url']
            return r.status_code, url
        except KeyError:
            return r.status_code, None
729112
def blob(self, sha):
        
        url = self._build_url('git', 'blobs', sha, base_url=self._api)
        json = self._json(self._get(url), 200)
        return Blob(json) if json else None
974716
def mp3(self, sha, **kwargs):
        """"""
        return self._queue_msg({'cmd': cmd.CMD_MESSAGE_MP3,
                                'sha': _get_bytes(sha)}, **kwargs)
807160
def sha256(content):
    """"""
    if isinstance(content, str):
        content = content.encode('utf-8')
    return hashlib.sha256(content).hexdigest()
865110
def commit_data(sha)
      sha = sha.to_s
      cdata = command_lines('cat-file', ['commit', sha])
      process_commit_data(cdata, sha, 0)
    end
152921
@Override
  public void addEncryptionMetadata(StorageObjectMetadata meta,
                                    MatDesc matDesc,
                                    byte[] ivData,
                                    byte[] encKeK,
                                    long contentLength)
  {
    meta.addUserMetadata(getMatdescKey(),
                         matDesc.toString());
    meta.addUserMetadata(AMZ_KEY,
                         Base64.encodeAsString(encKeK));
    meta.addUserMetadata(AMZ_IV,
                         Base64.encodeAsString(ivData));
    meta.setContentLength(contentLength);
  }
862564
function() {
    var metadata = {};
    var values = {};
    var metaElements = this._doc.getElementsByTagName("meta");

    // Match "description", or Twitter's "twitter:description" (Cards)
    // in name attribute.
    var namePattern = /^\s*((twitter)\s*:\s*)?(description|title)\s*$/gi;

    // Match Facebook's Open Graph title & description properties.
    var propertyPattern = /^\s*og\s*:\s*(description|title)\s*$/gi;

    // Find description tags.
    this._forEachNode(metaElements, function(element) {
      var elementName = element.getAttribute("name");
      var elementProperty = element.getAttribute("property");

      if ([elementName, elementProperty].indexOf("author") !== -1) {
        metadata.byline = element.getAttribute("content");
        return;
      }

      var name = null;
      if (namePattern.test(elementName)) {
        name = elementName;
      } else if (propertyPattern.test(elementProperty)) {
        name = elementProperty;
      }

      if (name) {
        var content = element.getAttribute("content");
        if (content) {
          // Convert to lowercase and remove any whitespace
          // so we can match below.
          name = name.toLowerCase().replace(/\s/g, '');
          values[name] = content.trim();
        }
      }
    });

    if ("description" in values) {
      metadata.excerpt = values["description"];
    } else if ("og:description" in values) {
      // Use facebook open graph description.
      metadata.excerpt = values["og:description"];
    } else if ("twitter:description" in values) {
      // Use twitter cards description.
      metadata.excerpt = values["twitter:description"];
    }

    metadata.title = this._getArticleTitle();
    if (!metadata.title) {
      if ("og:title" in values) {
        // Use facebook open graph title.
        metadata.title = values["og:title"];
      } else if ("twitter:title" in values) {
        // Use twitter cards title.
        metadata.title = values["twitter:title"];
      }
    }

    return metadata;
  }
536878
def encode_to_sha(msg):
    """"""
    if isinstance(msg, str):
        msg = msg.encode('utf-8')
    return (codecs.encode(msg, "hex_codec") + (b'00' * 32))[:64]
1309436
def _add(self, shard_uri, name):
        """"""
        return self.router_command("addShard", (shard_uri, {"name": name}), is_eval=False)
808654
def _get_content_hash(self):  # type: () -> str
        
        content = self._local_config

        relevant_content = {}
        for key in self._relevant_keys:
            relevant_content[key] = content.get(key)

        content_hash = sha256(
            json.dumps(relevant_content, sort_keys=True).encode()
        ).hexdigest()

        return content_hash
494059
private static String getSettingsHash(Map<String, String> individualSettings, boolean createNew) {

        if (!individualSettings.isEmpty() || createNew) {
            int hash = (individualSettings.toString() + createNew).hashCode();
            return CmsADEManager.CLIENT_ID_SEPERATOR + hash;
        }
        return "";
    }
1140212
def process_hash(tags, property, content, **opts)
      content.each do |key, value|
        key = key.to_s == '_' ? property : "#{property}:#{key}"
        value = normalized_meta_tags[value] if value.kind_of?(Symbol)
        process_tree(tags, key, value, **opts)
      end
    end
712531
function(key, data) {
        var shaObj = new Sha('SHA-256', 'TEXT');
        shaObj.setHMACKey(key, 'TEXT');
        shaObj.update(data);
        return shaObj.getHMAC('HEX');
    }
1047993
public T addMetaTag(String key, String value) {
    checkValidKey(key);
    checkNotEmpty(value, "value must not be empty");
    meta_tags.add("-metadata");
    meta_tags.add(key + "=" + value);
    return getThis();
  }
658604
def prepare(data):
    """"""
    result = {}
    result["mode"] = data.get("mode")
    result["path"] = data.get("path")
    result["type"] = data.get("type")
    result["sha"] = data.get("sha")
    return result