Skip to content

Commit 0bd43fd

Browse files
committed
Python 2.6 needs numbers in ‘{}’, e.g., ‘{0}’
1 parent a3de6c6 commit 0bd43fd

File tree

4 files changed

+31
-23
lines changed

4 files changed

+31
-23
lines changed

plotly/graph_objs/graph_objs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ def _assign_id_to_src(self, src_name, src_value):
329329
try:
330330
src_id = src_value.id
331331
except:
332-
err = ("{} does not have an `id` property. "
333-
"{} needs to be assigned to either an "
332+
err = ("{0} does not have an `id` property. "
333+
"{1} needs to be assigned to either an "
334334
"object with an `id` (like a "
335335
"plotly.grid_objs.Column) or a string. "
336336
"The `id` is a unique identifier "

plotly/plotly/plotly.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ def _fill_in_response_column_ids(cls, request_columns,
701701
for req_col in request_columns:
702702
for resp_col in response_columns:
703703
if resp_col['name'] == req_col.name:
704-
req_col.id = '{}/{}'.format(grid_id, resp_col['uid'])
704+
req_col.id = '{0}/{1}'.format(grid_id, resp_col['uid'])
705705
response_columns.remove(resp_col)
706706

707707
@classmethod
@@ -751,7 +751,7 @@ def upload(cls, grid, filename,
751751
grid.id = grid_id
752752

753753
plotly_domain = get_config()['plotly_domain']
754-
grid_url = '{}/~{}'.format(plotly_domain, grid_id.replace(':', '/'))
754+
grid_url = '{0}/~{1}'.format(plotly_domain, grid_id.replace(':', '/'))
755755

756756
if meta is not None:
757757
meta_ops.upload(meta, grid=grid)
@@ -800,8 +800,8 @@ def append_rows(cls, rows, grid=None, grid_url=None):
800800
raise exceptions.InputError(
801801
"The number of entries in "
802802
"each row needs to equal the number of columns in "
803-
"the grid. Row {} has {} {} but your "
804-
"grid has {} {}. "
803+
"the grid. Row {0} has {1} {2} but your "
804+
"grid has {3} {4}. "
805805
.format(row_i, len(row),
806806
'entry' if len(row) == 1 else 'entries',
807807
n_columns,
@@ -896,7 +896,7 @@ def parse_grid_id_args(cls, grid, grid_url):
896896
if supplied_arg_name == 'grid_url':
897897
path = urlparse(grid_url).path
898898
file_owner, file_id = path.replace("/~", "").split('/')[0:2]
899-
return '{}:{}'.format(file_owner, file_id)
899+
return '{0}:{1}'.format(file_owner, file_id)
900900
else:
901901
return grid.id
902902

@@ -922,19 +922,19 @@ def response_handler(cls, response):
922922

923923
@classmethod
924924
def api_url(cls, resource):
925-
return ('{}/v2/{}'.format(get_config()['plotly_api_domain'],
925+
return ('{0}/v2/{1}'.format(get_config()['plotly_api_domain'],
926926
resource))
927927

928928
@classmethod
929929
def headers(cls):
930930
un, api_key = _get_session_username_and_key()
931931
encoded_un_key_pair = base64.b64encode(
932-
six.b('{}:{}'.format(un, api_key))
932+
six.b('{0}:{1}'.format(un, api_key))
933933
).decode('utf8')
934934

935935
return {
936936
'authorization': 'Basic ' + encoded_un_key_pair,
937-
'plotly-client-platform': 'python {}'.format(version.__version__)
937+
'plotly-client-platform': 'python {0}'.format(version.__version__)
938938
}
939939

940940

plotly/tests/test_core/test_grid/test_grid.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ def test_grid_upload():
5555
@with_setup(init)
5656
def test_grid_upload_in_new_folder():
5757
g = get_grid()
58-
path = 'new folder: {}/grid in folder {}'.format(random_filename(), random_filename())
58+
path = (
59+
'new folder: {0}/grid in folder {1}'
60+
.format(random_filename(), random_filename())
61+
)
5962
py.grid_ops.upload(g, path, auto_open=False)
6063

6164

@@ -65,7 +68,10 @@ def test_grid_upload_in_existing_folder():
6568
folder = random_filename()
6669
filename = random_filename()
6770
py.file_ops.mkdirs(folder)
68-
path = 'existing folder: {}/grid in folder {}'.format(folder, filename)
71+
path =(
72+
'existing folder: {0}/grid in folder {1}'
73+
.format(folder, filename)
74+
)
6975
py.grid_ops.upload(g, path, auto_open=False)
7076

7177

plotly/tests/utils.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,30 @@
44
def compare_dict(dict1, dict2, equivalent=True, msg='', tol=10e-8):
55
for key in dict1:
66
if key not in dict2:
7-
return False, "{} should be {}".format(list(dict1.keys()), list(dict2.keys()))
7+
return (False,
8+
"{0} should be {1}".format(
9+
list(dict1.keys()), list(dict2.keys())))
810
for key in dict1:
911
if isinstance(dict1[key], dict):
1012
equivalent, msg = compare_dict(dict1[key],
1113
dict2[key],
1214
tol=tol)
1315
elif isinstance(dict1[key], Num) and isinstance(dict2[key], Num):
1416
if not comp_nums(dict1[key], dict2[key], tol):
15-
return False, "['{}'] = {} should be {}".format(key,
16-
dict1[key],
17-
dict2[key])
17+
return False, "['{0}'] = {1} should be {2}".format(key,
18+
dict1[key],
19+
dict2[key])
1820
elif is_num_list(dict1[key]) and is_num_list(dict2[key]):
1921
if not comp_num_list(dict1[key], dict2[key], tol):
20-
return False, "['{}'] = {} should be {}".format(key,
21-
dict1[key],
22-
dict2[key])
22+
return False, "['{0}'] = {1} should be {2}".format(key,
23+
dict1[key],
24+
dict2[key])
2325
elif not (dict1[key] == dict2[key]):
24-
return False, "['{}'] = {} should be {}".format(key,
25-
dict1[key],
26-
dict2[key])
26+
return False, "['{0}'] = {1} should be {2}".format(key,
27+
dict1[key],
28+
dict2[key])
2729
if not equivalent:
28-
return False, "['{}']".format(key) + msg
30+
return False, "['{0}']".format(key) + msg
2931
return equivalent, msg
3032

3133

0 commit comments

Comments
 (0)