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


Python Paths.relpath方法代码示例

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


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

示例1: list_tests

# 需要导入模块: from scripts.core.base import Paths [as 别名]
# 或者: from scripts.core.base.Paths import relpath [as 别名]
    def list_tests():
        test_dir = Paths.join(Paths.flow123d_root(), 'tests')
        tests = Paths.walk(test_dir, [
            PathFilters.filter_type_is_file(),
            PathFilters.filter_endswith('.yaml'),
            PathFilters.filter_not(PathFilters.filter_name('config.yaml')),
        ])
        result = dict()
        for r in tests:
            dirname = Paths.dirname(r)
            basename = Paths.basename(r)
            if Paths.dirname(dirname) != test_dir:
                continue

            if dirname not in result:
                result[dirname] = list()
            result[dirname].append(basename)
        keys = sorted(result.keys())

        for dirname in keys:
            Printer.all.out(Paths.relpath(dirname, test_dir))
            with Printer.all.with_level(1):
                for basename in result[dirname]:
                    Printer.all.out('{: >4s} {: <40s} {}', '', basename, Paths.relpath(Paths.join(dirname, basename), test_dir))
            Printer.all.newline()
开发者ID:jbrezmorf,项目名称:flow123d,代码行数:27,代码来源:runtest_module.py

示例2: __iter__

# 需要导入模块: from scripts.core.base import Paths [as 别名]
# 或者: from scripts.core.base.Paths import relpath [as 别名]
    def __iter__(self):
        fileset = formic.FileSet(self.includes, directory=self.source)
        for filename in fileset:

            name = Paths.basename(filename) if not self.name else self.name.format(
                path=self.create_path_dict(filename),
                name=Paths.basename(filename),
            )
            if self.flat:
                root = self.target
            else:
                rel_path = Paths.relpath(Paths.dirname(filename), Paths.abspath(self.source))
                root = Paths.abspath(Paths.join(self.target, rel_path))

            yield CopyRule(filename, Paths.join(root, name), self.remove_original)
开发者ID:jbrezmorf,项目名称:flow123d,代码行数:17,代码来源:collector.py

示例3: _get_ref_output_files

# 需要导入模块: from scripts.core.base import Paths [as 别名]
# 或者: from scripts.core.base.Paths import relpath [as 别名]
    def _get_ref_output_files(self, comp_data):
        """
        :type comp_data: dict
        """
        # parse filters
        filters = [PathFilters.filter_wildcards(x) for x in comp_data.get('files', [])]

        # browse files and make them relative to ref output so filters works properly
        files = Paths.walk(self.case.fs.ref_output, [PathFilters.filter_type_is_file()])
        files = [Paths.relpath(f, self.case.fs.ref_output) for f in files]

        # filter files and make them absolute again
        files = Paths.match(files, filters)
        files = [Paths.join(self.case.fs.ref_output, f) for f in files]
        return zip(files, self._get_mirror_files(files))
开发者ID:jbrezmorf,项目名称:flow123d,代码行数:17,代码来源:__init__.py

示例4: _get_mirror_files

# 需要导入模块: from scripts.core.base import Paths [as 别名]
# 或者: from scripts.core.base.Paths import relpath [as 别名]
 def _get_mirror_files(self, paths):
     return [
         Paths.join(self.case.fs.output, Paths.relpath(p, self.case.fs.ref_output))
         for p in paths
     ]
开发者ID:jbrezmorf,项目名称:flow123d,代码行数:7,代码来源:__init__.py


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