MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / is_literal

Function is_literal

tensorflow/python/autograph/pyct/gast_util.py:40–50  ·  view source on GitHub ↗

Tests whether node represents a Python literal.

(node)

Source from the content-addressed store, hash-verified

38
39
40def is_literal(node):
41 """Tests whether node represents a Python literal."""
42 # Normal literals, True/False/None/Etc. in Python3
43 if is_constant(node):
44 return True
45
46 # True/False/None/Etc. in Python2
47 if isinstance(node, gast.Name) and node.id in ['True', 'False', 'None']:
48 return True
49
50 return False
51
52
53def _is_ellipsis_gast_2(node):

Callers

nothing calls this directly

Calls 1

is_constantFunction · 0.85

Tested by

no test coverage detected