Returns a handle to data file.

    Creates containing directory, if needed.
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)
1105219
def iter_item_handles(self):
        """"""

        path = self._data_abspath
        path_length = len(path) + 1

        for dirpath, dirnames, filenames in os.walk(path):
            for fn in filenames:
                path = os.path.join(dirpath, fn)
                relative_path = path[path_length:]
                if IS_WINDOWS:
                    relative_path = windows_to_unix_path(relative_path)
                yield relative_path
38849
def writeFile(self, directory=None):
        """"""
        if directory:
            # If a directory was specified
            full_path = os.path.join(directory, self.filename)
            with open(full_path, 'wb') as f:
                f.write(pickle.loads(self.data).read())
            return full_path

        # if no directory was specified, create a temporary file
        this_file = tempfile.NamedTemporaryFile(delete=False)
        this_file.write(pickle.loads(self.data).read())
        this_file.close()

        return this_file.name
35413
function createDir (directoryToCreate) {
  return new Promise((resolve, reject) => {
    mkdirp(directoryToCreate, (err) => {
      if (err) {
        return reject(new Error(err));
      }

      return resolve();
    });
  });
}
440352
public ISO9660Directory addDirectory(File file) throws HandlerException {
        ISO9660Directory dir = new ISO9660Directory(file);
        return addDirectory(dir);
    }
1305848
def dump(self, directory=''):
        
        with self.no_unpicklable_properties():
            file_name = os.path.join(directory, 'job-instance.pickle')
            if self.__module__ == '__main__':
                d = pickle.dumps(self)
                module_name = os.path.basename(sys.argv[0]).rsplit('.', 1)[0]
                d = d.replace(b'(c__main__', "(c" + module_name)
                open(file_name, "wb").write(d)

            else:
                pickle.dump(self, open(file_name, "wb"))
1165447
def method_file_cd(f):
    
    @wraps(f)
    def wrapper(self, *args, **kwargs):
        with preserve_current_directory():
            self.GetDirectory().cd()
            return f(self, *args, **kwargs)
    return wrapper
331345
def fetch_file_handler(unused_build_context, target, fetch, package_dir, tar):
    
    dl_dir = join(package_dir, fetch.name) if fetch.name else package_dir
    fetch_url(fetch.uri,
              join(dl_dir, basename(urlparse(fetch.uri).path)),
              dl_dir)
    tar.add(package_dir, arcname=split_name(target.name))
1136394
def create_data_file_by_format(directory_path = None):
    
    stata_files = []
    sas_files = []

    for root, subdirs, files in os.walk(directory_path):
        for file_name in files:
            file_path = os.path.join(root, file_name)
            if os.path.basename(file_name).endswith(".dta"):
                log.info("Found stata file {}".format(file_path))
                stata_files.append(file_path)
            if os.path.basename(file_name).endswith(".sas7bdat"):
                log.info("Found sas file {}".format(file_path))
                sas_files.append(file_path)
    return {'stata': stata_files, 'sas': sas_files}
436385
private ProjectFile handleFileInDirectory(File directory) throws Exception
   {
      List<File> directories = new ArrayList<File>();
      File[] files = directory.listFiles();

      if (files != null)
      {
         // Try files first
         for (File file : files)
         {
            if (file.isDirectory())
            {
               directories.add(file);
            }
            else
            {
               UniversalProjectReader reader = new UniversalProjectReader();
               ProjectFile result = reader.read(file);
               if (result != null)
               {
                  return result;
               }
            }
         }

         // Haven't found a file we can read? Try the directories.
         for (File file : directories)
         {
            ProjectFile result = handleDirectory(file);
            if (result != null)
            {
               return result;
            }
         }
      }
      return null;
   }
285275
def get_data_files_dir():
    
    if 'data_files' in os.listdir(sys.prefix):
        return os.path.join(sys.prefix, 'data_files')
    else:
        return os.path.join(get_pmag_dir(), 'data_files')
290056
def _filehandler(configurable):
    """"""

    filename = configurable.log_name.replace('.', sep)
    path = join(configurable.log_path, '{0}.log'.format(filename))

    return FileHandler(path, mode='a+')
303980
def _preprocess(self, filehandle, metadata):
        ""
        for process in self._preprocessors:
            filehandle = process(filehandle, metadata)
        return filehandle
1312833
def _make_dir(self, client_kwargs):
        
        with _handle_client_exception():
            # Object
            if 'obj' in client_kwargs:
                return self.client.put_object(
                    client_kwargs['container'], client_kwargs['obj'], b'')

            # Container
            return self.client.put_container(client_kwargs['container'])
483297
def download_image(self, handle, dest):
        
        shutil.copyfile(self._prefixed(handle), dest)
710933
public File createDir(File dir) throws DataUtilException {
        if(dir == null) {
            throw new DataUtilException("Dir parameter can not be a null value");
        }
        if(dir.exists()) {
            throw new DataUtilException("Directory already exists: " + dir.getAbsolutePath());
        }
        if(! dir.mkdir()) {
            throw new DataUtilException("The result of File.mkDir() was false. Failed to create directory. : "
                    + dir.getAbsolutePath());
        }
        trackedFiles.add(dir);
        return dir;
    }
1070070
private File getDataFile(String destination) {
        File destinationMetaDir = new File(dataDir, destination);
        if (!destinationMetaDir.exists()) {
            try {
                FileUtils.forceMkdir(destinationMetaDir);
            } catch (IOException e) {
                throw new CanalMetaManagerException(e);
            }
        }

        return new File(destinationMetaDir, dataFileName);
    }