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)
| 35 | |
| 36 | |
| 37 | def 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 | |
| 56 | def get_positional(args, kw, kw_overrides=False): |