Return a rewritten asset URL for a new stylesheet -- the asset should
 be tagged for embedding if embeddable, and referenced at the correct level
 if relative.
504451
def construct_asset_path(asset_path, css_path, variant)
      public_path = absolute_path(asset_path, css_path)
      return "__EMBED__#{public_path}" if embeddable?(public_path, variant)
      source = asset_path.absolute? || ! Jammit.rewrite_relative_paths ? asset_path.to_s : relative_path(public_path)
      rewrite_asset_path(source, public_path)
    end
75951
def style_sheet(self):
        
        if self._style_sheet is None:
            self._style_sheet = StyleSheetList(self._version, assistant_sid=self._solution['sid'], )
        return self._style_sheet
332405
def load_stylesheet():
    

    # Smart import of the rc file
    f = QtCore.QFile(':qdarkgraystyle/style.qss')
    if not f.exists():
        _logger().error('Unable to load stylesheet, file not found in '
                        'resources')
        return ''
    else:
        f.open(QtCore.QFile.ReadOnly | QtCore.QFile.Text)
        ts = QtCore.QTextStream(f)
        stylesheet = ts.readAll()
        if platform.system().lower() == 'darwin':  # see issue #12 on github
            mac_fix = '''
            QDockWidget::title
            {
                background-color: #31363b;
                text-align: center;
                height: 12px;
            }
            '''
            stylesheet += mac_fix
        return stylesheet
687645
def with_mhtml(css, asset_url)
      paths, index = {}, 0
      css = css.gsub(EMBED_REPLACER) do |url|
        i = paths[$1] ||= "#{index += 1}-#{File.basename($1)}"
        "url(mhtml:#{asset_url}!#{i})"
      end
      mhtml = paths.sort.map do |path, identifier|
        mime, contents = mime_type(path), encoded_contents(path)
        [MHTML_SEPARATOR, "Content-Location: #{identifier}\r\n", "Content-Type: #{mime}\r\n", "Content-Transfer-Encoding: base64\r\n\r\n", contents, "\r\n"]
      end
      [MHTML_START, mhtml, MHTML_END, css].flatten.join('')
    end
1248682
def stylesheet_bundle(key, files = nil)
      stylesheet_bundles[key] = StylesheetBundle.new(self, key.to_s, files)
    end
315787
def rewrite_url(self, url, is_image_src=False):
        
        rewrite = self.img_src_rewrite if is_image_src else self.link_rewrite
        if rewrite:
            return rewrite.format(url=urlquote(url))
        return url
620829
def makeStylesheetResource(self, path, registry):
        
        return StylesheetRewritingResourceWrapper(
            File(path), self.installedOfferingNames, self.rootURL)
86502
def merge_asset(self, other):
        
        for asset in other.asset:
            asset_name = asset.get("name")
            asset_type = asset.tag
            # Avoids duplication
            pattern = "./{}[@name='{}']".format(asset_type, asset_name)
            if self.asset.find(pattern) is None:
                self.asset.append(asset)
537194
def _retrieve_styles(self):
        
        if self._styles_retrieved:
            return
        self._styles_retrieved = True

        try:
            self.assets.retrieve_styles(url_for('asset'))
        except Exception as ex:
            if self.debug:
                print(format_exc(), file=sys.stderr)
            else:
                print(' * Error: could not retrieve styles:', ex,
                      file=sys.stderr)
        if self.render_inline:
            self._inline_styles()
902224
def _image_url(image, dst_color=None, src_color=None):
    
    if src_color and dst_color:
        if not Image:
            raise Exception("Images manipulation require PIL")
    file = StringValue(image).value
    path = None
    if callable(STATIC_ROOT):
        try:
            _file, _storage = list(STATIC_ROOT(file))[0]
            d_obj = _storage.modified_time(_file)
            filetime = int(time.mktime(d_obj.timetuple()))
            if dst_color:
                path = _storage.open(_file)
        except:
            filetime = 'NA'
    else:
        _path = os.path.join(STATIC_ROOT, file)
        if os.path.exists(_path):
            filetime = int(os.path.getmtime(_path))
            if dst_color:
                path = open(_path, 'rb')
        else:
            filetime = 'NA'
    BASE_URL = STATIC_URL
    if path:
        src_color = tuple(int(round(c)) for c in ColorValue(
            src_color).value[:3]) if src_color else (0, 0, 0)
        dst_color = [int(round(c)) for c in ColorValue(dst_color).value[:3]]

        file_name, file_ext = os.path.splitext(
            os.path.normpath(file).replace('\\', '_').replace('/', '_'))
        key = (filetime, src_color, dst_color)
        key = file_name + '-' + base64.urlsafe_b64encode(
            hashlib.md5(repr(key)).digest()).rstrip('=').replace('-', '_')
        asset_file = key + file_ext
        asset_path = os.path.join(ASSETS_ROOT, asset_file)

        if os.path.exists(asset_path):
            file = asset_file
            BASE_URL = ASSETS_URL
            filetime = int(os.path.getmtime(asset_path))
        else:
            image = Image.open(path)
            image = image.convert("RGBA")
            pixdata = image.load()
            for y in xrange(image.size[1]):
                for x in xrange(image.size[0]):
                    if pixdata[x, y][:3] == src_color:
                        new_color = tuple(dst_color + [pixdata[x, y][3]])
                        pixdata[x, y] = new_color
            try:
                image.save(asset_path)
                file = asset_file
                BASE_URL = ASSETS_URL
            except IOError:
                log.exception("Error while saving image")
    url = 'url("%s%s?_=%s")' % (BASE_URL, file, filetime)
    return StringValue(url)
131543
def include_stylesheets(*packages)
      options = packages.extract_options!
      return html_safe(individual_stylesheets(packages, options)) unless should_package?
      disabled = (options.delete(:embed_assets) == false) || (options.delete(:embed_images) == false)
      return html_safe(packaged_stylesheets(packages, options)) if disabled || !Jammit.embed_assets
      return html_safe(embedded_image_stylesheets(packages, options))
    end
1191786
function makeUrlsRelativeToCss(match, quotationMark, url) {
            if (PathUtils.isRelativeUrl(url)) {
                var absUrl = PathUtils.makeUrlAbsolute(url, docUrl);
                return "url(" + quotationMark + absUrl + quotationMark + ")";
            }
            return match;
        }
1297237
def update(self, style_sheet=values.unset):
        
        data = values.of({'StyleSheet': serialize.object(style_sheet), })

        payload = self._version.update(
            'POST',
            self._uri,
            data=data,
        )

        return StyleSheetInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], )
913522
def stylesheet(*urls)
      urls << {} unless urls.last.respond_to? :to_hash
      urls.last[:type] ||= mime_type(:css)
      link(:stylesheet, *urls)
    end
74758
def url(self):
        """"""
        if self.is_unicode_emoji():
            return Asset(self._state)

        _format = 'gif' if self.animated else 'png'
        url = "https://cdn.discordapp.com/emojis/{0.id}.{1}".format(self, _format)
        return Asset(self._state, url)
295102
def create_asset_browser(self, ):
        
        assetbrws = ListBrowser(4, headers=['Assettype', 'Asset', 'Task', 'Descriptor'])
        self.asset_browser_vbox.insertWidget(0, assetbrws)
        return assetbrws
664939
def asset_url(path)
      path.sub!(%r[^(#{@mount_point})?/?], "")
      mounted_path = "#{@mount_point}/#{path}"

      return mounted_path unless Pinion.environment == "production"

      # Add on a checksum tag in production
      asset = Asset[path]
      raise "Error: no such asset available: #{path}" unless asset
      mounted_path, dot, extension = mounted_path.rpartition(".")
      return mounted_path if dot.empty?
      "#{mounted_path}-#{asset.checksum}.#{extension}"
    end