Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/click/ 84%

83 statements  

« prev     ^ index     » next v7.3.2, created at 2023-12-09 06:03 +0000


2Click is a simple Python module inspired by the stdlib optparse to make 

3writing command line scripts fun. Unlike other modules, it's based 

4around a simple API that does not come with too much magic and is 



7from __future__ import annotations 


9from .core import Argument as Argument 

10from .core import Command as Command 

11from .core import CommandCollection as CommandCollection 

12from .core import Context as Context 

13from .core import Group as Group 

14from .core import Option as Option 

15from .core import Parameter as Parameter 

16from .decorators import argument as argument 

17from .decorators import command as command 

18from .decorators import confirmation_option as confirmation_option 

19from .decorators import group as group 

20from .decorators import help_option as help_option 

21from .decorators import make_pass_decorator as make_pass_decorator 

22from .decorators import option as option 

23from .decorators import pass_context as pass_context 

24from .decorators import pass_obj as pass_obj 

25from .decorators import password_option as password_option 

26from .decorators import version_option as version_option 

27from .exceptions import Abort as Abort 

28from .exceptions import BadArgumentUsage as BadArgumentUsage 

29from .exceptions import BadOptionUsage as BadOptionUsage 

30from .exceptions import BadParameter as BadParameter 

31from .exceptions import ClickException as ClickException 

32from .exceptions import FileError as FileError 

33from .exceptions import MissingParameter as MissingParameter 

34from .exceptions import NoSuchOption as NoSuchOption 

35from .exceptions import UsageError as UsageError 

36from .formatting import HelpFormatter as HelpFormatter 

37from .formatting import wrap_text as wrap_text 

38from .globals import get_current_context as get_current_context 

39from .termui import clear as clear 

40from .termui import confirm as confirm 

41from .termui import echo_via_pager as echo_via_pager 

42from .termui import edit as edit 

43from .termui import getchar as getchar 

44from .termui import launch as launch 

45from .termui import pause as pause 

46from .termui import progressbar as progressbar 

47from .termui import prompt as prompt 

48from .termui import secho as secho 

49from .termui import style as style 

50from .termui import unstyle as unstyle 

51from .types import BOOL as BOOL 

52from .types import Choice as Choice 

53from .types import DateTime as DateTime 

54from .types import File as File 

55from .types import FLOAT as FLOAT 

56from .types import FloatRange as FloatRange 

57from .types import INT as INT 

58from .types import IntRange as IntRange 

59from .types import ParamType as ParamType 

60from .types import Path as Path 

61from .types import STRING as STRING 

62from .types import Tuple as Tuple 

63from .types import UNPROCESSED as UNPROCESSED 

64from .types import UUID as UUID 

65from .utils import echo as echo 

66from .utils import format_filename as format_filename 

67from .utils import get_app_dir as get_app_dir 

68from .utils import get_binary_stream as get_binary_stream 

69from .utils import get_text_stream as get_text_stream 

70from .utils import open_file as open_file 



73def __getattr__(name: str) -> object: 

74 import warnings 


76 if name == "BaseCommand": 

77 from .core import _BaseCommand 


79 warnings.warn( 

80 "'BaseCommand' is deprecated and will be removed in Click 9.0. Use" 

81 " 'Command' instead.", 

82 DeprecationWarning, 

83 stacklevel=2, 

84 ) 

85 return _BaseCommand 


87 if name == "MultiCommand": 

88 from .core import _MultiCommand 


90 warnings.warn( 

91 "'MultiCommand' is deprecated and will be removed in Click 9.0. Use" 

92 " 'Group' instead.", 

93 DeprecationWarning, 

94 stacklevel=2, 

95 ) 

96 return _MultiCommand 


98 if name == "OptionParser": 

99 from .parser import _OptionParser 


101 warnings.warn( 

102 "'OptionParser' is deprecated and will be removed in Click 9.0. The" 

103 " old parser is available in 'optparse'.", 

104 DeprecationWarning, 

105 stacklevel=2, 

106 ) 

107 return _OptionParser 


109 if name == "__version__": 

110 import importlib.metadata 

111 import warnings 


113 warnings.warn( 

114 "The '__version__' attribute is deprecated and will be removed in" 

115 " Click 9.1. Use feature detection or" 

116 " 'importlib.metadata.version(\"click\")' instead.", 

117 DeprecationWarning, 

118 stacklevel=2, 

119 ) 

120 return importlib.metadata.version("click") 


122 raise AttributeError(name)