Home | History | Annotate | Download | only in pyct
      1 # Copyright 2016 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 """Conversion context containers."""
     16 
     17 from __future__ import absolute_import
     18 from __future__ import division
     19 from __future__ import print_function
     20 
     21 
     22 class EntityContext(object):
     23   """Contains information about an entity, like source code.
     24 
     25   Attributes:
     26     namer: Namer that matches the contract of all converters.
     27     source_code: The entity's source code.
     28     source_file: The entity's source file.
     29     namespace: Dict[str->*], containing symbols visible to the entity
     30         (excluding parameters).
     31     arg_values: Dict[str->*], containing parameter values, if known.
     32     arg_types: Dict[str->*], containing parameter types, if known.
     33   """
     34 
     35   def __init__(self, namer, source_code, source_file, namespace, arg_values,
     36                arg_types, recursive):
     37     self.namer = namer
     38     self.source_code = source_code
     39     self.source_file = source_file
     40     self.namespace = namespace
     41     self.arg_values = {} if arg_values is None else arg_values
     42     self.arg_types = {} if arg_types is None else arg_types
     43     self.recursive = recursive
     44