@@ -152,11 +152,10 @@ def __init__(self, columns_or_json, fid=None):
152
152
if fid is None :
153
153
raise exceptions .PlotlyError (
154
154
"If you are manually converting a raw json/dict grid "
155
- "into a Grid instance, you must ensure that make "
156
- "'fid' is set to your file ID. This looks like "
157
- "'username:187'."
155
+ "into a Grid instance, you must ensure that 'fid' is "
156
+ "set to your file ID. This looks like 'username:187'."
158
157
)
159
- # TODO: verify that fid is a correct fid if a string
158
+
160
159
self .id = fid
161
160
162
161
# check if 'cols' is a root key
@@ -195,7 +194,7 @@ def __init__(self, columns_or_json, fid=None):
195
194
)
196
195
self ._columns = ordered_columns
197
196
198
- # fill in uids
197
+ # fill in column_ids
199
198
for column in self :
200
199
column .id = self .id + ':' + columns_or_json ['cols' ][column .name ]['uid' ]
201
200
@@ -262,19 +261,18 @@ def get_column_reference(self, column_name):
262
261
Raises an error if the column name is not in the grid. Otherwise,
263
262
returns the fid:uid pair, which may be the empty string.
264
263
"""
265
- col_names = []
266
- for column in self ._columns :
267
- col_names .append (column .name )
268
-
269
264
column_id = None
270
265
for column in self ._columns :
271
266
if column .name == column_name :
272
267
column_id = column .id
273
268
break
274
269
275
270
if column_id is None :
271
+ col_names = []
272
+ for column in self ._columns :
273
+ col_names .append (column .name )
276
274
raise exceptions .PlotlyError (
277
275
"Whoops, that column name doesn't match any of the column "
278
- "names in your grid. You must pick from {cols}" .format (col_names )
276
+ "names in your grid. You must pick from {cols}" .format (cols = col_names )
279
277
)
280
278
return column_id
0 commit comments