示例#1
0
 def __init__(self):
     ValuelessAnnotationParser.__init__(
         self,
         tuple('requires_' + suffix
               for suffix in ('authentication', 'guest', 'user')),
         Ast.FunctionNode)
示例#2
0
class SqlGenerator(Generator):
    from thryft.generators.sql.sql_binary_type import SqlBinaryType as BinaryType  # @UnusedImport
    from thryft.generators.sql.sql_bool_type import SqlBoolType as BoolType  # @UnusedImport
    from thryft.generators.sql.sql_byte_type import SqlByteType as ByteType  # @UnusedImport
    from thryft.generators.sql.sql_const import SqlConst as Const  # @UnusedImport
    from thryft.generators.sql.sql_document import SqlDocument as Document  # @UnusedImport
    from thryft.generators.sql.sql_double_type import SqlDoubleType as DoubleType  # @UnusedImport
    from thryft.generators.sql.sql_enum_type import SqlEnumType as EnumType  # @UnusedImport
    from thryft.generators.sql.sql_exception_type import SqlExceptionType as ExceptionType  # @UnusedImport
    from thryft.generators.sql.sql_field import SqlField as Field  # @UnusedImport
    from thryft.generators.sql.sql_function import SqlFunction as Function  # @UnusedImport
    from thryft.generators.sql.sql_i16_type import SqlI16Type as I16Type  # @UnusedImport
    from thryft.generators.sql.sql_i32_type import SqlI32Type as I32Type  # @UnusedImport
    from thryft.generators.sql.sql_i64_type import SqlI64Type as I64Type  # @UnusedImport
    from thryft.generators.sql.sql_include import SqlInclude as Include  # @UnusedImport
    from thryft.generators.sql.sql_list_type import SqlListType as ListType  # @UnusedImport
    from thryft.generators.sql.sql_map_type import SqlMapType as MapType  # @UnusedImport
    from thryft.generators.sql.sql_service import SqlService as Service  # @UnusedImport
    from thryft.generators.sql.sql_set_type import SqlSetType as SetType  # @UnusedImport
    from thryft.generators.sql.sql_string_type import SqlStringType as StringType  # @UnusedImport
    from thryft.generators.sql.sql_struct_type import SqlStructType as StructType  # @UnusedImport
    from thryft.generators.sql.sql_typedef import SqlTypedef as Typedef  # @UnusedImport


Parser.register_annotation_parser(
    AnnotationParser('sql_column', Ast.StructTypeNode))
Parser.register_annotation_parser(SqlForeignKeyAnnotationParser())
Parser.register_annotation_parser(
    ValuelessAnnotationParser('sql_unique', Ast.FieldNode))
示例#3
0
 def __init__(self):
     ValuelessAnnotationParser.__init__(
         self, 'native', (Ast.StructTypeNode, Ast.TypedefNode))
示例#4
0
 def __init__(self):
     ValuelessAnnotationParser.__init__(self, 'native', (Ast.StructTypeNode, Ast.TypedefNode))
示例#5
0
 def __init__(self):
     ValuelessAnnotationParser.__init__(self, 'deprecated', (Ast.EnumeratorNode, Ast.FieldNode))
示例#6
0
    def __init__(self, default_methods=False, function_overloads=False, mutable_compound_types=False, namespace_prefix=None, **kwds):
        Generator.__init__(self, **kwds)
        self.__default_methods = default_methods
        self.__function_overloads = function_overloads
        self.__mutable_compound_types = mutable_compound_types
        self.__namespace_prefix = namespace_prefix

    @property
    def default_methods(self):
        return self.__default_methods

    @property
    def function_overloads(self):
        return self.__function_overloads

    @property
    def mutable_compound_types(self):
        return self.__mutable_compound_types

    @property
    def namespace_prefix(self):
        return self.__namespace_prefix


Parser.register_annotation_parser(JavaFinalAnnotationParser())
Parser.register_annotation_parser(AnnotationParser('java_extends', (Ast.ExceptionTypeNode, Ast.StructTypeNode)))
Parser.register_annotation_parser(AnnotationParser('java_implements', (Ast.EnumTypeNode, Ast.ExceptionTypeNode, Ast.ServiceNode, Ast.StructTypeNode)))
Parser.register_annotation_parser(ValuelessAnnotationParser('java_escape_to_string', Ast.FieldNode))
Parser.register_annotation_parser(ValuelessAnnotationParser('java_exclude_from_to_string', Ast.FieldNode))
示例#7
0
 def __init__(self):
     ValuelessAnnotationParser.__init__(
         self,
         'union',
         (Ast.ExceptionTypeNode, Ast.StructTypeNode)
     )
示例#8
0
 def __init__(self):
     ValuelessAnnotationParser.__init__(self, tuple('requires_' + suffix for suffix in ('authentication', 'guest', 'user')), Ast.FunctionNode)
示例#9
0
                if len(function_names) > 0 and cmp(function.name,
                                                   function_names[-1]) < 0:
                    after_function_name = ''
                    for function_name_i in xrange(
                            len(function_names) - 1, -1, -1):
                        test_function_name = function_names[function_name_i]
                        if cmp(function.name, test_function_name) >= 0:
                            after_function_name = test_function_name
                            break
                    self._logger.warn(
                        "function %s in %s is out of lexicographic order (should be after %s)",
                        function.name,
                        self._parent_document().path, after_function_name)
                function_names.append(function.name)

    class SetType(Generator.SetType, _SequenceType):  # @UndefinedVariable
        pass

    class StringType(Generator.StringType, _Type):  # @UndefinedVariable
        pass

    class StructType(Generator.StructType,
                     _CompoundType):  # @UndefinedVariable
        pass


Parser.register_annotation_parser(
    ValuelessAnnotationParser('lint_suppress',
                              (Ast.EnumTypeNode, Ast.ExceptionTypeNode,
                               Ast.ServiceNode, Ast.StructTypeNode)))
 def __init__(self):
     ValuelessAnnotationParser.__init__(self, 'deprecated',
                                        (Ast.EnumeratorNode, Ast.FieldNode))