MCPcopy Create free account
hub / github.com/alibaba/graph-learn / IsBlockInNameSpace

Function IsBlockInNameSpace

dynamic_graph_service/ci/cpplint.py:5983–5999  ·  view source on GitHub ↗

Checks that the new block is directly in a namespace. Args: nesting_state: The _NestingState object that contains info about our state. is_forward_declaration: If the class is a forward declared class. Returns: Whether or not the new block is directly in a namespace.

(nesting_state, is_forward_declaration)

Source from the content-addressed store, hash-verified

5981# Returns true if we are at a new block, and it is directly
5982# inside of a namespace.
5983def IsBlockInNameSpace(nesting_state, is_forward_declaration):
5984 """Checks that the new block is directly in a namespace.
5985
5986 Args:
5987 nesting_state: The _NestingState object that contains info about our state.
5988 is_forward_declaration: If the class is a forward declared class.
5989 Returns:
5990 Whether or not the new block is directly in a namespace.
5991 """
5992 if is_forward_declaration:
5993 return len(nesting_state.stack) >= 1 and (
5994 isinstance(nesting_state.stack[-1], _NamespaceInfo))
5995
5996
5997 return (len(nesting_state.stack) > 1 and
5998 nesting_state.stack[-1].check_namespace_indentation and
5999 isinstance(nesting_state.stack[-2], _NamespaceInfo))
6000
6001
6002def ShouldCheckNamespaceIndentation(nesting_state, is_namespace_indent_item,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected