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


Python Util.isDir方法代码示例

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


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

示例1: optimizeDirectory

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import isDir [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 isDir [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: prepareDirectory

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import isDir [as 别名]
    def prepareDirectory(self, path):
        if ".svn" in path:
            return True

        if Util.isDir(path):
            return False

        Util.unlinkDir(path)
        self.output("creating directory " + path)
        os.mkdir(path)
        return False
开发者ID:Mondego,项目名称:pyreco,代码行数:13,代码来源:allPythonContent.py

示例4: processJs

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import isDir [as 别名]
    def processJs(self):
        """gets all js files from config and processes them to see what to replace

        Returns:
        void

        """
        files = self.config.js
        for file in files:
            if not Util.isDir(file):
                self.processJsFile(file)
                continue
            self.processJsDirectory(file)
开发者ID:Mondego,项目名称:pyreco,代码行数:15,代码来源:allPythonContent.py

示例5: processViews

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import isDir [as 别名]
    def processViews(self):
        """processes all view files

        Returns:
        void

        """
        files = self.config.views
        for file in files:
            if not Util.isDir(file):
                self.processView(file)
                continue
            self.processViewDirectory(file)
开发者ID:Mondego,项目名称:pyreco,代码行数:15,代码来源:allPythonContent.py

示例6: optimizeFiles

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import isDir [as 别名]
    def optimizeFiles(self, paths, callback, extension = "", minimize = False):
        """loops through a bunch of files and directories, runs them through a callback, then saves them to disk

        Arguments:
        paths -- array of files and directories
        callback -- function to process each file with

        Returns:
        void

        """
        for file in paths:
            if not Util.isDir(file):
                self.optimizeFile(file, callback, minimize)
                continue

            self.optimizeDirectory(file, callback, extension, minimize)
开发者ID:Mondego,项目名称:pyreco,代码行数:19,代码来源:allPythonContent.py

示例7: processJsDirectory

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import isDir [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.isDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。