Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
pinocchio
Commits
cee2a3b5
Verified
Commit
cee2a3b5
authored
May 07, 2020
by
Justin Carpentier
Browse files
python/utils: add deprecation helpers
parent
23f8d5e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
bindings/python/utils/deprecation.hpp
0 → 100644
View file @
cee2a3b5
//
// Copyright (c) 2020 INRIA
//
#ifndef __pinocchio_python_utils_deprecation_hpp__
#define __pinocchio_python_utils_deprecation_hpp__
#include <Python.h>
#include <boost/python.hpp>
#include <string>
namespace
pinocchio
{
namespace
python
{
template
<
class
Policy
=
boost
::
python
::
default_call_policies
>
struct
deprecated_warning_policy
:
Policy
{
deprecated_warning_policy
(
const
std
::
string
&
warning_message
=
""
)
:
Policy
()
,
m_warning_message
(
warning_message
)
{}
template
<
class
ArgumentPackage
>
bool
precall
(
ArgumentPackage
const
&
args
)
const
{
PyErr_WarnEx
(
PyExc_UserWarning
,
m_warning_message
.
c_str
(),
1
);
return
static_cast
<
const
Policy
*>
(
this
)
->
precall
(
args
);
}
typedef
typename
Policy
::
result_converter
result_converter
;
typedef
typename
Policy
::
argument_package
argument_package
;
protected:
const
std
::
string
m_warning_message
;
};
template
<
class
Policy
=
boost
::
python
::
default_call_policies
>
struct
deprecated_member
:
deprecated_warning_policy
<
Policy
>
{
deprecated_member
(
const
std
::
string
&
warning_message
=
"This class member has been marked as deprecated and will be removed in a future release."
)
:
deprecated_warning_policy
<
Policy
>
(
warning_message
)
{}
};
template
<
class
Policy
=
boost
::
python
::
default_call_policies
>
struct
deprecated_function
:
deprecated_warning_policy
<
Policy
>
{
deprecated_function
(
const
std
::
string
&
warning_message
=
"This function has been marked as deprecated and will be removed in a future release."
)
:
deprecated_warning_policy
<
Policy
>
(
warning_message
)
{}
};
}
}
#endif // ifndef __pinocchio_python_utils_deprecation_hpp__
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