File tree Expand file tree Collapse file tree 1 file changed +17
-15
lines changed
Expand file tree Collapse file tree 1 file changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -171,18 +171,20 @@ def _validate_attrs(
171171 if excludes is None :
172172 excludes = []
173173
174- required = [k for k in attributes .required if k not in excludes ]
175- missing = [attr for attr in required if attr not in data ]
176-
177- if missing :
178- raise AttributeError (f"Missing attributes: { ', ' .join (missing )} " )
179-
180- exclusives = [attr for attr in data if attr in attributes .exclusive ]
181- if len (exclusives ) > 1 :
182- raise AttributeError (
183- f"Provide only one of these attributes: { ', ' .join (exclusives )} "
184- )
185- if not exclusives :
186- raise AttributeError (
187- f"Must provide one of these attributes: { ', ' .join (attributes .exclusive )} "
188- )
174+ if attributes .required :
175+ required = [k for k in attributes .required if k not in excludes ]
176+ missing = [attr for attr in required if attr not in data ]
177+ if missing :
178+ raise AttributeError (f"Missing attributes: { ', ' .join (missing )} " )
179+
180+ if attributes .exclusive :
181+ exclusives = [attr for attr in data if attr in attributes .exclusive ]
182+ if len (exclusives ) > 1 :
183+ raise AttributeError (
184+ f"Provide only one of these attributes: { ', ' .join (exclusives )} "
185+ )
186+ if not exclusives :
187+ raise AttributeError (
188+ "Must provide one of these attributes: %(attrs)s"
189+ % {"attrs" : ", " .join (attributes .exclusive )}
190+ )
You can’t perform that action at this time.
0 commit comments