##// END OF EJS Templates
Delete unused custom serializer
Jason Grout -
Show More
@@ -4,9 +4,8 b''
4 define([
4 define([
5 "base/js/utils"
5 "base/js/utils"
6 ], function(utils){
6 ], function(utils){
7
8 return {
7 return {
9 widget_serialization: {
8 models: {
10 deserialize: function deserialize_models(value, model) {
9 deserialize: function deserialize_models(value, model) {
11 /**
10 /**
12 * Replace model ids with models recursively.
11 * Replace model ids with models recursively.
@@ -32,19 +31,5 b' define(['
32 }
31 }
33 },
32 },
34 },
33 },
35
36 list_of_numbers: {
37 deserialize: function (value, model) {
38 /* value is a DataView */
39 /* create a float64 typed array */
40 return new Float64Array(value.buffer)
41 },
42 serialize: function (value, model) {
43 return value;
44 },
45 }
46 }
34 }
47
48
49
50 });
35 });
@@ -111,25 +111,9 b' def _json_to_widget(x):'
111
111
112 widget_serialization = {
112 widget_serialization = {
113 'from_json': _json_to_widget,
113 'from_json': _json_to_widget,
114 'to_json': lambda x: (_widget_to_json(x), {'serialization': ('widget_serialization', 'widgets/js/types')})
114 'to_json': lambda x: (_widget_to_json(x), {'serialization': ('models', 'widgets/js/types')})
115 }
115 }
116
116
117 def _to_binary_list(x):
118 import numpy
119 return memoryview(numpy.array(x, dtype=float)), {'serialization': ('list_of_numbers', 'widgets/js/types')}
120
121 def _from_binary_list(x):
122 import numpy
123 a = numpy.frombuffer(x.tobytes(), dtype=float)
124 return list(a)
125
126 list_of_numbers = {
127 'from_json': _from_binary_list,
128 'to_json': _to_binary_list
129 }
130
131
132
133 class Widget(LoggingConfigurable):
117 class Widget(LoggingConfigurable):
134 #-------------------------------------------------------------------------
118 #-------------------------------------------------------------------------
135 # Class attributes
119 # Class attributes
General Comments 0
You need to be logged in to leave comments. Login now