Exemple #1
0
        def optimizeTree(tree):

            if "comments" in optimize:
                commentoptimizer.patch(tree)

            # "variants" prunes parts of the tree, so all subsequent optimizations benefit
            if "variants" in optimize:
                variantoptimizer.search(tree, variantSet, self.id)

            # 'statics' has to come before 'privates', as it needs the original key names in tree
            # if features should be removed recursively, this has to be controlled on the calling
            # level.
            if "statics" in optimize:
                if not featureMap:
                    console.warn(
                        "Empty feature map passed to static methods optimization; skipping"
                    )
                elif self.type == 'static' and self.id in featureMap:
                    featureoptimizer.patch(tree, self, featureMap)

            if "basecalls" in optimize:
                basecalloptimizer.patch(tree)

            if "privates" in optimize:
                privatesMap = load_privates()
                privateoptimizer.patch(tree, id, privatesMap)
                write_privates(privatesMap)

            if "strings" in optimize:
                tree = self._stringOptimizer(tree)

            if "variables" in optimize:
                variableoptimizer.search(tree)

            return tree
Exemple #2
0
        def optimizeTree(tree):

            if "comments" in optimize:
                commentoptimizer.patch(tree)

            # "variants" prunes parts of the tree, so all subsequent optimizations benefit
            if "variants" in optimize:
                variantoptimizer.search(tree, variantSet, self.id)

            # 'statics' has to come before 'privates', as it needs the original key names in tree
            # if features should be removed recursively, this has to be controlled on the calling
            # level.
            if "statics" in optimize:
                if not featureMap:
                    console.warn(
                        "Empty feature map passed to static methods optimization; skipping"
                    )
                elif self.type == 'static' and self.id in featureMap:
                    optimzed_features = featureoptimizer.patch(
                        tree, self, featureMap)
                    if optimzed_features:
                        optimized_statics_overall = load_features()
                        copy = optimized_statics_overall.copy()
                        copy.update(optimzed_features)
                        write_features(copy)

            if "basecalls" in optimize:
                basecalloptimizer.patch(tree)

            if "privates" in optimize:
                privatesMap = load_privates()
                privateoptimizer.patch(tree, id, privatesMap)
                write_privates(privatesMap)

            if "globals" in optimize:
                tree = globalsoptimizer.process(
                    tree
                )  # need to re-assign as this optimizer might change the root node

            if "strings" in optimize:
                tree = stringoptimizer.process(tree, self.id)

            if "variables" in optimize:
                variableoptimizer.search(tree)

            return tree