Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
9a2bacfd
Commit
9a2bacfd
authored
Apr 03, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patches/Restricted: update for numpy 1.22.0 and pandas 1.4.0 on PY3
parent
a1a499a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
product/ERP5Type/patches/Restricted.py
product/ERP5Type/patches/Restricted.py
+15
-8
No files found.
product/ERP5Type/patches/Restricted.py
View file @
9a2bacfd
...
...
@@ -450,6 +450,9 @@ except ImportError:
import_default_level
=
-
1
def
guarded_import
(
mname
,
globals
=
None
,
locals
=
None
,
fromlist
=
None
,
level
=
import_default_level
):
# XXX workaround C-code calling PyImport_Import
if
mname
in
(
'numpy.core._dtype'
,):
return
__import__
(
mname
,
globals
,
locals
,
fromlist
)
for
fromname
in
fromlist
or
():
if
fromname
[:
1
]
==
'_'
:
raise
Unauthorized
(
fromname
)
...
...
@@ -512,6 +515,7 @@ for dtype in ('int8', 'int16', 'int32', 'int64', \
'uint8'
,
'uint16'
,
'uint32'
,
'uint64'
,
\
'float16'
,
'float32'
,
'float64'
,
\
'complex64'
,
'complex128'
):
allow_type
(
type
(
np
.
dtype
(
dtype
)))
z
=
np
.
array
([
0
,],
dtype
=
dtype
)
allow_type
(
type
(
z
[
0
]))
allow_type
(
type
(
z
))
...
...
@@ -524,12 +528,9 @@ for dtype in ('int8', 'int16', 'int32', 'int64', \
allow_type
(
type
(
rz
[
0
]))
allow_type
(
type
(
rz
))
# TODO zope4py3
#allow_type(np.dtype)
allow_type
(
np
.
dtype
)
allow_type
(
np
.
timedelta64
)
allow_type
(
type
(
np
.
c_
))
# TODO zope4py3
#allow_type(type(np.dtype('int16')))
sz
=
np
.
array
([(
'2017-07-12T12:30:20'
,)],
dtype
=
[(
'date'
,
'M8[s]'
)])
allow_type
(
type
(
sz
[
0
][
'date'
]))
...
...
@@ -576,20 +577,26 @@ else:
allow_class
(
pd
.
DataFrame
)
# Note: These black_list methods are for pandas 0.19.2
# Note: These black_list methods are for pandas 0.19.2
on PY2 and 1.4.0 on PY3
series_black_list
=
(
'to_csv'
,
'to_json'
,
'to_pickle'
,
'to_hdf'
,
'to_sql'
,
'to_msgpack'
)
'to_sql'
,)
if
six
.
PY2
:
series_black_list
+=
(
'to_msgpack'
,
)
ContainerAssertions
[
pd
.
Series
]
=
_check_access_wrapper
(
pd
.
Series
,
dict
.
fromkeys
(
series_black_list
,
restrictedMethod
))
pandas_black_list
=
(
'read_pickle'
,
'read_hdf'
,
'read_excel'
,
'read_html'
,
'read_msgpack'
,
'read_excel'
,
'read_html'
,
'read_gbq'
,
'read_sas'
,
'read_stata'
)
if
six
.
PY2
:
pandas_black_list
+=
(
'read_msgpack'
,
)
ModuleSecurityInfo
(
MNAME_MAP
[
'pandas'
]).
declarePrivate
(
*
pandas_black_list
)
dataframe_black_list
=
(
'to_csv'
,
'to_json'
,
'to_pickle'
,
'to_hdf'
,
'to_excel'
,
'to_html'
,
'to_sql'
,
'to_msgpack'
,
'to_excel'
,
'to_html'
,
'to_sql'
,
'to_latex'
,
'to_gbq'
,
'to_stata'
)
if
six
.
PY2
:
dataframe_black_list
+=
(
'to_msgpack'
,
)
ContainerAssertions
[
pd
.
DataFrame
]
=
_check_access_wrapper
(
pd
.
DataFrame
,
dict
.
fromkeys
(
dataframe_black_list
,
restrictedMethod
))
...
...
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