@@ -433,7 +433,17 @@ def __iter__(self):
433433
434434class Map :
435435
436- def __init__ (self , col = None , ** kw ):
436+ def __init__ (self , * args , ** kw ):
437+ if not args :
438+ col = None
439+ elif len (args ) == 1 :
440+ col = args [0 ]
441+ else :
442+ raise TypeError (
443+ "immutables.Map expected at most 1 arguments, "
444+ "got {}" .format (len (args ))
445+ )
446+
437447 self .__count = 0
438448 self .__root = BitmapNode (0 , 0 , [], 0 )
439449 self .__hash = - 1
@@ -483,8 +493,18 @@ def __eq__(self, other):
483493
484494 return True
485495
486- def update (self , col = None , ** kw ):
496+ def update (self , * args , ** kw ):
497+ if not args :
498+ col = None
499+ elif len (args ) == 1 :
500+ col = args [0 ]
501+ else :
502+ raise TypeError (
503+ "update expected at most 1 arguments, got {}" .format (len (args ))
504+ )
505+
487506 it = None
507+
488508 if col is not None :
489509 if hasattr (col , 'items' ):
490510 it = iter (col .items ())
@@ -721,7 +741,16 @@ def __contains__(self, key):
721741 else :
722742 return True
723743
724- def update (self , col = None , ** kw ):
744+ def update (self , * args , ** kw ):
745+ if not args :
746+ col = None
747+ elif len (args ) == 1 :
748+ col = args [0 ]
749+ else :
750+ raise TypeError (
751+ "update expected at most 1 arguments, got {}" .format (len (args ))
752+ )
753+
725754 if self .__mutid == 0 :
726755 raise ValueError ('mutation {!r} has been finished' .format (self ))
727756
0 commit comments