@@ -75,15 +75,15 @@ class AvroSerializer(Serializer):
75
75
76
76
AvroSerializer configuration properties:
77
77
+-----------------------+----------+--------------------------------------------------+
78
- | Property Name | type | Description |
78
+ | Property Name | Type | Description |
79
79
+=======================+==========+==================================================+
80
80
| | | Registers schemas automatically if not |
81
81
| auto.register.schemas | bool | previously associated with a particular subject. |
82
82
| | | Defaults to True. |
83
83
+-----------------------|----------+--------------------------------------------------+
84
- | | | Callable(str, SerialalizationContext ) -> str |
84
+ | | | Callable(SerializationContext, str ) -> str |
85
85
| | | |
86
- | subject.name.strategy | callable | Instructs the AvroSerializer on how to Construct |
86
+ | subject.name.strategy | callable | Instructs the AvroSerializer on how to construct |
87
87
| | | Schema Registry subject names. |
88
88
| | | Defaults to topic_subject_name_strategy. |
89
89
+-----------------------+----------+--------------------------------------------------+
@@ -138,7 +138,7 @@ class AvroSerializer(Serializer):
138
138
""" # noqa: E501
139
139
__slots__ = ['_hash' , '_auto_register' , '_known_subjects' , '_parsed_schema' ,
140
140
'_registry' , '_schema' , '_schema_id' , '_schema_name' ,
141
- '_subject_name_func' , 'to_dict ' ]
141
+ '_subject_name_func' , '_to_dict ' ]
142
142
143
143
# default configuration
144
144
_default_conf = {'auto.register.schemas' : True ,
@@ -153,9 +153,9 @@ def __init__(self, schema_registry_client, schema_str,
153
153
154
154
if to_dict is not None and not callable (to_dict ):
155
155
raise ValueError ("to_dict must be callable with the signature"
156
- " to_dict(Serialization Context , object)->dict" )
156
+ " to_dict(SerializationContext , object)->dict" )
157
157
158
- self .to_dict = to_dict
158
+ self ._to_dict = to_dict
159
159
160
160
# handle configuration
161
161
conf_copy = self ._default_conf .copy ()
@@ -197,7 +197,7 @@ def __call__(self, ctx, obj):
197
197
ctx (SerializationContext): Metadata pertaining to the serialization
198
198
operation.
199
199
200
- obj (object): object instance to serializes .
200
+ obj (object): object instance to serialize .
201
201
202
202
Note:
203
203
None objects are represented as Kafka Null.
@@ -228,8 +228,8 @@ def __call__(self, ctx, obj):
228
228
self ._schema_id = registered_schema .schema_id
229
229
self ._known_subjects .add (subject )
230
230
231
- if self .to_dict is not None :
232
- value = self .to_dict (ctx , obj )
231
+ if self ._to_dict is not None :
232
+ value = self ._to_dict (ctx , obj )
233
233
else :
234
234
value = obj
235
235
@@ -271,7 +271,7 @@ class AvroDeserializer(Deserializer):
271
271
https://avro.apache.org/docs/1.8.2/spec.html#Schema+Resolution
272
272
273
273
"""
274
- __slots__ = ['_reader_schema' , '_registry' , 'from_dict ' , '_writer_schemas' ]
274
+ __slots__ = ['_reader_schema' , '_registry' , '_from_dict ' , '_writer_schemas' ]
275
275
276
276
def __init__ (self , schema_registry_client , schema_str , from_dict = None ):
277
277
self ._registry = schema_registry_client
@@ -282,12 +282,11 @@ def __init__(self, schema_registry_client, schema_str, from_dict=None):
282
282
if from_dict is not None and not callable (from_dict ):
283
283
raise ValueError ("from_dict must be callable with the signature"
284
284
" from_dict(SerializationContext, dict) -> object" )
285
- self .from_dict = from_dict
285
+ self ._from_dict = from_dict
286
286
287
287
def __call__ (self , ctx , value ):
288
288
"""
289
- Decodes a Confluent Schema Registry formatted Avro bytes
290
- to an object.
289
+ Decodes a Confluent Schema Registry formatted Avro bytes to an object.
291
290
292
291
Arguments:
293
292
ctx (SerializationContext): Metadata pertaining to the serialization
@@ -331,7 +330,7 @@ def __call__(self, ctx, value):
331
330
writer_schema ,
332
331
self ._reader_schema )
333
332
334
- if self .from_dict is not None :
335
- return self .from_dict (ctx , obj_dict )
333
+ if self ._from_dict is not None :
334
+ return self ._from_dict (ctx , obj_dict )
336
335
337
336
return obj_dict
0 commit comments