File tree Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 2020from . import dtypes , pdcompat
2121from .alignment import deep_align
2222from .duck_array_ops import lazy_array_equiv
23- from .utils import Frozen , dict_equiv , ordered_dict_union
23+ from .utils import Frozen , compat_dict_union , dict_equiv
2424from .variable import Variable , as_variable , assert_unique_multiindex_level_names
2525
2626if TYPE_CHECKING :
@@ -506,7 +506,7 @@ def merge_attrs(variable_attrs, combine_attrs):
506506 result = dict (variable_attrs [0 ])
507507 for attrs in variable_attrs [1 :]:
508508 try :
509- result = ordered_dict_union (result , attrs )
509+ result = compat_dict_union (result , attrs )
510510 except ValueError :
511511 raise MergeError (
512512 "combine_attrs='no_conflicts', but some values are not "
Original file line number Diff line number Diff line change @@ -361,6 +361,9 @@ def ordered_dict_intersection(
361361 Binary operator to determine if two values are compatible. By default,
362362 checks for equivalence.
363363
364+ # TODO: Rename to compat_dict_intersection, as we do not use OrderedDicts
365+ # any more.
366+
364367 Returns
365368 -------
366369 intersection : dict
@@ -371,15 +374,15 @@ def ordered_dict_intersection(
371374 return new_dict
372375
373376
374- def ordered_dict_union (
377+ def compat_dict_union (
375378 first_dict : Mapping [K , V ],
376379 second_dict : Mapping [K , V ],
377380 compat : Callable [[V , V ], bool ] = equivalent ,
378381) -> MutableMapping [K , V ]:
379382 """Return the union of two dictionaries as a new dictionary.
380383
381- An exception is raised if any keys are found in both dictionaries and the values are
382- not compatible.
384+ An exception is raised if any keys are found in both dictionaries and the
385+ values are not compatible.
383386
384387 Parameters
385388 ----------
Original file line number Diff line number Diff line change @@ -124,16 +124,14 @@ def test_ordered_dict_intersection(self):
124124 assert {"b" : "B" } == utils .ordered_dict_intersection (self .x , self .y )
125125 assert {} == utils .ordered_dict_intersection (self .x , self .z )
126126
127- def test_ordered_dict_union (self ):
128- assert {"a" : "A" , "b" : "B" , "c" : "C" } == utils .ordered_dict_union (
129- self .x , self .y
130- )
127+ def test_compat_dict_union (self ):
128+ assert {"a" : "A" , "b" : "B" , "c" : "C" } == utils .compat_dict_union (self .x , self .y )
131129 with raises_regex (
132130 ValueError ,
133131 "unsafe to merge dictionaries without "
134132 "overriding values; conflicting key" ,
135133 ):
136- utils .ordered_dict_union (self .x , self .z )
134+ utils .compat_dict_union (self .x , self .z )
137135
138136 def test_dict_equiv (self ):
139137 x = {}
You can’t perform that action at this time.
0 commit comments