Coverage for moptipy / utils / help.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2025-11-24 08:49 +0000

1"""Print a help screen.""" 

2 

3 

4import argparse 

5 

6from pycommons.io.arguments import make_argparser, make_epilog 

7 

8from moptipy.version import __version__ 

9 

10 

11def moptipy_argparser(file: str, description: str, 

12 epilog: str) -> argparse.ArgumentParser: 

13 """ 

14 Create an argument parser with default settings. 

15 

16 :param file: the `__file__` special variable of the calling script 

17 :param description: the description string 

18 :param epilog: the epilogue string 

19 :returns: the argument parser 

20 

21 >>> ap = moptipy_argparser( 

22 ... __file__, "This is a test program.", "This is a test.") 

23 >>> isinstance(ap, argparse.ArgumentParser) 

24 True 

25 >>> "Copyright" in ap.epilog 

26 True 

27 """ 

28 return make_argparser( 

29 file, description, 

30 make_epilog(epilog, 2022, 2024, "Thomas Weise", 

31 url="https://thomasweise.github.io/moptipy", 

32 email="tweise@hfuu.edu.cn, tweise@ustc.edu.cn"), 

33 __version__)