@@ -90,22 +90,21 @@ def __build_final_class(cls, fields):
9090 )
9191
9292 @classmethod
93- def to_python_not_null (cls , ctypes_object , * args , * *kwargs ):
93+ def to_python_not_null (cls , ctypes_object , ** kwargs ):
9494 result = []
9595 for i in range (ctypes_object .length ):
9696 result .append (
9797 AnyDataObject .to_python (
98- getattr (ctypes_object , f'element_{ i } ' ),
99- * args , ** kwargs
98+ getattr (ctypes_object , f'element_{ i } ' ), ** kwargs
10099 )
101100 )
102101 return ctypes_object .type_id , result
103102
104103 @classmethod
105- async def to_python_not_null_async (cls , ctypes_object , * args , * *kwargs ):
104+ async def to_python_not_null_async (cls , ctypes_object , ** kwargs ):
106105 result = [
107106 await AnyDataObject .to_python_async (
108- getattr (ctypes_object , f'element_{ i } ' ), * args , * *kwargs
107+ getattr (ctypes_object , f'element_{ i } ' ), ** kwargs
109108 )
110109 for i in range (ctypes_object .length )]
111110 return ctypes_object .type_id , result
@@ -223,8 +222,6 @@ class CollectionObject(Nullable):
223222 _type_id = TYPE_COL
224223 _header_class = None
225224 type_code = TC_COLLECTION
226- pythonic = list
227- default = []
228225
229226 @classmethod
230227 def parse_not_null (cls , stream ):
@@ -271,15 +268,15 @@ def __build_final_class(cls, fields):
271268 @classmethod
272269 def to_python_not_null (cls , ctypes_object , * args , ** kwargs ):
273270 result = [
274- AnyDataObject .to_python (getattr (ctypes_object , f'element_{ i } ' ), * args , * *kwargs )
271+ AnyDataObject .to_python (getattr (ctypes_object , f'element_{ i } ' ), ** kwargs )
275272 for i in range (ctypes_object .length )
276273 ]
277274 return ctypes_object .type , result
278275
279276 @classmethod
280277 async def to_python_not_null_async (cls , ctypes_object , * args , ** kwargs ):
281278 result_coro = [
282- AnyDataObject .to_python_async (getattr (ctypes_object , f'element_{ i } ' ), * args , * *kwargs )
279+ AnyDataObject .to_python_async (getattr (ctypes_object , f'element_{ i } ' ), ** kwargs )
283280 for i in range (ctypes_object .length )
284281 ]
285282
@@ -361,35 +358,27 @@ def __build_final_class(cls, fields):
361358 )
362359
363360 @classmethod
364- def _to_python (cls , ctypes_object , * args , * *kwargs ):
361+ def _to_python (cls , ctypes_object , ** kwargs ):
365362 map_cls = cls .__get_map_class (ctypes_object )
366363
367364 result = map_cls ()
368365 for i in range (0 , ctypes_object .length << 1 , 2 ):
369- k = AnyDataObject .to_python (
370- getattr (ctypes_object , f'element_{ i } ' ),
371- * args , ** kwargs
372- )
373- v = AnyDataObject .to_python (
374- getattr (ctypes_object , f'element_{ i + 1 } ' ),
375- * args , ** kwargs
376- )
366+ k = AnyDataObject .to_python (getattr (ctypes_object , f'element_{ i } ' ), ** kwargs )
367+ v = AnyDataObject .to_python (getattr (ctypes_object , f'element_{ i + 1 } ' ), ** kwargs )
377368 result [k ] = v
378369 return result
379370
380371 @classmethod
381- async def _to_python_async (cls , ctypes_object , * args , * *kwargs ):
372+ async def _to_python_async (cls , ctypes_object , ** kwargs ):
382373 map_cls = cls .__get_map_class (ctypes_object )
383374
384375 kv_pairs_coro = [
385376 asyncio .gather (
386377 AnyDataObject .to_python_async (
387- getattr (ctypes_object , f'element_{ i } ' ),
388- * args , ** kwargs
378+ getattr (ctypes_object , f'element_{ i } ' ), ** kwargs
389379 ),
390380 AnyDataObject .to_python_async (
391- getattr (ctypes_object , f'element_{ i + 1 } ' ),
392- * args , ** kwargs
381+ getattr (ctypes_object , f'element_{ i + 1 } ' ), ** kwargs
393382 )
394383 ) for i in range (0 , ctypes_object .length << 1 , 2 )
395384 ]
@@ -449,12 +438,12 @@ def _parse_header(cls, stream):
449438 return [('length' , ctypes .c_int )], length
450439
451440 @classmethod
452- def to_python (cls , ctypes_object , * args , * *kwargs ):
453- return cls ._to_python (ctypes_object , * args , * *kwargs )
441+ def to_python (cls , ctypes_object , ** kwargs ):
442+ return cls ._to_python (ctypes_object , ** kwargs )
454443
455444 @classmethod
456- async def to_python_async (cls , ctypes_object , * args , * *kwargs ):
457- return await cls ._to_python_async (ctypes_object , * args , * *kwargs )
445+ async def to_python_async (cls , ctypes_object , ** kwargs ):
446+ return await cls ._to_python_async (ctypes_object , ** kwargs )
458447
459448 @classmethod
460449 def from_python (cls , stream , value , type_id = None ):
@@ -484,8 +473,6 @@ class MapObject(Nullable, _MapBase):
484473 _type_name = NAME_MAP
485474 _type_id = TYPE_MAP
486475 type_code = TC_MAP
487- pythonic = dict
488- default = {}
489476
490477 @classmethod
491478 def parse_not_null (cls , stream ):
@@ -507,12 +494,12 @@ def _parse_header(cls, stream):
507494 return fields , length
508495
509496 @classmethod
510- def to_python_not_null (cls , ctypes_object , * args , * *kwargs ):
511- return ctypes_object .type , cls ._to_python (ctypes_object , * args , * *kwargs )
497+ def to_python_not_null (cls , ctypes_object , ** kwargs ):
498+ return ctypes_object .type , cls ._to_python (ctypes_object , ** kwargs )
512499
513500 @classmethod
514- async def to_python_not_null_async (cls , ctypes_object , * args , * *kwargs ):
515- return ctypes_object .type , await cls ._to_python_async (ctypes_object , * args , * *kwargs )
501+ async def to_python_not_null_async (cls , ctypes_object , ** kwargs ):
502+ return ctypes_object .type , await cls ._to_python_async (ctypes_object , ** kwargs )
516503
517504 @classmethod
518505 def from_python_not_null (cls , stream , value , ** kwargs ):
@@ -557,7 +544,7 @@ class BinaryObject(Nullable):
557544 COMPACT_FOOTER = 0x0020
558545
559546 @classmethod
560- def hashcode (cls , value : object , client : Optional ['Client' ]) -> int :
547+ def hashcode (cls , value : object , client : Optional ['Client' ] = None ) -> int :
561548 # binary objects's hashcode implementation is special in the sense
562549 # that you need to fully serialize the object to calculate
563550 # its hashcode
@@ -568,7 +555,7 @@ def hashcode(cls, value: object, client: Optional['Client']) -> int:
568555 return value ._hashcode
569556
570557 @classmethod
571- async def hashcode_async (cls , value : object , client : Optional ['AioClient' ]) -> int :
558+ async def hashcode_async (cls , value : object , client : Optional ['AioClient' ] = None ) -> int :
572559 if not value ._hashcode and client :
573560 with AioBinaryStream (client ) as stream :
574561 await value ._from_python_async (stream , save_to_buf = True )
@@ -680,7 +667,7 @@ def __build_final_class(cls, stream, header, header_class, object_fields, fields
680667 return final_class
681668
682669 @classmethod
683- def to_python_not_null (cls , ctypes_object , client : 'Client' = None , * args , * *kwargs ):
670+ def to_python_not_null (cls , ctypes_object , client : 'Client' = None , ** kwargs ):
684671 type_id = ctypes_object .type_id
685672 if not client :
686673 raise ParseError (f'Can not query binary type { type_id } ' )
@@ -692,14 +679,13 @@ def to_python_not_null(cls, ctypes_object, client: 'Client' = None, *args, **kwa
692679 for field_name , field_type in data_class .schema .items ():
693680 setattr (
694681 result , field_name , field_type .to_python (
695- getattr (ctypes_object .object_fields , field_name ),
696- client , * args , ** kwargs
682+ getattr (ctypes_object .object_fields , field_name ), client = client , ** kwargs
697683 )
698684 )
699685 return result
700686
701687 @classmethod
702- async def to_python_not_null_async (cls , ctypes_object , client : 'AioClient' = None , * args , * *kwargs ):
688+ async def to_python_not_null_async (cls , ctypes_object , client : 'AioClient' = None , ** kwargs ):
703689 type_id = ctypes_object .type_id
704690 if not client :
705691 raise ParseError (f'Can not query binary type { type_id } ' )
@@ -711,7 +697,7 @@ async def to_python_not_null_async(cls, ctypes_object, client: 'AioClient' = Non
711697 field_values = await asyncio .gather (
712698 * [
713699 field_type .to_python_async (
714- getattr (ctypes_object .object_fields , field_name ), client , * args , ** kwargs
700+ getattr (ctypes_object .object_fields , field_name ), client = client , ** kwargs
715701 )
716702 for field_name , field_type in data_class .schema .items ()
717703 ]
0 commit comments