@@ -101,7 +101,8 @@ def __str__(self):
101101
102102
103103class PlotlyDictKeyError (PlotlyGraphObjectError ):
104- def __init__ (self , obj = '' , key = '' , ** kwargs ):
104+ def __init__ (self , obj , path = (), ** kwargs ):
105+ key = path [- 1 ]
105106 message = (
106107 "Invalid key, '{key}', for class, '{obj_name}'.\n \n Run "
107108 "'help(plotly.graph_objs.{obj_name})' for more information."
@@ -110,13 +111,14 @@ def __init__(self, obj='', key='', **kwargs):
110111 plain_message = ("Invalid key, '{key}', found in '{obj}' object"
111112 "" .format (key = key , obj = obj .__class__ .__name__ ))
112113 super (PlotlyDictKeyError , self ).__init__ (message = message ,
113- path = [ key ] ,
114+ path = path ,
114115 plain_message = plain_message ,
115116 ** kwargs )
116117
117118
118119class PlotlyDictValueError (PlotlyGraphObjectError ):
119- def __init__ (self , obj = '' , key = '' , value = '' , val_types = '' , ** kwargs ):
120+ def __init__ (self , obj , value , val_types , path = (), ** kwargs ):
121+ key = path [- 1 ]
120122 message = (
121123 "Invalid value type, '{value_name}', associated with key, "
122124 "'{key}', for class, '{obj_name}'.\n Valid types for this key "
@@ -130,12 +132,13 @@ def __init__(self, obj='', key='', value='', val_types='', **kwargs):
130132 "'{key}'" .format (key = key , obj = obj .__class__ .__name__ ))
131133 super (PlotlyDictValueError , self ).__init__ (message = message ,
132134 plain_message = plain_message ,
133- path = [ key ] ,
135+ path = path ,
134136 ** kwargs )
135137
136138
137139class PlotlyListEntryError (PlotlyGraphObjectError ):
138- def __init__ (self , obj = '' , index = '' , entry = '' , ** kwargs ):
140+ def __init__ (self , obj , path = (), ** kwargs ):
141+ index = path [- 1 ]
139142 message = (
140143 "The entry at index, '{0}', is invalid in a '{1}' object"
141144 "" .format (index , obj .__class__ .__name__ )
@@ -146,12 +149,13 @@ def __init__(self, obj='', index='', entry='', **kwargs):
146149 )
147150 super (PlotlyListEntryError , self ).__init__ (message = message ,
148151 plain_message = plain_message ,
149- path = [ index ] ,
152+ path = path ,
150153 ** kwargs )
151154
152155
153156class PlotlyDataTypeError (PlotlyGraphObjectError ):
154- def __init__ (self , obj = '' , index = '' , ** kwargs ):
157+ def __init__ (self , obj , path = (), ** kwargs ):
158+ index = path [- 1 ]
155159 message = (
156160 "The entry at index, '{0}', is invalid because it does not "
157161 "contain a valid 'type' key-value. This is required for valid "
@@ -163,7 +167,7 @@ def __init__(self, obj='', index='', **kwargs):
163167 "lists." .format (index ))
164168 super (PlotlyDataTypeError , self ).__init__ (message = message ,
165169 plain_message = plain_message ,
166- path = [ index ] ,
170+ path = path ,
167171 ** kwargs )
168172
169173
0 commit comments