Coverage for python / lsst / source / injection / bin / show_source_types.py: 50%

12 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-22 09:34 +0000

1# This file is part of source_injection. 

2# 

3# Developed for the LSST Data Management System. 

4# This product includes software developed by the LSST Project 

5# (https://www.lsst.org). 

6# See the COPYRIGHT file at the top-level directory of this distribution 

7# for details of code ownership. 

8# 

9# This program is free software: you can redistribute it and/or modify 

10# it under the terms of the GNU General Public License as published by 

11# the Free Software Foundation, either version 3 of the License, or 

12# (at your option) any later version. 

13# 

14# This program is distributed in the hope that it will be useful, 

15# but WITHOUT ANY WARRANTY; without even the implied warranty of 

16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

17# GNU General Public License for more details. 

18# 

19# You should have received a copy of the GNU General Public License 

20# along with this program. If not, see <https://www.gnu.org/licenses/>. 

21 

22from __future__ import annotations 

23 

24from argparse import SUPPRESS, ArgumentParser 

25 

26from ..utils import show_source_types 

27from .source_injection_help_formatter import SourceInjectionHelpFormatter 

28 

29 

30def build_argparser(): 

31 """Build an argument parser for this script.""" 

32 parser = ArgumentParser( 

33 description="""Show available source injection types. 

34 

35This shows all available source types that can be used with the source 

36injection package, along with their constructor signatures. 

37""", 

38 formatter_class=SourceInjectionHelpFormatter, 

39 epilog="More information is available at https://pipelines.lsst.io.", 

40 add_help=False, 

41 argument_default=SUPPRESS, 

42 ) 

43 parser.add_argument( 

44 "-w", 

45 "--wrap-width", 

46 help="Width to wrap the signature text.", 

47 default=None, 

48 ) 

49 parser.add_argument( 

50 "-h", 

51 "--help", 

52 action="help", 

53 help="Show this help message and exit.", 

54 ) 

55 return parser 

56 

57 

58def main(): 

59 """Use this as the main entry point when calling from the command line.""" 

60 args = build_argparser().parse_args() 

61 show_source_types(wrap_width=args.wrap_width)