@@ -91,22 +91,21 @@ def __build_final_class(cls, fields):
9191 )
9292
9393 @classmethod
94- def to_python_not_null (cls , ctypes_object , * args , * *kwargs ):
94+ def to_python_not_null (cls , ctypes_object , ** kwargs ):
9595 result = []
9696 for i in range (ctypes_object .length ):
9797 result .append (
9898 AnyDataObject .to_python (
99- getattr (ctypes_object , f'element_{ i } ' ),
100- * args , ** kwargs
99+ getattr (ctypes_object , f'element_{ i } ' ), ** kwargs
101100 )
102101 )
103102 return ctypes_object .type_id , result
104103
105104 @classmethod
106- async def to_python_not_null_async (cls , ctypes_object , * args , * *kwargs ):
105+ async def to_python_not_null_async (cls , ctypes_object , ** kwargs ):
107106 result = [
108107 await AnyDataObject .to_python_async (
109- getattr (ctypes_object , f'element_{ i } ' ), * args , * *kwargs
108+ getattr (ctypes_object , f'element_{ i } ' ), ** kwargs
110109 )
111110 for i in range (ctypes_object .length )]
112111 return ctypes_object .type_id , result
@@ -224,8 +223,6 @@ class CollectionObject(Nullable):
224223 _type_id = TYPE_COL
225224 _header_class = None
226225 type_code = TC_COLLECTION
227- pythonic = list
228- default = []
229226
230227 @classmethod
231228 def parse_not_null (cls , stream ):
@@ -272,15 +269,15 @@ def __build_final_class(cls, fields):
272269 @classmethod
273270 def to_python_not_null (cls , ctypes_object , * args , ** kwargs ):
274271 result = [
275- AnyDataObject .to_python (getattr (ctypes_object , f'element_{ i } ' ), * args , * *kwargs )
272+ AnyDataObject .to_python (getattr (ctypes_object , f'element_{ i } ' ), ** kwargs )
276273 for i in range (ctypes_object .length )
277274 ]
278275 return ctypes_object .type , result
279276
280277 @classmethod
281278 async def to_python_not_null_async (cls , ctypes_object , * args , ** kwargs ):
282279 result_coro = [
283- AnyDataObject .to_python_async (getattr (ctypes_object , f'element_{ i } ' ), * args , * *kwargs )
280+ AnyDataObject .to_python_async (getattr (ctypes_object , f'element_{ i } ' ), ** kwargs )
284281 for i in range (ctypes_object .length )
285282 ]
286283
@@ -362,35 +359,27 @@ def __build_final_class(cls, fields):
362359 )
363360
364361 @classmethod
365- def _to_python (cls , ctypes_object , * args , * *kwargs ):
362+ def _to_python (cls , ctypes_object , ** kwargs ):
366363 map_cls = cls .__get_map_class (ctypes_object )
367364
368365 result = map_cls ()
369366 for i in range (0 , ctypes_object .length << 1 , 2 ):
370- k = AnyDataObject .to_python (
371- getattr (ctypes_object , f'element_{ i } ' ),
372- * args , ** kwargs
373- )
374- v = AnyDataObject .to_python (
375- getattr (ctypes_object , f'element_{ i + 1 } ' ),
376- * args , ** kwargs
377- )
367+ k = AnyDataObject .to_python (getattr (ctypes_object , f'element_{ i } ' ), ** kwargs )
368+ v = AnyDataObject .to_python (getattr (ctypes_object , f'element_{ i + 1 } ' ), ** kwargs )
378369 result [k ] = v
379370 return result
380371
381372 @classmethod
382- async def _to_python_async (cls , ctypes_object , * args , * *kwargs ):
373+ async def _to_python_async (cls , ctypes_object , ** kwargs ):
383374 map_cls = cls .__get_map_class (ctypes_object )
384375
385376 kv_pairs_coro = [
386377 asyncio .gather (
387378 AnyDataObject .to_python_async (
388- getattr (ctypes_object , f'element_{ i } ' ),
389- * args , ** kwargs
379+ getattr (ctypes_object , f'element_{ i } ' ), ** kwargs
390380 ),
391381 AnyDataObject .to_python_async (
392- getattr (ctypes_object , f'element_{ i + 1 } ' ),
393- * args , ** kwargs
382+ getattr (ctypes_object , f'element_{ i + 1 } ' ), ** kwargs
394383 )
395384 ) for i in range (0 , ctypes_object .length << 1 , 2 )
396385 ]
@@ -450,12 +439,12 @@ def _parse_header(cls, stream):
450439 return [('length' , ctypes .c_int )], length
451440
452441 @classmethod
453- def to_python (cls , ctypes_object , * args , * *kwargs ):
454- return cls ._to_python (ctypes_object , * args , * *kwargs )
442+ def to_python (cls , ctypes_object , ** kwargs ):
443+ return cls ._to_python (ctypes_object , ** kwargs )
455444
456445 @classmethod
457- async def to_python_async (cls , ctypes_object , * args , * *kwargs ):
458- return await cls ._to_python_async (ctypes_object , * args , * *kwargs )
446+ async def to_python_async (cls , ctypes_object , ** kwargs ):
447+ return await cls ._to_python_async (ctypes_object , ** kwargs )
459448
460449 @classmethod
461450 def from_python (cls , stream , value , type_id = None ):
@@ -485,8 +474,6 @@ class MapObject(Nullable, _MapBase):
485474 _type_name = NAME_MAP
486475 _type_id = TYPE_MAP
487476 type_code = TC_MAP
488- pythonic = dict
489- default = {}
490477
491478 @classmethod
492479 def parse_not_null (cls , stream ):
@@ -508,12 +495,12 @@ def _parse_header(cls, stream):
508495 return fields , length
509496
510497 @classmethod
511- def to_python_not_null (cls , ctypes_object , * args , * *kwargs ):
512- return ctypes_object .type , cls ._to_python (ctypes_object , * args , * *kwargs )
498+ def to_python_not_null (cls , ctypes_object , ** kwargs ):
499+ return ctypes_object .type , cls ._to_python (ctypes_object , ** kwargs )
513500
514501 @classmethod
515- async def to_python_not_null_async (cls , ctypes_object , * args , * *kwargs ):
516- return ctypes_object .type , await cls ._to_python_async (ctypes_object , * args , * *kwargs )
502+ async def to_python_not_null_async (cls , ctypes_object , ** kwargs ):
503+ return ctypes_object .type , await cls ._to_python_async (ctypes_object , ** kwargs )
517504
518505 @classmethod
519506 def from_python_not_null (cls , stream , value , ** kwargs ):
@@ -558,7 +545,7 @@ class BinaryObject(Nullable):
558545 COMPACT_FOOTER = 0x0020
559546
560547 @classmethod
561- def hashcode (cls , value : object , client : Optional ['Client' ]) -> int :
548+ def hashcode (cls , value : object , client : Optional ['Client' ] = None ) -> int :
562549 # binary objects's hashcode implementation is special in the sense
563550 # that you need to fully serialize the object to calculate
564551 # its hashcode
@@ -569,7 +556,7 @@ def hashcode(cls, value: object, client: Optional['Client']) -> int:
569556 return value ._hashcode
570557
571558 @classmethod
572- async def hashcode_async (cls , value : object , client : Optional ['AioClient' ]) -> int :
559+ async def hashcode_async (cls , value : object , client : Optional ['AioClient' ] = None ) -> int :
573560 if not value ._hashcode and client :
574561 with AioBinaryStream (client ) as stream :
575562 await value ._from_python_async (stream , save_to_buf = True )
@@ -681,7 +668,7 @@ def __build_final_class(cls, stream, header, header_class, object_fields, fields
681668 return final_class
682669
683670 @classmethod
684- def to_python_not_null (cls , ctypes_object , client : 'Client' = None , * args , * *kwargs ):
671+ def to_python_not_null (cls , ctypes_object , client : 'Client' = None , ** kwargs ):
685672 type_id = ctypes_object .type_id
686673 if not client :
687674 raise ParseError (f'Can not query binary type { type_id } ' )
@@ -693,14 +680,13 @@ def to_python_not_null(cls, ctypes_object, client: 'Client' = None, *args, **kwa
693680 for field_name , field_type in data_class .schema .items ():
694681 setattr (
695682 result , field_name , field_type .to_python (
696- getattr (ctypes_object .object_fields , field_name ),
697- client , * args , ** kwargs
683+ getattr (ctypes_object .object_fields , field_name ), client = client , ** kwargs
698684 )
699685 )
700686 return result
701687
702688 @classmethod
703- async def to_python_not_null_async (cls , ctypes_object , client : 'AioClient' = None , * args , * *kwargs ):
689+ async def to_python_not_null_async (cls , ctypes_object , client : 'AioClient' = None , ** kwargs ):
704690 type_id = ctypes_object .type_id
705691 if not client :
706692 raise ParseError (f'Can not query binary type { type_id } ' )
@@ -712,7 +698,7 @@ async def to_python_not_null_async(cls, ctypes_object, client: 'AioClient' = Non
712698 field_values = await asyncio .gather (
713699 * [
714700 field_type .to_python_async (
715- getattr (ctypes_object .object_fields , field_name ), client , * args , ** kwargs
701+ getattr (ctypes_object .object_fields , field_name ), client = client , ** kwargs
716702 )
717703 for field_name , field_type in data_class .schema .items ()
718704 ]
0 commit comments