Changeset 9a1204d in sasview for src/sas/sascalc/fit


Ignore:
Timestamp:
Mar 11, 2019 12:02:40 PM (6 years ago)
Author:
GitHub <noreply@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1242-2d-resolution, ticket-1249
Children:
31c1bae, 09d7021, 1342f6a
Parents:
f205d3a (diff), 3c680c1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Paul Kienzle <pkienzle@…> (03/11/19 12:02:40)
git-committer:
GitHub <noreply@…> (03/11/19 12:02:40)
Message:

Merge pull request #208 from SasView?/py37-sascalc

fix doc build error on jenkins mac

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/fit/expression.py

    re090ba90 r3c680c1  
    188188 
    189189    # Initialize dictionary with available functions 
    190     globals = {} 
    191     globals.update(math.__dict__) 
    192     globals.update(dict(arcsin=math.asin,arccos=math.acos, 
    193                         arctan=math.atan,arctan2=math.atan2)) 
    194     globals.update(context) 
    195     globals.update(parameters) 
    196     globals['id'] = id 
    197     locals = {} 
     190    global_context = {} 
     191    global_context.update(math.__dict__) 
     192    global_context.update(dict(arcsin=math.asin,arccos=math.acos, 
     193                               arctan=math.atan,arctan2=math.atan2)) 
     194    global_context.update(context) 
     195    global_context.update(parameters) 
     196    global_context['id'] = id 
     197    local_context = {} 
    198198 
    199199    # Define the constraints function 
     
    210210 
    211211    #print("Function: "+functiondef) 
    212     exec(functiondef, globals, locals) 
    213     retfn = locals['eval_expressions'] 
     212    # CRUFT: python < 3.0;  doc builder isn't allowing the following exec 
     213    # https://stackoverflow.com/questions/4484872/why-doesnt-exec-work-in-a-function-with-a-subfunction/41368813#comment73790496_41368813 
     214    #exec(functiondef, global_context, local_context) 
     215    eval(compile(functiondef, '<string>', 'exec'), global_context, local_context) 
     216    retfn = local_context['eval_expressions'] 
    214217 
    215218    # Remove garbage added to globals by exec 
    216     globals.pop('__doc__',None) 
    217     globals.pop('__name__',None) 
    218     globals.pop('__file__',None) 
    219     globals.pop('__builtins__') 
     219    global_context.pop('__doc__', None) 
     220    global_context.pop('__name__', None) 
     221    global_context.pop('__file__', None) 
     222    global_context.pop('__builtins__') 
    220223    #print globals.keys() 
    221224 
     
    232235 
    233236    # Break pairs into left set and right set 
    234     left,right = [set(s) for s in zip(*pairs)] if pairs != [] else ([],[]) 
    235     while pairs != []: 
     237    # Note: pairs is array or list, so use "len(pairs) > 0" to check for empty. 
     238    left,right = [set(s) for s in zip(*pairs)] if len(pairs) > 0 else ([],[]) 
     239    while len(pairs) > 0: 
    236240        #print "within",pairs 
    237241        # Find which items only occur on the right 
     
    261265    satisfies the partial ordering given by the pairs in partial order. 
    262266    """ 
    263     left,right = zip(*pairs) if pairs != [] else ([],[]) 
     267    # Note: pairs is array or list, so use "len(pairs) > 0" to check for empty. 
     268    left,right = zip(*pairs) if len(pairs) > 0 else ([],[]) 
    264269    items = set(left) 
    265270    n = order_dependencies(pairs) 
Note: See TracChangeset for help on using the changeset viewer.