Пример #1
0
    def retrieve_paths(self, products, report_path, suffix=None):
        """Helper method to retrieve path from particular report metadata.

        :param products: Report products.
        :type products: list

        :param report_path: Path of the IF output.
        :type report_path: str

        :param suffix: Expected output product file type (extension).
        :type suffix: str

        :return: List of absolute path of the output product.
        :rtype: list
        """
        paths = []
        for product in products:
            path = ImpactReport.absolute_output_path(
                join(report_path, 'output'), products, product.key)
            if isinstance(path, list):
                for p in path:
                    paths.append(p)
            elif isinstance(path, dict):
                for p in list(path.values()):
                    paths.append(p)
            else:
                paths.append(path)
        if suffix:
            paths = [p for p in paths if p.endswith(suffix)]

        paths = [p for p in paths if exists(p)]
        return paths
Пример #2
0
    def retrieve_paths(self, products, report_path, suffix=None):
        """Helper method to retrieve path from particular report metadata.

        :param products: Report products.
        :type products: list

        :param report_path: Path of the IF output.
        :type report_path: str

        :param suffix: Expected output product file type (extension).
        :type suffix: str

        :return: List of absolute path of the output product.
        :rtype: list
        """
        paths = []
        for product in products:
            path = ImpactReport.absolute_output_path(
                join(report_path, 'output'),
                products,
                product.key)
            if isinstance(path, list):
                for p in path:
                    paths.append(p)
            elif isinstance(path, dict):
                for p in list(path.values()):
                    paths.append(p)
            else:
                paths.append(path)
        if suffix:
            paths = [p for p in paths if p.endswith(suffix)]

        paths = [p for p in paths if exists(p)]
        return paths
Пример #3
0
    def retrieve_paths(products, report_path, suffix):
        """Helper method to retrieve path from particular report metadata.
        """
        paths = {}
        for product in products:
            path = ImpactReport.absolute_output_path(report_path, products,
                                                     product.key)
            if isinstance(path, list):
                for p in path:
                    if p.endswith(suffix) and exists(p):
                        paths[product.key] = p
            elif isinstance(path, dict):
                for p in path.itervalues():
                    if p.endswith(suffix) and exists(p):
                        paths[product.key] = p
            elif exists(path):
                paths[product.key] = path

        return paths
Пример #4
0
    def retrieve_paths(products, report_path, suffix):
        """Helper method to retrieve path from particular report metadata.
        """
        paths = {}
        for product in products:
            path = ImpactReport.absolute_output_path(
                report_path,
                products,
                product.key)
            if isinstance(path, list):
                for p in path:
                    if p.endswith(suffix) and exists(p):
                        paths[product.key] = p
            elif isinstance(path, dict):
                for p in list(path.values()):
                    if p.endswith(suffix) and exists(p):
                        paths[product.key] = p
            elif exists(path):
                paths[product.key] = path

        return paths