Returns a File or Folder object that would represent the given path.
497570
def file_or_folder(path):
        
        target = unicode(path)
        return Folder(target) if os.path.isdir(target) else File(target)
767027
public static String createFolderPath(String path) {

        String[] pathParts = path.split("\\.");
        String path2 = "";
        for (String part : pathParts) {
            if (path2.equals("")) {
                path2 = part;
            } else {
                path2 = path2 + File.separator
                        + changeFirstLetterToLowerCase(createClassName(part));
            }
        }

        return path2;
    }
1295878
def import_from_path(path):
    
    if path is None:
        return

    obj = locate(path)
    if obj is None:
        raise ImportError(
            "`{}` could not be imported".format(path)
        )

    return obj
455254
def path_to_url(path):
    
    path = os.path.normcase(os.path.abspath(path))
    if _drive_re.match(path):
        path = path[0] + '|' + path[2:]
    url = urllib.quote(path)
    url = url.replace(os.path.sep, '/')
    url = url.lstrip('/')
    return 'file:///' + url
834962
public static File toFile(String parent, String path) {
	return new File(parent.replace(FILE_ANTI_SEPERATOR, FILE_SEPERATOR), path.replace(FILE_ANTI_SEPERATOR, FILE_SEPERATOR));
    }
599257
def loader(path):
    
    finder = ModuleFinder if _isdir(path) else FileFinder
    return Loader(finder(path))
808308
def _getpath(self, path):
        ""
        if is_blacklisted(path):
            raise JottaFuseError('Blacklisted file, refusing to retrieve it')

        return self.client.getObject(path)
1032140
public static Map<String, String[]> loadCorpus(String path)
    {
        Map<String, String[]> dataSet = new TreeMap<String, String[]>();
        File root = new File(path);
        File[] folders = root.listFiles();
        if (folders == null) return null;
        for (File folder : folders)
        {
            if (folder.isFile()) continue;
            File[] files = folder.listFiles();
            if (files == null) continue;
            String[] documents = new String[files.length];
            for (int i = 0; i < files.length; i++)
            {
                documents[i] = IOUtil.readTxt(files[i].getAbsolutePath());
            }
            dataSet.put(folder.getName(), documents);
        }

        return dataSet;
    }
135318
def _get_file_content(self, path):
        """"""
        with open(path, 'r') as file_:
            content = file_.read()
        return content
215593
def read_file(*path):
    
    with open(os.path.join(*path)) as f:
        return f.read().strip()
871396
def load(cls, path):
        """"""
        assert os.path.exists(path), "No such file: %r" % path

        (folder, filename) = os.path.split(path)
        (name, extension) = os.path.splitext(filename)

        wave = Waveform(None)
        wave._path = path
        return wave
636555
def path_to_url(path):
    
    path = os.path.normpath(os.path.abspath(path))
    url = urlparse.urljoin("file:", urllib2.pathname2url(path))
    return url
1142076
private static String getTrimmedPath(String path) {
        String result = path;
        if (result.endsWith("/")) {
            result = result.substring(0, result.length() - 1);
        }
        return result;
    }
544466
def read_file(cls, path):
        
        with open(path, encoding="utf-8") as file:
            file_contents = file.read()
            return cls.read(file_contents)
628727
function _getFSObject(path) {
        if (!path) {
            return path;
        } else if (_pathIsFile(path)) {
            return FileSystem.getFileForPath(path);
        }
        return FileSystem.getDirectoryForPath(path);
    }
1151202
static FileEntry obtainDirectoryFileEntry(String path) {
    try {
      FileEntry lastEntry = null;
      Constructor<FileEntry> c =
          FileEntry.class.getDeclaredConstructor(FileEntry.class, String.class, int.class,
              boolean.class);
      c.setAccessible(true);
      for (String part : path.split("/")) {
        lastEntry = c.newInstance(lastEntry, part, TYPE_DIRECTORY, lastEntry == null);
      }
      return lastEntry;
    } catch (NoSuchMethodException ignored) {
    } catch (InvocationTargetException ignored) {
    } catch (InstantiationException ignored) {
    } catch (IllegalAccessException ignored) {
    }
    return null;
  }
504377
function (path, selected) {

                if (!pathInFiles(path)) {
                    var file;

                    //if path is string, we constructthe good object
                    if (typeof path === 'string') {
                        file = {
                            name : basename(path),
                            path : path,
                            selected : selected || false
                        };
                    } else {
                        //TODO : check something ?
                        file = path;
                    }

                    files.push(file);
                }
                return files;
            }