当前位置: 首页>>代码示例>>Python>>正文


Python Util.getFilesFromDir方法代码示例

本文整理汇总了Python中util.Util.getFilesFromDir方法的典型用法代码示例。如果您正苦于以下问题:Python Util.getFilesFromDir方法的具体用法?Python Util.getFilesFromDir怎么用?Python Util.getFilesFromDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在util.Util的用法示例。


在下文中一共展示了Util.getFilesFromDir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: optimizeDirectory

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import getFilesFromDir [as 别名]
    def optimizeDirectory(self, path, callback, extension = "", minimize = False):
        """optimizes a directory

        Arguments:
        path -- path to directory
        callback -- function to run the file through
        extension -- extension to search for in the directory
        minimize -- whether or not we should minimize the file contents (html)

        Returns:
        void

        """
        directory = path + "_opt"
        skip = self.prepareDirectory(directory)
        if skip is True:
            return

        for dir_file in Util.getFilesFromDir(path, extension):
            if Util.isDir(dir_file):
                self.optimizeSubdirectory(dir_file, callback, directory, extension, minimize)
                continue

            new_path = directory + "/" + Util.getFileName(dir_file)
            self.optimizeFile(dir_file, callback, minimize, new_path)
开发者ID:Mondego,项目名称:pyreco,代码行数:27,代码来源:allPythonContent.py

示例2: optimizeSubdirectory

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import getFilesFromDir [as 别名]
    def optimizeSubdirectory(self, path, callback, new_path, extension = "", minimize = False):
        """optimizes a subdirectory within a directory being optimized

        Arguments:
        path -- path to directory
        callback -- function to run the file through
        new_path -- path to optimized parent directory
        extension -- extension to search for in the directory
        minimize -- whether or not we should minimize the file contents (html)

        Returns:
        void

        """
        subdir_path = new_path + "/" + path.split("/").pop()
        skip = self.prepareDirectory(subdir_path)
        if skip is True:
            return

        for dir_file in Util.getFilesFromDir(path, extension):
            if Util.isDir(dir_file):
                self.optimizeSubdirectory(dir_file, callback, subdir_path, extension, minimize)
                continue

            new_file_path = subdir_path + "/" + Util.getFileName(dir_file)
            self.optimizeFile(dir_file, callback, minimize, new_file_path)
开发者ID:Mondego,项目名称:pyreco,代码行数:28,代码来源:allPythonContent.py

示例3: processJsDirectory

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import getFilesFromDir [as 别名]
    def processJsDirectory(self, file):
        """processes a directory of js files

        Arguments:
        file -- path to directory

        Returns:
        void

        """
        if ".svn" in file:
            return

        for dir_file in Util.getFilesFromDir(file):
            if Util.isDir(dir_file):
                self.processJsDirectory(dir_file)
                continue
            self.processJsFile(dir_file)
开发者ID:Mondego,项目名称:pyreco,代码行数:20,代码来源:allPythonContent.py


注:本文中的util.Util.getFilesFromDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。