Returns a slugified filepath. If `filepath` is not passed,
`view.data.slug` or `view.path` will be slugified.
347341
function(filepath, fn) {
      fn = fn || lazy.dashify;
      if (typeof filepath === 'undefined') {
        var ctx = this.context();
        filepath = ctx.slug || this.path;
      }
      return fn(filepath);
    }
516894
def _clean_filepath(self, filepath):
        
        if (os.path.isdir(filepath) and
                os.path.isfile(os.path.join(filepath, '__init__.py'))):

            filepath = os.path.join(filepath, '__init__.py')

        if (not filepath.endswith('.py') and
                os.path.isfile(filepath + '.py')):
            filepath += '.py'
        return filepath
1189393
def _filepath(self, name):
        
        if self.file_ext is None:
            candidates = glob.glob(os.path.join(self.directory, name + ".*"))
            try:
                return next(filter(_is_morphology_file, candidates))
            except StopIteration:
                raise NeuroMError("Can not find morphology file for '%s' " % name)
        else:
            return os.path.join(self.directory, name + self.file_ext)
1275686
def path_to_slug(path):
    
    from yacms.urls import PAGES_SLUG
    lang_code = translation.get_language_from_path(path)
    for prefix in (lang_code, settings.SITE_PREFIX, PAGES_SLUG):
        if prefix:
            path = path.replace(prefix, "", 1)
    return clean_slashes(path) or "/"
354843
def get_data_filepath(name, environ=None):
    
    dr = data_root(environ)

    if not os.path.exists(dr):
        os.makedirs(dr)

    return os.path.join(dr, name)
484312
def get_data_path(filename):
    
    if os.path.isabs(filename):
        return filename
    else:
        return os.path.join(get_data_dir(), filename)
696526
def _get_dest_file_and_url(self, filepath, page_meta={}):
        

        filename = filepath.split("/")[-1]
        filepath_base = filepath.replace(filename, "").rstrip("/")
        slug = page_meta.get("slug")
        fname = slugify(slug) if slug else filename \
            .replace(".html", "") \
            .replace(".md", "") \
            .replace(".jade", "")

        if page_meta.get("pretty_url") is False:
            dest_file = os.path.join(filepath_base, "%s.html" % fname)
        else:
            dest_dir = filepath_base
            if filename not in ["index.html", "index.md", "index.jade"]:
                dest_dir = os.path.join(filepath_base, fname)
            dest_file = os.path.join(dest_dir, "index.html")

        url = "/" + dest_file.replace("index.html", "")
        return dest_file, url
489598
def _build_filepath_for_phantomcss(filepath):
    
    try:
        if os.path.exists(filepath):
            new_root = '.'.join((os.path.splitext(filepath)[0], 'diff'))
            ext = os.path.splitext(filepath)[1]
            diff_filepath = ''.join((new_root, ext))
            if os.path.exists(diff_filepath):
                print 'removing stale diff: {0}'.format(diff_filepath)
                os.remove(diff_filepath)
            return diff_filepath
        else:
            return filepath
    except OSError, e:
        print e
785661
def file_path(self) -> str:
        
        user_dir = self.__get_user_path()
        file_path = path.abspath(path.join(user_dir, self.FILENAME))
        return file_path
787573
def slug(self):
        
        return '{:s}@{:s}[{:d}, {:d}]'.format(self.type, self.seqid,
                                              self.start + 1, self.end)
606381
def url2path(url, data=True, ext:str='.tgz'):
    ""
    name = url2name(url)
    return datapath4file(name, ext=ext, archive=False) if data else modelpath4file(name, ext=ext)
477706
def ReadFromPath(filepath):
  
  with io.open(filepath, mode="r", encoding="utf-8") as filedesc:
    return ReadFromFile(filedesc)
1062684
def slug(cls):
        
        slug = cls.__name__.lower()
        if slug.endswith('view'):
            slug = slug[:-4]
        return slug
1191893
def get_valid_filename(s):
    
    s = get_valid_filename_django(s)
    filename, ext = os.path.splitext(s)
    filename = slugify(filename)
    ext = slugify(ext)
    if ext:
        return "%s.%s" % (filename, ext)
    else:
        return "%s" % (filename,)
481196
def view_path(self):
        
        if self.scheme_name is None or self.scheme_name == "":
            return self.view.view_path
        else:
            return self.scheme_name
300080
def choose_path():
    
    dirs = webview.create_file_dialog(webview.FOLDER_DIALOG)
    if dirs and len(dirs) > 0:
        directory = dirs[0]
        if isinstance(directory, bytes):
            directory = directory.decode("utf-8")

        response = {"status": "ok", "directory": directory}
    else:
        response = {"status": "cancel"}

    return jsonify(response)
808308
def _getpath(self, path):
        ""
        if is_blacklisted(path):
            raise JottaFuseError('Blacklisted file, refusing to retrieve it')

        return self.client.getObject(path)