File size: 1,814 Bytes
bb58fb0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
from collections.abc import Callable
from typing import Any, NoReturn, TypeVar, overload

from absl.flags import _flag

_MainArgs = TypeVar('_MainArgs')
_Exc = TypeVar('_Exc', bound=Exception)

class ExceptionHandler:

  def wants(self, exc: _Exc) -> bool:
    ...

  def handle(self, exc: _Exc):
    ...

EXCEPTION_HANDLERS: list[ExceptionHandler] = ...

class HelpFlag(_flag.BooleanFlag):
  def __init__(self):
    ...

class HelpshortFlag(HelpFlag):
  ...

class HelpfullFlag(_flag.BooleanFlag):
  def __init__(self):
    ...

class HelpXMLFlag(_flag.BooleanFlag):
  def __init__(self):
    ...

def define_help_flags() -> None:
  ...

@overload
def usage(shorthelp: bool | int = ...,
          writeto_stdout: bool | int = ...,
          detailed_error: Any | None = ...,
          exitcode: None = ...) -> None:
  ...

@overload
def usage(shorthelp: bool | int,
          writeto_stdout: bool | int,
          detailed_error: Any | None,
          exitcode: int) -> NoReturn:
  ...

@overload
def usage(shorthelp: bool | int = ...,
          writeto_stdout: bool | int = ...,
          detailed_error: Any | None = ...,
          *,
          exitcode: int) -> NoReturn:
  ...

def install_exception_handler(handler: ExceptionHandler) -> None:
  ...

class Error(Exception):
  ...

class UsageError(Error):
  exitcode: int

def parse_flags_with_usage(args: list[str]) -> list[str]:
  ...

def call_after_init(callback: Callable[[], Any]) -> None:
  ...

# Without the flag_parser argument, `main` should require a List[str].
@overload
def run(
    main: Callable[[list[str]], Any],
    argv: list[str] | None = ...,
) -> NoReturn:
  ...

@overload
def run(
    main: Callable[[_MainArgs], Any],
    argv: list[str] | None = ...,
    *,
    flags_parser: Callable[[list[str]], _MainArgs],
) -> NoReturn:
  ...