Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Klaus Wölfel
wendelin
Commits
d8f55e8e
Commit
d8f55e8e
authored
Jul 20, 2018
by
Klaus Wölfel
Committed by
Eteri
Jan 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow more numpy and pandas in sandbox
parent
8faabcbd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
product/Wendelin/__init__.py
product/Wendelin/__init__.py
+20
-2
No files found.
product/Wendelin/__init__.py
View file @
d8f55e8e
...
...
@@ -29,7 +29,7 @@
Wendelin is a product containing general purpose tools to handle big
data manipulations.
"""
from
AccessControl
import
allow_module
,
allow_type
from
AccessControl
import
allow_module
,
allow_type
,
allow_class
# we neeed to allow access to numpy's internal types
import
numpy
as
np
...
...
@@ -37,10 +37,21 @@ allow_module('numpy')
for
dtype
in
(
'int8'
,
'int16'
,
'int32'
,
'int64'
,
\
'uint8'
,
'uint16'
,
'uint32'
,
'uint64'
,
\
'float16'
,
'float32'
,
'float64'
,
\
'complex64'
,
'complex128'
,
):
'complex64'
,
'complex128'
):
z
=
np
.
array
([
0
,],
dtype
=
dtype
)
allow_type
(
type
(
z
[
0
]))
allow_type
(
type
(
z
))
sz
=
np
.
array
([(
0
,)],
dtype
=
[(
'f0'
,
dtype
)])
allow_type
(
type
(
sz
[
0
]))
allow_type
(
type
(
sz
))
rz
=
np
.
rec
.
array
(
np
.
array
([(
0
,)],
dtype
=
[(
'f0'
,
dtype
)]))
allow_type
(
type
(
rz
[
0
]))
allow_type
(
type
(
rz
))
sz
=
np
.
array
([(
'2017-07-12T12:30:20'
,)],
dtype
=
[(
'date'
,
'M8[s]'
)])
allow_type
(
type
(
sz
[
0
][
'date'
]))
allow_module
(
'sklearn'
)
allow_module
(
'scipy'
)
...
...
@@ -53,13 +64,20 @@ allow_type(type(np.c_))
import
pandas
as
pd
allow_type
(
pd
.
Series
)
allow_type
(
pd
.
Timestamp
)
allow_type
(
pd
.
DatetimeIndex
)
allow_type
(
pd
.
DataFrame
)
allow_class
(
pd
.
DataFrame
)
allow_class
(
pd
.
core
.
groupby
.
DataFrameGroupBy
)
# 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
full_write_guard
.
func_closure
[
1
].
cell_contents
.
__self__
[
np
.
core
.
records
.
recarray
]
=
True
from
wendelin.bigarray.array_zodb
import
ZBigArray
full_write_guard
.
func_closure
[
1
].
cell_contents
.
__self__
[
ZBigArray
]
=
True
allow_type
(
ZBigArray
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment