Esempio n. 1
0
    def deserialize(
            cls, data: JsonDict,
            api: SemanticAnalyzerPluginInterface) -> "DeclClassApplied":

        return DeclClassApplied(
            is_mapped=data["is_mapped"],
            has_table=data["has_table"],
            mapped_attr_names=[(name, deserialize_and_fixup_type(type_, api))
                               for name, type_ in data["mapped_attr_names"]],
            mapped_mro=[
                deserialize_and_fixup_type(type_, api)
                for type_ in data["mapped_mro"]
            ],
        )
Esempio n. 2
0
 def deserialize(
         cls, info: TypeInfo, data: JsonDict,
         api: SemanticAnalyzerPluginInterface) -> 'DataclassAttribute':
     data = data.copy()
     if data.get('kw_only') is None:
         data['kw_only'] = False
     typ = deserialize_and_fixup_type(data.pop('type'), api)
     return cls(type=typ, info=info, **data)
Esempio n. 3
0
 def deserialize(
     cls,
     info: TypeInfo,
     data: JsonDict,
     api: SemanticAnalyzerPluginInterface,
 ) -> "SQLAlchemyAttribute":
     data = data.copy()
     typ = deserialize_and_fixup_type(data.pop("type"), api)
     return cls(typ=typ, info=info, **data)
Esempio n. 4
0
    def deserialize(cls, info: TypeInfo, data: JsonDict,
                    api: SemanticAnalyzerPluginInterface) -> 'Attribute':
        """Return the Attribute that was serialized."""
        raw_init_type = data['init_type']
        init_type = deserialize_and_fixup_type(raw_init_type,
                                               api) if raw_init_type else None

        converter_type = None
        if data['converter_type']:
            converter_type = deserialize_and_fixup_type(
                data['converter_type'], api)
        return Attribute(
            data['name'], info, data['has_default'], data['init'],
            data['kw_only'],
            Converter(converter_type,
                      data['converter_is_attr_converters_optional'],
                      data['converter_is_invalid_converter']),
            Context(line=data['context_line'],
                    column=data['context_column']), init_type)
Esempio n. 5
0
    def deserialize(
            cls, data: JsonDict,
            api: SemanticAnalyzerPluginInterface) -> "DeclClassApplied":

        return DeclClassApplied(
            is_mapped=data["is_mapped"],
            has_table=data["has_table"],
            mapped_attr_names=cast(
                List[Tuple[str, ProperType]],
                [(name, deserialize_and_fixup_type(type_, api))
                 for name, type_ in data["mapped_attr_names"]],
            ),
            mapped_mro=cast(
                List[Instance],
                [
                    deserialize_and_fixup_type(type_, api)
                    for type_ in data["mapped_mro"]
                ],
            ),
        )
Esempio n. 6
0
 def deserialize(
     cls,
     info: TypeInfo,
     data: JsonDict,
     api: SemanticAnalyzerPluginInterface,
 ) -> 'ClassyField':
     return cls(
         name=data['name'],
         type=deserialize_and_fixup_type(data['type'], api),
         has_default=data['has_default'],
     )
Esempio n. 7
0
 def deserialize(
     cls,
     api,
     data: nodes.JsonDict,
 ) -> Field:
     return cls(
         name=data['name'],
         has_explicit_accessor=data['has_explicit_accessor'],
         line=data['line'],
         column=data['column'],
         type=mypy_helpers.deserialize_and_fixup_type(data['type'], api),
     )
 def deserialize(
         cls, info: TypeInfo, data: JsonDict,
         api: SemanticAnalyzerPluginInterface) -> 'DataclassAttribute':
     data = data.copy()
     typ = deserialize_and_fixup_type(data.pop('type'), api)
     return cls(type=typ, **data)