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

Function check_keywords

tensorflow/contrib/specs/python/specs_lib.py:37–53  ·  view source on GitHub ↗

Check for common Python keywords in spec. This function discourages the use of complex constructs in TensorFlow specs; it doesn't completely prohibit them (if necessary, we could check the AST). Args: spec: spec string Raises: ValueError: raised if spec contains a prohibited

(spec)

Source from the content-addressed store, hash-verified

35
36
37def check_keywords(spec):
38 """Check for common Python keywords in spec.
39
40 This function discourages the use of complex constructs
41 in TensorFlow specs; it doesn't completely prohibit them
42 (if necessary, we could check the AST).
43
44 Args:
45 spec: spec string
46
47 Raises:
48 ValueError: raised if spec contains a prohibited keyword.
49 """
50 spec = re.sub(QUOTED, "", spec)
51 match = re.search(KEYWORDS, spec)
52 if match:
53 raise ValueError("keyword '%s' found in spec" % match.group(1))
54
55
56def get_positional(args, kw, kw_overrides=False):

Callers

nothing calls this directly

Calls 2

subMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected