Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Gaudi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rosen Matev
Gaudi
Commits
c13ee360
Commit
c13ee360
authored
7 years ago
by
Marco Clemencic
Browse files
Options
Downloads
Patches
Plain Diff
Prevent property deprecation warnings when unpickling options
parent
73640ae4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GaudiKernel/python/GaudiKernel/Configurable.py
+17
-4
17 additions, 4 deletions
GaudiKernel/python/GaudiKernel/Configurable.py
GaudiKernel/python/GaudiKernel/PropertyProxy.py
+1
-1
1 addition, 1 deletion
GaudiKernel/python/GaudiKernel/PropertyProxy.py
with
18 additions
and
5 deletions
GaudiKernel/python/GaudiKernel/Configurable.py
+
17
−
4
View file @
c13ee360
...
...
@@ -127,7 +127,8 @@ class Configurable(object):
'
_name
'
,
# the (unqualified) component name
'
_inSetDefaults
'
,
# currently setting default values
'
_initok
'
,
# used to enforce base class init
'
_setupok
'
# for debugging purposes (temporary)
'
_setupok
'
,
# for debugging purposes (temporary)
'
_unpickling
'
,
# flag for actions done during unpickling
)
allConfigurables
=
{}
# just names would do, but currently refs to the actual
...
...
@@ -327,6 +328,9 @@ class Configurable(object):
# for debugging purposes (temporary)
self
.
_setupok
=
False
# used to prevent spurious deprecation warnings when unpickling
self
.
_unpickling
=
False
# pickle support
def
__getstate__
(
self
):
dict
=
{}
...
...
@@ -346,9 +350,18 @@ class Configurable(object):
def
__setstate__
(
self
,
dict
):
self
.
_initok
=
True
for
n
,
v
in
dict
.
items
():
setattr
(
self
,
n
,
v
)
return
from
contextlib
import
contextmanager
@contextmanager
def
unpickling
():
try
:
self
.
_unpickling
=
True
yield
finally
:
self
.
_unpickling
=
False
with
unpickling
():
for
n
,
v
in
dict
.
items
():
setattr
(
self
,
n
,
v
)
# to allow a few basic sanity checks, as well as nice syntax
def
__len__
(
self
):
...
...
This diff is collapsed.
Click to expand it.
GaudiKernel/python/GaudiKernel/PropertyProxy.py
+
1
−
1
View file @
c13ee360
...
...
@@ -105,7 +105,7 @@ class PropertyProxy(object):
def
__set__
(
self
,
obj
,
value
):
# check if deprecated
if
self
.
deprecated
:
if
self
.
deprecated
and
not
obj
.
_unpickling
:
log
.
warning
(
'
Property %s is deprecated: %s
'
,
self
.
fullPropertyName
(
obj
),
self
.
__doc__
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment