Skip to content

Commit

Permalink
Update vectorized to property handle strings
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebBell committed Mar 21, 2018
1 parent c4ea9b8 commit c1fd713
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions fluids/vectorized.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from __future__ import division
import types
import numpy as np
import fluids
import fluids as normal_fluids

'''Basic module which wraps all fluids functions with numpy's vectorize.
All other object - dicts, classes, etc - are not wrapped. Supports star
Expand Down Expand Up @@ -53,15 +53,19 @@

__funcs = {}

for name in dir(fluids):
obj = getattr(fluids, name)
bad_names = set(('__file__', '__name__', '__package__', '__cached__'))

for name in dir(normal_fluids):
obj = getattr(normal_fluids, name)
if isinstance(obj, types.FunctionType):
obj = np.vectorize(obj)
elif isinstance(obj, str):
continue
if name in bad_names:
continue
__all__.append(name)
__funcs.update({name: obj})
# globals()[name] = obj

globals().update(__funcs)


Expand Down

0 comments on commit c1fd713

Please sign in to comment.