(
self,
prog,
indent_increment=2,
max_help_position=24,
width=None,
)
| 165 | """ |
| 166 | |
| 167 | def __init__( |
| 168 | self, |
| 169 | prog, |
| 170 | indent_increment=2, |
| 171 | max_help_position=24, |
| 172 | width=None, |
| 173 | ): |
| 174 | # default setting for width |
| 175 | if width is None: |
| 176 | import shutil |
| 177 | width = shutil.get_terminal_size().columns |
| 178 | width -= 2 |
| 179 | |
| 180 | self._prog = prog |
| 181 | self._indent_increment = indent_increment |
| 182 | self._max_help_position = min(max_help_position, |
| 183 | max(width - 20, indent_increment * 2)) |
| 184 | self._width = width |
| 185 | |
| 186 | self._current_indent = 0 |
| 187 | self._level = 0 |
| 188 | self._action_max_length = 0 |
| 189 | |
| 190 | self._root_section = self._Section(self, None) |
| 191 | self._current_section = self._root_section |
| 192 | |
| 193 | self._whitespace_matcher = _re.compile(r'\s+', _re.ASCII) |
| 194 | self._long_break_matcher = _re.compile(r'\n\n\n+') |
| 195 | |
| 196 | self._set_color(False) |
| 197 | |
| 198 | def _set_color(self, color, *, file=None): |
| 199 | from _colorize import can_colorize, decolor, get_theme |
nothing calls this directly
no test coverage detected