@@ -152,11 +152,10 @@ def __init__(self, columns_or_json, fid=None):
152152 if fid is None :
153153 raise exceptions .PlotlyError (
154154 "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'."
158157 )
159- # TODO: verify that fid is a correct fid if a string
158+
160159 self .id = fid
161160
162161 # check if 'cols' is a root key
@@ -195,7 +194,7 @@ def __init__(self, columns_or_json, fid=None):
195194 )
196195 self ._columns = ordered_columns
197196
198- # fill in uids
197+ # fill in column_ids
199198 for column in self :
200199 column .id = self .id + ':' + columns_or_json ['cols' ][column .name ]['uid' ]
201200
@@ -262,19 +261,18 @@ def get_column_reference(self, column_name):
262261 Raises an error if the column name is not in the grid. Otherwise,
263262 returns the fid:uid pair, which may be the empty string.
264263 """
265- col_names = []
266- for column in self ._columns :
267- col_names .append (column .name )
268-
269264 column_id = None
270265 for column in self ._columns :
271266 if column .name == column_name :
272267 column_id = column .id
273268 break
274269
275270 if column_id is None :
271+ col_names = []
272+ for column in self ._columns :
273+ col_names .append (column .name )
276274 raise exceptions .PlotlyError (
277275 "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 )
279277 )
280278 return column_id
0 commit comments