コード例 #1
0
ファイル: cdm_attribute_context.py プロジェクト: rt112000/CDM
    def visit(self, path_from: str, pre_children: 'VisitCallback',
              post_children: 'VisitCallback') -> bool:
        path = self._fetch_declared_path(path_from)

        if pre_children and pre_children(self, path):
            return False

        if self.parent and self.parent.visit('{}/parent/'.format(path),
                                             pre_children, post_children):
            return True

        if self.definition and self.definition.visit(
                '{}/definition/'.format(path), pre_children, post_children):
            return True

        if self.contents and CdmObject._visit_array(
                self.contents, '{}/'.format(path), pre_children,
                post_children):
            return True

        if self.lineage is not None and CdmObject._visit_array(
                self.lineage, '{}/lineage/'.format(path), pre_children,
                post_children):
            return True

        if self._visit_def(path, pre_children, post_children):
            return True

        if post_children and post_children(self, path):
            return True

        return False
コード例 #2
0
ファイル: cdm_attribute_context.py プロジェクト: pratuat/CDM
    def visit(self, path_from: str, pre_children: 'VisitCallback',
              post_children: 'VisitCallback') -> bool:
        path = ''
        if self.ctx.corpus._block_declared_path_changes is False:
            path = self._declared_path
            if not path:
                path = path_from + self.name
                self._declared_path = path

        if pre_children and pre_children(self, path):
            return False

        if self.parent and self.parent.visit('{}/parent/'.format(path),
                                             pre_children, post_children):
            return True

        if self.definition and self.definition.visit(
                '{}/definition/'.format(path), pre_children, post_children):
            return True

        if self.contents and CdmObject._visit_array(
                self.contents, '{}/'.format(path), pre_children,
                post_children):
            return True

        if self._visit_def(path, pre_children, post_children):
            return True

        if post_children and post_children(self, path):
            return True

        return False