Generate a sif file from the call map.

        :param filepath:    Path of the sif file
        :return:            None
166465
def _genenare_callmap_sif(self, filepath):
        
        with open(filepath, "wb") as f:
            for src, dst in self.callgraph.edges():
                f.write("%#x\tDirectEdge\t%#x\n" % (src, dst))
395719
function newfile(filepath) {
  let dir = path.dirname(filepath);
  if (path.extname(filepath) === '.shp') dir = path.resolve(dir, '..');
  const name = crypto.randomBytes(8).toString('hex');
  return path.join(dir, name);
}
259199
public static OutputStream toFile(String filepath) throws FileNotFoundException {
		if(Strings.isValid(filepath)) {
			return new FileOutputStream(new File(filepath));
		}
		return null;
	}
443335
def from_file(filepath: str):
        
        trace = TrainingTrace()
        trace._trace = load_config(filepath)
        return trace
811116
def openfile(cls, filepath):
        
        if not os.path.isfile(filepath):
            logger.error("%s.openfile: arg `filepath`=«%s» not valid." % (cls.__name__, filepath))
            return False
        try:
            with open(filepath, "rb") as pf:
                pkldata = pickle.load(pf)
            rootnode = cls(treedict=pkldata)
            rootnode._vnpkl_fpath = os.path.abspath(filepath)
        except Exception as err:
            logger.error("%s.openfile: data in file «%s» not valid: %s" % (cls.__name__, filepath, err))
            return False
        return rootnode
1228328
public static File getFileFromClasspath(final String filePath) throws FileNotFoundException {
        try {
            URL fileURL = FileUtils.class.getClassLoader().getResource(filePath);
            if (fileURL == null) {
                throw new FileNotFoundException("File [" + filePath + "] could not be found in classpath");
            }
            return new File(fileURL.toURI());
        } catch (URISyntaxException e) {
            throw new FileNotFoundException("File [" + filePath + "] could not be found: " + e.getMessage());
        }
    }
559769
public static Resource getFileResource(String filePath, TestContext context) {
        if (filePath.contains(FILE_PATH_CHARSET_PARAMETER)) {
            return new PathMatchingResourcePatternResolver().getResource(
                    context.replaceDynamicContentInString(filePath.substring(0, filePath.indexOf(FileUtils.FILE_PATH_CHARSET_PARAMETER))));
        } else {
            return new PathMatchingResourcePatternResolver().getResource(
                    context.replaceDynamicContentInString(filePath));
        }
    }
1226633
def __generate_file(self, file_path):
        
        file_path = os.path.expanduser(file_path)
        if not os.path.exists(os.path.dirname(file_path)):
            self.logger.debug("Directories missing! Creating directories for %s..." % file_path)
            os.makedirs(os.path.dirname(file_path))
        if not os.path.exists(file_path):
            open(file_path, "w+").close()
        return file_path
70436
def dump_to_path(self, cnf, filepath, **kwargs):
        
        _not_implemented(self, cnf, filepath, **kwargs)
1106901
def makepath(s, as_file=False):
    
    if s is None:
        return None
    result = FilePath(s) if (os.path.isfile(s) or as_file) else DirectPath(s)
    return result.expandall()
1229604
def copy_file(self, filepath):
        
        copy_file = False
        try:
            copy_file = self.data[filepath]['copy']
        except KeyError:
            return False
        return copy_file
206832
def file_info(self, filepath, results: str = 'dict', fileref: str = '_spfinfo', quiet: bool = False):
        

        if not self.nosub:
           code  = "filename "+fileref+" '"+filepath+"';\n"
           code += "%put FILEREF_EXISTS=%sysfunc(fexist("+fileref+"));"
   
           ll = self.submit(code)
   
           exists = ll['LOG'].rpartition('FILEREF_EXISTS=')[2].split('\n')[0]
   
           if exists != '1':
              if not quiet:
                 print('The filepath provided does not exist')
              ll = self.submit("filename "+fileref+" clear;")
              return None

        if results != 'dict':
           code="""
           proc delete data=work._SASPY_FILE_INFO;run;
           data work._SASPY_FILE_INFO;
              length infoname infoval $256;
              drop rc fid infonum i close;
              fid=fopen('filerefx');
              if fid then
                 do;
                    infonum=foptnum(fid);
                    do i=1 to infonum;
                       infoname=foptname(fid, i);
                       infoval=finfo(fid, infoname);
                       output;
                    end;
                 end;
              close=fclose(fid);
              rc = filename('filerefx');
           run;
           """.replace('filerefx', fileref)
   
           if self.nosub:
               print(code)
               return None
           else:
              ll  = self.submit(code, results='text')
   
           res = self.sd2df('_SASPY_FILE_INFO', 'work')
           return res


        code="""options nosource;
        data _null_;
           length infoname infoval $256;
           drop rc fid infonum i close;
           put 'INFOSTART';
           fid=fopen('filerefx');
           if fid then
              do;
                 infonum=foptnum(fid);
                 do i=1 to infonum;
                    infoname=foptname(fid, i);
                    infoval=finfo(fid, infoname);
                    put 'INFONAME=' infoname;
                    put 'INFOVAL=' infoval;
                    put 'ENDINFOVAL=';
                 end;
              end; 
           put 'INFOEND';
           close=fclose(fid);
           rc = filename('filerefx');
        run; options source;
        """.replace('filerefx', fileref)

        if self.nosub:
            print(code)
            return None
        else:
           ll  = self.submit(code, results='text')

        res = {}
        log = ll['LOG'].rpartition('INFOEND')[0].rpartition('INFOSTART')
                                                                                  
        for i in range(log[2].count('INFONAME')):                                    
           log = log[2].partition('INFONAME=')[2].partition('\n')                    
           key = log[0]                                                           
           log = log[2].partition('INFOVAL=')[2].partition('\nENDINFOVAL=')
           val = log[0].strip().replace('\n','')
           res[key] = val                                                         
                                                                                  
        return res
527762
def setFilepaths(self, filepaths):
        
        self.setFilepath(os.path.pathsep.join(filepaths))
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
1020844
public static InputStream fromFile(String filepath) throws FileNotFoundException {
		if(Strings.isValid(filepath)) {
			return fromFile(new File(filepath));
		}
		return null;
	}
1266117
def sf(f, dirpath, jottapath):
    """"""
    log.debug('Create SyncFile from %s', repr(f))
    log.debug('Got encoded filename %r, joining with dirpath %r', _encode_filename_to_filesystem(f), dirpath)
    return SyncFile(localpath=os.path.join(dirpath, _encode_filename_to_filesystem(f)),
                  jottapath=posixpath.join(_decode_filename_to_unicode(jottapath), _decode_filename_to_unicode(f)))
1130950
def generate_build_file(startpath, outfilename=DEFAULT_BUILDFILE):
    
    buildfilepath = os.path.join(startpath, outfilename)
    if os.path.exists(buildfilepath):
        raise BuildException("Build file %s already exists." % buildfilepath)

    contents = generate_contents(startpath, outfilename)

    with open(buildfilepath, 'w') as outfile:
        yaml.dump(contents, outfile, default_flow_style=False)
    return buildfilepath