mirror of
https://github.com/python/cpython.git
synced 2025-11-28 06:06:26 +00:00
Defer import of shutil which only needed for help and usage (GH-17334)
This commit is contained in:
parent
65444cf7fe
commit
b4e5eeac26
1 changed files with 3 additions and 3 deletions
|
|
@ -87,7 +87,6 @@ __all__ = [
|
||||||
|
|
||||||
import os as _os
|
import os as _os
|
||||||
import re as _re
|
import re as _re
|
||||||
import shutil as _shutil
|
|
||||||
import sys as _sys
|
import sys as _sys
|
||||||
|
|
||||||
from gettext import gettext as _, ngettext
|
from gettext import gettext as _, ngettext
|
||||||
|
|
@ -167,7 +166,8 @@ class HelpFormatter(object):
|
||||||
|
|
||||||
# default setting for width
|
# default setting for width
|
||||||
if width is None:
|
if width is None:
|
||||||
width = _shutil.get_terminal_size().columns
|
import shutil
|
||||||
|
width = shutil.get_terminal_size().columns
|
||||||
width -= 2
|
width -= 2
|
||||||
|
|
||||||
self._prog = prog
|
self._prog = prog
|
||||||
|
|
@ -264,7 +264,7 @@ class HelpFormatter(object):
|
||||||
invocations.append(get_invocation(subaction))
|
invocations.append(get_invocation(subaction))
|
||||||
|
|
||||||
# update the maximum item length
|
# update the maximum item length
|
||||||
invocation_length = max([len(s) for s in invocations])
|
invocation_length = max(map(len, invocations))
|
||||||
action_length = invocation_length + self._current_indent
|
action_length = invocation_length + self._current_indent
|
||||||
self._action_max_length = max(self._action_max_length,
|
self._action_max_length = max(self._action_max_length,
|
||||||
action_length)
|
action_length)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue