Skip to content

Commit 0f27d78

Browse files
authored
Merge pull request #561 from plotly/ordered-byteify
use OrderedDict in byteify
2 parents c9b392d + 51e23c1 commit 0f27d78

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

dash/development/_r_components_generation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
)
2626
2727
component$props <- filter_null(component$props)
28-
29-
structure(component, class = c('dash_component', 'list'))
28+
29+
structure(component, class = c('dash_component', 'list'))
3030
}}''' # noqa:E501
3131

3232
# the following strings represent all the elements in an object

dash/development/component_generator.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,13 @@ def cli():
146146
# pylint: disable=undefined-variable
147147
def byteify(input_object):
148148
if isinstance(input_object, dict):
149-
return {byteify(key): byteify(value)
150-
for key, value in input_object.iteritems()}
149+
return OrderedDict([
150+
(byteify(key), byteify(value))
151+
for key, value in input_object.iteritems()
152+
])
151153
elif isinstance(input_object, list):
152154
return [byteify(element) for element in input_object]
153-
elif isinstance(input_object, unicode): # noqa:F821
155+
elif isinstance(input_object, unicode): # noqa:F821
154156
return input_object.encode('utf-8')
155157
return input_object
156158

tests/development/test_base_component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def test_set_item_with_nested_children(self):
280280

281281
c3b = Component(id='3')
282282
self.assertEqual(c5['3'], c3)
283-
self.assertTrue(c5['3'] is not '3')
283+
self.assertTrue(c5['3'] != '3')
284284
self.assertTrue(c5['3'] is not c3b)
285285

286286
c5['3'] = c3b

0 commit comments

Comments
 (0)