This TaxPayer's logo as a data uri.
774836
def logo_as_data_uri(self):
        """"""
        _, ext = os.path.splitext(self.logo.file.name)
        with open(self.logo.file.name, 'rb') as f:
            data = base64.b64encode(f.read())

        return 'data:image/{};base64,{}'.format(
            ext[1:],  # Remove the leading dot.
            data.decode()
        )
1294389
def png_data_uri(self, **kw):
        
        return writers.as_png_data_uri(self.matrix, self._version, **kw)
738172
static void dataUri( CssFormatter formatter, byte[] bytes, String urlStr, String type ) {
        if( type == null ) {
            switch( urlStr.substring( urlStr.lastIndexOf( '.' ) + 1 ) ) {
                case "gif": 
                    type = "image/gif;base64";
                    break;
                case "png": 
                    type = "image/png;base64";
                    break;
                case "jpg":
                case "jpeg":
                    type = "image/jpeg;base64";
                    break;
                default: 
                    type = "text/html";
            }
        } else {
            type = removeQuote( type );
        }

        if( type.endsWith( "base64" ) ) {
            formatter.append( "url(\"data:" ).append( type ).append( ',' );
            formatter.append( toBase64( bytes ) );
            formatter.append( "\")" );
        } else {
            formatter.append( "url(\"data:" ).append( type ).append( ',' );
            appendEncode( formatter, bytes );
            formatter.append( "\")" );
        }
    }
839460
def urn(self):
        

        SMPTELabel = self.SMPTELabel
        Data4 = self.Data4

        # handle case UMIDs where the material number is half swapped
        if (SMPTELabel[11] == 0x00 and
            Data4[0] == 0x06 and Data4[1] == 0x0E and
            Data4[2] == 0x2B and Data4[3] == 0x34 and
            Data4[4] == 0x7F and Data4[5] == 0x7F):

            # print("case 1")
            f = "urn:smpte:umid:%02x%02x%02x%02x.%02x%02x%02x%02x.%02x%02x%02x%02x." + \
             "%02x"  + \
             "%02x%02x%02x." + \
             "%02x%02x%02x%02x.%02x%02x%02x%02x.%08x.%04x%04x"

            return f % (
                 SMPTELabel[0], SMPTELabel[1], SMPTELabel[2],  SMPTELabel[3],
                 SMPTELabel[4], SMPTELabel[5], SMPTELabel[6],  SMPTELabel[7],
                 SMPTELabel[8], SMPTELabel[9], SMPTELabel[10], SMPTELabel[11],
                 self.length,
                 self.instanceHigh, self.instanceMid, self.instanceLow,
                 Data4[0], Data4[1], Data4[2], Data4[3],
                 Data4[4], Data4[5], Data4[6], Data4[7],
                 self.Data1, self.Data2, self.Data3)
        else:
            # print("case 2")
            f = "urn:smpte:umid:%02x%02x%02x%02x.%02x%02x%02x%02x.%02x%02x%02x%02x." + \
             "%02x"  + \
             "%02x%02x%02x." + \
             "%08x.%04x%04x.%02x%02x%02x%02x.%02x%02x%02x%02x"

            return f % (
                 SMPTELabel[0], SMPTELabel[1], SMPTELabel[2],  SMPTELabel[3],
                 SMPTELabel[4], SMPTELabel[5], SMPTELabel[6],  SMPTELabel[7],
                 SMPTELabel[8], SMPTELabel[9], SMPTELabel[10], SMPTELabel[11],
                 self.length,
                 self.instanceHigh, self.instanceMid, self.instanceLow,
                 self.Data1, self.Data2, self.Data3,
                 Data4[0], Data4[1], Data4[2], Data4[3],
                 Data4[4], Data4[5], Data4[6], Data4[7])
635878
def robo_avatar_url(user_data, size=80):
    """"""
    hash = md5(str(user_data).strip().lower().encode('utf-8')).hexdigest()
    url = "https://robohash.org/{hash}.png?size={size}x{size}".format(
        hash=hash, size=size)
    return url
1119856
private URI datasetURNtoURI(String datasetURN) {
    try {
      return new URI(PathUtils.mergePaths(new Path(this.storeRoot), new Path(datasetURN)).toString());
    }catch (URISyntaxException e) {
      log.error("Dataset with URN:" + datasetURN + " cannot be converted into URI. Skip the dataset");
      return null;
    }
  }
1211831
function matchPath (ctx) {
    let path = ctx.path
    return path.indexOf(cookie.path) === 0 && path !== '/favicon.ico'
  }
454744
private static String checkImageStorage(URI sharedImage, URI sharedEdits) {
    if (sharedImage.getScheme().equals(NNStorage.LOCAL_URI_SCHEME)) {
      // shared image is stored in file storage
      return "";
    } else if (sharedImage.getScheme().equals(
        QuorumJournalManager.QJM_URI_SCHEME)
        && sharedImage.equals(sharedEdits)) {
      // image is stored in qjm together with edits
      return "";
    }
    return "Shared image uri: " + sharedImage + " must be either file storage"
        + " or be equal to shared edits storage " + sharedEdits + ". ";
  }
1153490
def clean_uri(self):
        
        if self.instance.fixed:
            return self.instance.uri

        uri = self.cleaned_data['uri']
        # todo: URI validation
        return uri
744593
private static String massageUri(String uriString) {
        if(!uriString.startsWith(SCHEMA_SPECIFIC_PREFIX)) {
            uriString = SCHEMA_SPECIFIC_PREFIX + uriString;
        }
        return uriString;
    }
545255
private String resolveSubjectToDatastream(String subject) throws ServerException{
        String pidURI = PID.toURI(m_obj.getPid());
        if (subject.startsWith(pidURI)) {
            if (subject.length() == pidURI.length()) {
                return "RELS-EXT";
            }
            if (subject.charAt(pidURI.length()) == '/') {
                return "RELS-INT";
            }
        }
        throw new GeneralException("Cannot determine which relationship datastream to update for subject " + subject + ".  Relationship subjects must be the URI of the object or the URI of a datastream within the object.");
    }
702019
def PrintSummaryTable(self):
    """"""
    print("""

As of {0:s} the repository contains:

| **File paths covered** | **{1:d}** |
| :------------------ | ------: |
| **Registry keys covered** | **{2:d}** |
| **Total artifacts** | **{3:d}** |
""".format(
    time.strftime('%Y-%m-%d'), self.path_count, self.reg_key_count,
    self.total_count))
870096
function(dataUri) {

            // first, make sure there are no newlines in the data uri
            dataUri = dataUri.replace(/\s/g, '');
            dataUri = decodeURIComponent(dataUri);

            var firstCommaIndex = dataUri.indexOf(','); // split dataUri as `dataTypeString`,`data`

            var dataTypeString = dataUri.slice(0, firstCommaIndex); // e.g. 'data:image/jpeg;base64'
            var mimeString = dataTypeString.split(':')[1].split(';')[0]; // e.g. 'image/jpeg'

            var data = dataUri.slice(firstCommaIndex + 1);
            var decodedString;
            if (dataTypeString.indexOf('base64') >= 0) { // data may be encoded in base64
                decodedString = atob(data); // decode data
            } else {
                // convert the decoded string to UTF-8
                decodedString = unescape(encodeURIComponent(data));
            }
            // write the bytes of the string to a typed array
            var ia = new Uint8Array(decodedString.length);
            for (var i = 0; i < decodedString.length; i++) {
                ia[i] = decodedString.charCodeAt(i);
            }

            return new Blob([ia], { type: mimeString }); // return the typed array as Blob
        }
400445
private static URI toFileSystemUri(URI uri) {
    try {
      return new URI(
          uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), null, null, null);
    } catch (URISyntaxException e) {
      throw new AssertionError(e);
    }
  }
746576
private String computeUri(String target, String query, String anchor) {

        StringBuffer uri = new StringBuffer(64);
        uri.append(target);
        if (query != null) {
            uri.append('?');
            uri.append(query);
        }
        if (anchor != null) {
            uri.append('#');
            uri.append(anchor);
        }
        return uri.toString();

    }
1294531
def uri(self):
        " "
        use_pid = self.pid
        if callable(use_pid):
            use_pid = self.DUMMY_PID
        return 'info:fedora/' + use_pid
1191177
def img(self, id):
        """"""
        return self._serve_file(os.path.join(media_path, 'img', id))