@@ -91,8 +91,8 @@ def _get_packed_offsets(wd_list, total, sep, mode="fixed"):
9191 offsets : array of float
9292 The left offsets of the boxes.
9393 """
94- w_list , d_list = zip (* wd_list )
95- # d_list is currently not used.
94+ w_list , d_list = zip (* wd_list ) # d_list is currently not used.
95+ cbook . _check_in_list ([ "fixed" , "expand" , "equal" ], mode = mode )
9696
9797 if mode == "fixed" :
9898 offsets_ = np .cumsum ([0 ] + [w + sep for w in w_list ])
@@ -119,16 +119,13 @@ def _get_packed_offsets(wd_list, total, sep, mode="fixed"):
119119 if total is None :
120120 if sep is None :
121121 raise ValueError ("total and sep cannot both be None when "
122- "using layout mode 'equal'. " )
122+ "using layout mode 'equal'" )
123123 total = (maxh + sep ) * len (w_list )
124124 else :
125125 sep = total / len (w_list ) - maxh
126126 offsets = (maxh + sep ) * np .arange (len (w_list ))
127127 return total , offsets
128128
129- else :
130- raise ValueError ("Unknown mode : %s" % (mode ,))
131-
132129
133130def _get_aligned_offsets (hd_list , height , align = "baseline" ):
134131 """
@@ -146,6 +143,8 @@ def _get_aligned_offsets(hd_list, height, align="baseline"):
146143
147144 if height is None :
148145 height = max (h for h , d in hd_list )
146+ cbook ._check_in_list (
147+ ["baseline" , "left" , "top" , "right" , "bottom" , "center" ], align = align )
149148
150149 if align == "baseline" :
151150 height_descent = max (h - d for h , d in hd_list )
@@ -161,8 +160,6 @@ def _get_aligned_offsets(hd_list, height, align="baseline"):
161160 elif align == "center" :
162161 descent = 0.
163162 offsets = [(height - h ) * .5 + d for h , d in hd_list ]
164- else :
165- raise ValueError ("Unknown Align mode : %s" % (align ,))
166163
167164 return height , descent , offsets
168165
0 commit comments