Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.learn.activation
Commits
4301d8b7
Commit
4301d8b7
authored
May 20, 2015
by
Manuel Günther
Browse files
Based get_config on bob.extension
parent
2ed8772d
Changes
3
Hide whitespace changes
Inline
Side-by-side
bob/learn/activation/__init__.py
View file @
4301d8b7
...
...
@@ -13,22 +13,7 @@ from .version import api as __api_version__
def
get_config
():
"""Returns a string containing the configuration information.
"""
import
pkg_resources
from
.version
import
externals
packages
=
pkg_resources
.
require
(
__name__
)
this
=
packages
[
0
]
deps
=
packages
[
1
:]
retval
=
"%s: %s [api=0x%04x] (%s)
\n
"
%
(
this
.
key
,
this
.
version
,
version
.
api
,
this
.
location
)
retval
+=
" - c/c++ dependencies:
\n
"
for
k
in
sorted
(
externals
):
retval
+=
" - %s: %s
\n
"
%
(
k
,
externals
[
k
])
retval
+=
" - python dependencies:
\n
"
for
d
in
deps
:
retval
+=
" - %s: %s (%s)
\n
"
%
(
d
.
key
,
d
.
version
,
d
.
location
)
return
retval
.
strip
()
return
bob
.
extension
.
get_config
(
__name__
,
version
.
externals
,
version
.
api
)
# gets sphinx autodoc done right - don't remove it
__all__
=
[
_
for
_
in
dir
()
if
not
_
.
startswith
(
'_'
)]
bob/learn/activation/main.cpp
View file @
4301d8b7
...
...
@@ -65,10 +65,6 @@ static PyObject* create_module (void) {
if
(
!
m
)
return
0
;
auto
m_
=
make_safe
(
m
);
/* register some constants */
if
(
PyModule_AddIntConstant
(
m
,
"__api_version__"
,
BOB_LEARN_ACTIVATION_API_VERSION
)
<
0
)
return
0
;
if
(
PyModule_AddStringConstant
(
m
,
"__version__"
,
BOB_EXT_MODULE_VERSION
)
<
0
)
return
0
;
/* register the types to python */
Py_INCREF
(
&
PyBobLearnActivation_Type
);
if
(
PyModule_AddObject
(
m
,
"Activation"
,
(
PyObject
*
)
&
PyBobLearnActivation_Type
)
<
0
)
return
0
;
...
...
@@ -166,9 +162,7 @@ static PyObject* create_module (void) {
return
0
;
}
Py_INCREF
(
m
);
return
m
;
return
Py_BuildValue
(
"O"
,
m
);
}
PyMODINIT_FUNC
BOB_EXT_ENTRY_NAME
(
void
)
{
...
...
bob/learn/activation/version.cpp
View file @
4301d8b7
...
...
@@ -158,10 +158,8 @@ static PyObject* create_module (void) {
auto
m_
=
make_safe
(
m
);
///< protects against early returns
/* register version numbers and constants */
if
(
PyModule_AddIntConstant
(
m
,
"api"
,
BOB_LEARN_ACTIVATION_API_VERSION
)
<
0
)
return
0
;
if
(
PyModule_AddStringConstant
(
m
,
"module"
,
BOB_EXT_MODULE_VERSION
)
<
0
)
return
0
;
if
(
PyModule_AddIntConstant
(
m
,
"api"
,
BOB_LEARN_ACTIVATION_API_VERSION
)
<
0
)
return
0
;
if
(
PyModule_AddStringConstant
(
m
,
"module"
,
BOB_EXT_MODULE_VERSION
)
<
0
)
return
0
;
PyObject
*
externals
=
build_version_dictionary
();
if
(
!
externals
)
return
0
;
...
...
@@ -174,9 +172,7 @@ static PyObject* create_module (void) {
return
0
;
}
Py_INCREF
(
m
);
return
m
;
return
Py_BuildValue
(
"O"
,
m
);
}
PyMODINIT_FUNC
BOB_EXT_ENTRY_NAME
(
void
)
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment