Find well formed singler file project
        :return:
194335
def find_single_file_project(self):  # type: () -> List[str]
        
        files = [f for f in os.listdir(".") if os.path.isfile(f)]

        candidates = []
        setup_source = self.setup_py_source()

        for file in files:
            if file.endswith("setup.py") or not file.endswith(".py"):
                continue  # duh

            if setup_source:
                if file.replace(".py", "") in setup_source:
                    candidate = file.replace(".py", "")
                    if candidate != "setup":
                        candidates.append(candidate)

        return candidates
958079
function findFilesWithPlaceholders(packageDir) {
  const findCommand = buildPlaceholderFindCommand(packageDir);
  return spawnSync(findCommand.binary, findCommand.args).stdout
    .toString()
    .split(/[\n\r]/)
    .filter(String);
}
287248
def fixity_check_file(file)
        versions = file.has_versions? ? file.versions.all : [file]

        versions = [versions.max_by(&:created)] if file.has_versions? && latest_version_only

        versions.collect { |v| fixity_check_file_version(file.id, v.uri.to_s) }.flatten
      end
1180591
def search_for_file(path_suffix)
      path_suffix = path_suffix.sub(/(\.rb)?$/, ".rb")

      Horza.constant_paths.each do |root|
        Dir.glob(File.join(root, "**/")).each do |dir|
          path = File.join(dir, path_suffix)
          return path if File.file? path
        end
      end

      raise MissingFile.new(
        "No matching file found for: '#{path_suffix.sub(/(\.rb)?$/, "")}'\n" +
        "Searched in: (#{Horza.constant_paths.map(&:inspect).join(', ')})"
      )
    end
608211
def berksfile(self):
        """"""
        self.berks_path = os.path.join(self.path, 'Berksfile')
        if not self._berksfile:
            if not os.path.isfile(self.berks_path):
                raise ValueError("No Berksfile found at %s"
                                 % self.berks_path)
            self._berksfile = Berksfile(open(self.berks_path, 'r+'))
        return self._berksfile
69868
def get_single_file_info(f_path, int_path):
    
    return { 'path'     : force_unicode(int_path),
             'created'  : os.path.getctime(f_path),
             'last_mod' : os.path.getmtime(f_path)}
1291368
def build_single_worker(queue, templates, base_output_dir):
    """"""
    while True:
        scheme_file = queue.get()
        if scheme_file is None:
            break
        build_single(scheme_file, templates, base_output_dir)
        queue.task_done()
850758
function createIgnoreResult(filePath, baseDir) {
    let message;
    const isHidden = /^\./u.test(path.basename(filePath));
    const isInNodeModules = baseDir && path.relative(baseDir, filePath).startsWith("node_modules");
    const isInBowerComponents = baseDir && path.relative(baseDir, filePath).startsWith("bower_components");

    if (isHidden) {
        message = "File ignored by default.  Use a negated ignore pattern (like \"--ignore-pattern '!<relative/path/to/filename>'\") to override.";
    } else if (isInNodeModules) {
        message = "File ignored by default. Use \"--ignore-pattern '!node_modules/*'\" to override.";
    } else if (isInBowerComponents) {
        message = "File ignored by default. Use \"--ignore-pattern '!bower_components/*'\" to override.";
    } else {
        message = "File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override.";
    }

    return {
        filePath: path.resolve(filePath),
        messages: [
            {
                fatal: false,
                severity: 1,
                message
            }
        ],
        errorCount: 0,
        warningCount: 1,
        fixableErrorCount: 0,
        fixableWarningCount: 0
    };
}
929638
def get_project_root():
    """"""
    cfg = get_project_configuration()
    # At this point it can be sure that the configuration file exists
    # Now make sure the project structure exists
    for dirname in ["raw-datasets",
                    "preprocessed",
                    "feature-files",
                    "models",
                    "reports"]:
        directory = os.path.join(cfg['root'], dirname)
        if not os.path.exists(directory):
            os.makedirs(directory)

    raw_yml_path = pkg_resources.resource_filename('hwrt', 'misc/')

    # TODO: How to check for updates if it already exists?
    raw_data_dst = os.path.join(cfg['root'], "raw-datasets/info.yml")
    if not os.path.isfile(raw_data_dst):
        raw_yml_pkg_src = os.path.join(raw_yml_path, "info.yml")
        shutil.copy(raw_yml_pkg_src, raw_data_dst)

    # Make sure small-baseline folders exists
    for dirname in ["models/small-baseline", "feature-files/small-baseline",
                    "preprocessed/small-baseline"]:
        directory = os.path.join(cfg['root'], dirname)
        if not os.path.exists(directory):
            os.makedirs(directory)

    # Make sure small-baseline yml files exist
    paths = [("preprocessed/small-baseline/", "preprocessing-small-info.yml"),
             ("feature-files/small-baseline/", "feature-small-info.yml"),
             ("models/small-baseline/", "model-small-info.yml")]
    for dest, src in paths:
        raw_data_dst = os.path.join(cfg['root'], "%s/info.yml" % dest)
        if not os.path.isfile(raw_data_dst):
            raw_yml_pkg_src = os.path.join(raw_yml_path, src)
            shutil.copy(raw_yml_pkg_src, raw_data_dst)

    return cfg['root']
637996
def find_user_file(self, option_name, filename_list):
        """"""
        if option_name is not None:
            filePath = self._options.get(option_name, None)
        else:
            filePath = None
        
        # Look for default filenames if a path wasn't provided.
        if filePath is None:
            for filename in filename_list:
                thisPath = os.path.join(self.project_dir, filename)
                if os.path.isfile(thisPath):
                    filePath = thisPath
                    break
        # Use the path passed in options, which may be absolute, relative to the
        # home directory, or relative to the project directory.
        else:
            filePath = os.path.expanduser(filePath)
            if not os.path.isabs(filePath):
                filePath = os.path.join(self.project_dir, filePath)
        
        return filePath
1028657
def get_project_file(pPath = './', pLanguage = '**.rb')
      # Verify if path is a valid directory or file
      return nil unless File.file?(pPath) || File.directory?(pPath)

      # Handle single file and multiple files
      @filesProject =
        File.file?(pPath) ? [pPath] : Dir[File.join(pPath, '**', pLanguage)]
    end
1167505
function findSourceFile(fileName, path, isDefaultLib, isReference, refFile, refPos, refEnd) {
            if (filesByName.contains(path)) {
                var file_1 = filesByName.get(path);
                // try to check if we've already seen this file but with a different casing in path
                // NOTE: this only makes sense for case-insensitive file systems
                if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) {
                    reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd);
                }
                // If the file was previously found via a node_modules search, but is now being processed as a root file,
                // then everything it sucks in may also be marked incorrectly, and needs to be checked again.
                if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) {
                    sourceFilesFoundSearchingNodeModules[file_1.path] = false;
                    if (!options.noResolve) {
                        processReferencedFiles(file_1, ts.getDirectoryPath(fileName), isDefaultLib);
                        processTypeReferenceDirectives(file_1);
                    }
                    modulesWithElidedImports[file_1.path] = false;
                    processImportedModules(file_1, ts.getDirectoryPath(fileName));
                }
                else if (file_1 && modulesWithElidedImports[file_1.path]) {
                    if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
                        modulesWithElidedImports[file_1.path] = false;
                        processImportedModules(file_1, ts.getDirectoryPath(fileName));
                    }
                }
                return file_1;
            }
            // We haven't looked for this file, do so now and cache result
            var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) {
                if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) {
                    fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
                }
                else {
                    fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
                }
            });
            filesByName.set(path, file);
            if (file) {
                sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);
                file.path = path;
                if (host.useCaseSensitiveFileNames()) {
                    // for case-sensitive file systems check if we've already seen some file with similar filename ignoring case
                    var existingFile = filesByNameIgnoreCase.get(path);
                    if (existingFile) {
                        reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile, refPos, refEnd);
                    }
                    else {
                        filesByNameIgnoreCase.set(path, file);
                    }
                }
                skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib;
                var basePath = ts.getDirectoryPath(fileName);
                if (!options.noResolve) {
                    processReferencedFiles(file, basePath, isDefaultLib);
                    processTypeReferenceDirectives(file);
                }
                // always process imported modules to record module name resolutions
                processImportedModules(file, basePath);
                if (isDefaultLib) {
                    files.unshift(file);
                }
                else {
                    files.push(file);
                }
            }
            return file;
        }
1333892
private List<File> getRelativeIncludeDirectories( VCProject vcProject ) throws MojoExecutionException
    {
        final List<File> relativeIncludeDirectories = new ArrayList<File>();
        
        for ( File includeDir : vcProject.getIncludeDirectories() )
        {
            if ( includeDir.isAbsolute() )
            {
                relativeIncludeDirectories.add( includeDir );
            }
            else
            {
                try
                {
                    File absoluteIncludeDir = new File ( vcProject.getFile().getParentFile(), includeDir.getPath() );
                    relativeIncludeDirectories.add( getRelativeFile( vcProject.getBaseDirectory(), 
                            absoluteIncludeDir.getCanonicalFile() ) );
                }
                catch ( IOException ioe )
                {
                    throw new MojoExecutionException( "Failed to compute relative path for directroy " + includeDir, 
                            ioe );
                }
            }
        }
        
        return relativeIncludeDirectories;
    }
838218
def find_version(project, source, force_init):  # type: (str, str, bool) ->None
    
    # quiet! no noise
    file_opener = FileOpener()
    finder = FindVersion(project, source, file_opener, force_init=force_init)
    if finder.PROJECT is None:
        raise TypeError("Next step will fail without project name")
    if not finder.validate_current_versions():
        # This is a failure.
        logger.debug(unicode(finder.all_current_versions()))
        logger.error("Versions not in sync, won't continue")
        die(-1, "Versions not in sync, won't continue")

    version = finder.find_any_valid_version()
    if version:
        print(finder.version_to_write(unicode(version)))
    else:
        logger.error("Failed to find version")
        die(-1, "Failed to find version")
774277
def ProjectHomeRelative(self):
        
        return os.path.relpath(self.ProjectHome, os.path.dirname(self.FileName))
333987
def find_hwpack_dir(root):
    """"""
    root = path(root)
    log.debug('files in dir: %s', root)
    for x in root.walkfiles():
        log.debug('  %s', x)

    hwpack_dir = None
    for h in (root.walkfiles('boards.txt')):
        assert not hwpack_dir
        hwpack_dir = h.parent
        log.debug('found hwpack: %s', hwpack_dir)

    assert hwpack_dir
    return hwpack_dir
799699
def _get_component(filename, default="global"):
    """"""
    if hasattr(filename, "decode"):
        filename = filename.decode()
    parts = filename.split(os.path.sep)

    if len(parts) >= 3:
        if parts[1] in "modules legacy ext".split():
            return parts[2]
    if len(parts) >= 2:
        if parts[1] in "base celery utils".split():
            return parts[1]
    if len(parts) >= 1:
        if parts[0] in "grunt docs".split():
            return parts[0]
    return default