Revision 6e3d7490eb12e6c258b19bbd4a281c96090cef08 authored by Tito Dal Canton on 03 February 2023, 16:04:28 UTC, committed by GitHub on 03 February 2023, 16:04:28 UTC
* Update GitHub actions to fix Node.js 16 warning * Update distribution.yml --------- Co-authored-by: Alex Nitz <alex.nitz@gmail.com>
1 parent f2e2bff
inference_io_inheritance_diagrams.py
# Creates RST for the sampler inheritance diagrams
import inspect
from pycbc.inference.io import filetypes
fname = 'inference_io_inheritance_diagrams.rst'
def get_topclasses(cls):
"""Gets the base classes that are in pycbc."""
bases = [c for c in inspect.getmro(cls)
if c.__module__.startswith('pycbc') and c != cls]
return ', '.join(['{}.{}'.format(c.__module__, c.__name__) for c in bases])
tmplt = """.. _inheritance-io-{name}:
* ``{name}``:
.. inheritance-diagram:: {module}.{clsname}
:parts: 3
:top-classes: pycbc.inference.io.base_hdf.BaseInferenceFile
|
"""
fp = open(fname, 'w')
for ftname, cls in sorted(filetypes.items()):
# get the parents
topclasses = get_topclasses(cls)
out = tmplt.format(name=ftname, clsname=cls.__name__,
module=cls.__module__)
print(out, file=fp)
fp.close()
Computing file changes ...