# TODO: transition specifications dict = pyimport "Dict" .Dict!: ClassType .Dict! <: dict.Dict .Dict!. '''erg dic = !{"a": 1} dic.insert!("b", 2) assert dic == {"a": 1, "b": 2} ''' insert!: |K, V|(self: RefMut(.Dict!(K, V)), key: K, value: V) => NoneType '''erg dic = !{"a": 1} x = dic.remove!("a") assert dic == {} assert x == 1 ''' remove!: |K, V|(self: RefMut(.Dict!(K, V)), key: K) => V or NoneType ''' Update the dictionary with the key-value pairs in `other`. If `conflict_resolver` is specified, it will be called with the two values and store as a value when there is a conflict. Otherwise, the value in `other` will be used. ''' '''erg dic = !{"a": 1} dic.update!({"b": 2}) dic.update!([("c", 3)]) assert dic == {"a": 1, "b": 2, "c": 3} dic.update!({"b": 3}, confilct_resolver := (x, y) -> x + y) assert dic == {"a": 1, "b": 5, "c": 3} ''' update!: |K, V|(self: RefMut(.Dict!(K, V)), other: Iterable([K, V]), confilct_resolver := (V, V) -> V) => NoneType ''' Merge two dictionaries. If `conflict_resolver` is specified, it will be called with the two values and store as a value when there is a conflict. Otherwise, the value in `other` will be used. ''' '''erg dic = !{"a": 1} dic.merge!({"b": 2}) assert dic == {"a": 1, "b": 2} dic.merge!({"b": 3}, confilct_resolver := (x, y) -> x + y) assert dic == {"a": 1, "b": 5} ''' merge!: |K, V|(self: RefMut(.Dict!(K, V)), other: .Dict!(K, V), confilct_resolver := (V, V) -> V) => NoneType