Changeset 4333edf in sasview


Ignore:
Timestamp:
Jan 22, 2019 5:17:52 AM (6 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_sync_sascalc
Children:
fcd5d57
Parents:
1d6899f
Message:

Deal with pesky warnings about functions not being properly serialized.
They are now, although they are pretty redundant for Data1D/Data2D
structures.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Utilities/GuiUtils.py

    r8db20a9 r4333edf  
    1212import urllib.parse 
    1313import json 
     14import types 
    1415from io import BytesIO 
    1516 
     
    12221223            return add_type(content, type(o)) 
    12231224 
     1225        if isinstance(o, types.FunctionType): 
     1226            # we have a pure function 
     1227            content = o.__dict__.copy() 
     1228            return add_type(content, type(o)) 
     1229 
    12241230        # not supported 
    12251231        logging.info("data cannot be serialized to json: %s" % type(o)) 
     
    12341240    ''' 
    12351241    supported = [ 
    1236         tuple, set, 
     1242        tuple, set, types.FunctionType, 
    12371243        Sample, Source, Vector, 
    12381244        Plottable, Data1D, Data2D, PlottableTheory1D, PlottableFit1D, Text, Chisq, View, 
     
    12891295            buffer.seek(0) 
    12901296            return np.load(buffer) 
     1297 
     1298        # function 
     1299        if cls == types.FunctionType: 
     1300            return cls 
    12911301 
    12921302        logging.info('not implemented: %s, %s' % (type, cls)) 
Note: See TracChangeset for help on using the changeset viewer.