Hi Benoit,
Benoit Thiell:
> Here is a breakdown of the number of orphan functions per module:
>
> [...]
> bibformat 60
> webjournal 39
> websubmit 172
> [...]
These modules (and maybe others) expose functions which are called
through some unconventional means. For eg. BibFormat elements must
define the "format(..)" function, which is called via the built-in
"apply()" function (ditto for "escape_values(..)" in BibFormat
elements).
I did not look at the detailed list of unused functions, but some
other possible false positives that could be filtered out of your
list:
- Functions that are called by the runtime environment, such as
"__init__", "__str__" or "__repr__".
- Helper functions that went into the Invenio source code, but which
are only used by local, custom implementations. For eg.
urlutils.create_AWS_request_url(), which might facilitate access
to Amazon Web Service (typically used in custom BibFormat elements)
- Usage of "first-class functions" capabilities of Python:
def foo():
return "foo"
def bar(fct):
return fct()
print bar(foo)
# foo does not seem to be called.
- other cases of unconventional function calls, plugins that must
implement an interface, etc.
But you are right, it is always good to do some code cleaning :-)
Note that PyChecker can also (try to) find unused functions/modules
and unreachable code.
Best regards
--
Jerome Caffaro