Commit e1b63d97 authored by Klaus Wölfel's avatar Klaus Wölfel Committed by Klaus Wölfel

Allow pandas and access of ndarray/ZBigArray in restricted python

/reviewed-on nexedi/wendelin!19
parent 6b0ba0f6
Pipeline #1216 skipped
...@@ -44,3 +44,22 @@ for dtype in ('int8', 'int16', 'int32', 'int64', \ ...@@ -44,3 +44,22 @@ for dtype in ('int8', 'int16', 'int32', 'int64', \
allow_module('sklearn') allow_module('sklearn')
allow_module('scipy') allow_module('scipy')
allow_module('wendelin.bigarray.array_zodb')
allow_module('pandas')
allow_type(np.timedelta64)
allow_type(type(np.c_))
import pandas as pd
allow_type(pd.Series)
allow_type(pd.DatetimeIndex)
allow_type(pd.DataFrame)
# Modify 'safetype' dict in full_write_guard function
# of RestrictedPython (closure) directly To allow
# write access to ndarray and ZBigArray objects
from RestrictedPython.Guards import full_write_guard
full_write_guard.func_closure[1].cell_contents.__self__[np.ndarray] = True
from wendelin.bigarray.array_zodb import ZBigArray
full_write_guard.func_closure[1].cell_contents.__self__[ZBigArray] = True
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment