Mercurial > hg > orthanc-book
comparison Sphinx/source/plugins/python/inspect-api.py @ 703:a589668768d7
moving python samples in separate files (2)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 11 Jun 2021 10:07:12 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
702:6e02cd89eb6a | 703:a589668768d7 |
---|---|
1 import inspect | |
2 import numbers | |
3 import orthanc | |
4 | |
5 # Loop over the members of the "orthanc" module | |
6 for (name, obj) in inspect.getmembers(orthanc): | |
7 if inspect.isroutine(obj): | |
8 print('Function %s():\n Documentation: %s\n' % (name, inspect.getdoc(obj))) | |
9 | |
10 elif inspect.isclass(obj): | |
11 print('Class %s:\n Documentation: %s' % (name, inspect.getdoc(obj))) | |
12 | |
13 # Loop over the members of the class | |
14 for (subname, subobj) in inspect.getmembers(obj): | |
15 if isinstance(subobj, numbers.Number): | |
16 print(' - Enumeration value %s: %s' % (subname, subobj)) | |
17 elif (not subname.startswith('_') and | |
18 inspect.ismethoddescriptor(subobj)): | |
19 print(' - Method %s(): %s' % (subname, inspect.getdoc(subobj))) | |
20 print('') |