1# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ==============================================================================
15"""Annotations used by the static analizer."""
16
17from __future__ import absolute_import
18from __future__ import division
19from __future__ import print_function
20
21from enum import Enum
22
23
24class NoValue(Enum):
25
26  def __repr__(self):
27    return self.name
28
29
30class NodeAnno(NoValue):
31  """Additionnal annotations used by the static analyzer.
32
33  These are in addition to the basic annotations declared in anno.py.
34  """
35
36  # Symbols
37
38  IS_LOCAL = 'Symbol is local to the function scope being analized.'
39  IS_PARAM = 'Symbol is a parameter to the function being analized.'
40  IS_MODIFIED_SINCE_ENTRY = (
41      'Symbol has been explicitly replaced in the current function scope.')
42
43  # Scopes
44  ARGS_SCOPE = 'The scope for the argument list of a function call.'
45  BODY_SCOPE = (
46      'The scope for the main body of a statement (True branch for if '
47      'statements, main body for loops).')
48  ORELSE_SCOPE = (
49      'The scope for the orelse body of a statement (False branch for if '
50      'statements, orelse body for loops).')
51