コード例 #1
0
    def with_risky_nodes(
            self: "NQ",
            risky_nodes_query: Optional["NodeQuery"] = None) -> "NQ":
        risky_nodes = risky_nodes_query or NodeQuery()  # type: NodeQuery

        risky_nodes._risks = cast("List[RiskQuery]", self)
        risky_nodes.set_forward_edge_filter("risks", self)
        cast("List[RiskQuery]", self)._risky_nodes = risky_nodes
        return self
コード例 #2
0
ファイル: lens_node.py プロジェクト: wimax-grapl/grapl
    def with_scope(self: "NQ",
                   scope_query: Optional["NodeQuery"] = None) -> "NQ":
        scope = scope_query or NodeQuery()  # type: NodeQuery

        scope.set_reverse_edge_filter(
            "in_scope",
            self,
            "scope",
        )
        return self
コード例 #3
0
ファイル: lens_node.py プロジェクト: wimax-grapl/grapl
    def get_scope(
        self: "NQ",
        match_scope: Optional[NodeQuery] = None,
    ) -> List[NodeView]:
        _match_scope = match_scope or NodeQuery()  # type: NodeQuery

        self_node = (LensQuery().with_node_key(
            eq=self.node_key).with_scope(_match_scope).query_first(
                self.dgraph_client))

        if self_node:
            cast(LensView, self).scope = self_node.scope

        return cast(LensView, self).scope
コード例 #4
0
ファイル: lens_node.py プロジェクト: wimax-grapl/grapl
 def get_node(self, node_key: str) -> Optional["NodeView"]:
     return NodeQuery().with_node_key(eq=node_key).query_first(
         self.dgraph_client)