|
90 | 90 | import sys as _sys |
91 | 91 |
|
92 | 92 | lazy import _colorize |
93 | | -lazy import copy as _copy |
94 | | -lazy import difflib as _difflib |
| 93 | +lazy import copy |
| 94 | +lazy import difflib |
95 | 95 | lazy import re as _re |
96 | | -lazy import shutil as _shutil |
97 | | -lazy import textwrap as _textwrap |
98 | | -lazy import warnings as _warnings |
| 96 | +lazy import shutil |
| 97 | +lazy import textwrap |
| 98 | +lazy import warnings |
99 | 99 | lazy from gettext import gettext as _ |
100 | 100 | lazy from gettext import ngettext |
101 | 101 |
|
@@ -150,7 +150,7 @@ def _copy_items(items): |
150 | 150 | # actions, and it is needed only when the default value isn't a list. |
151 | 151 | if type(items) is list: |
152 | 152 | return items[:] |
153 | | - return _copy.copy(items) |
| 153 | + return copy.copy(items) |
154 | 154 |
|
155 | 155 |
|
156 | 156 | def _identity(value): |
@@ -189,7 +189,7 @@ def __init__( |
189 | 189 | ): |
190 | 190 | # default setting for width |
191 | 191 | if width is None: |
192 | | - width = _shutil.get_terminal_size().columns |
| 192 | + width = shutil.get_terminal_size().columns |
193 | 193 | width -= 2 |
194 | 194 |
|
195 | 195 | self._prog = prog |
@@ -775,11 +775,11 @@ def _iter_indented_subactions(self, action): |
775 | 775 |
|
776 | 776 | def _split_lines(self, text, width): |
777 | 777 | text = self._whitespace_matcher.sub(' ', text).strip() |
778 | | - return _textwrap.wrap(text, width) |
| 778 | + return textwrap.wrap(text, width) |
779 | 779 |
|
780 | 780 | def _fill_text(self, text, width, indent): |
781 | 781 | text = self._whitespace_matcher.sub(' ', text).strip() |
782 | | - return _textwrap.fill(text, width, |
| 782 | + return textwrap.fill(text, width, |
783 | 783 | initial_indent=indent, |
784 | 784 | subsequent_indent=indent) |
785 | 785 |
|
@@ -1456,7 +1456,7 @@ class FileType(object): |
1456 | 1456 | """ |
1457 | 1457 |
|
1458 | 1458 | def __init__(self, mode='r', bufsize=-1, encoding=None, errors=None): |
1459 | | - _warnings.warn( |
| 1459 | + warnings.warn( |
1460 | 1460 | "FileType is deprecated. Simply open files after parsing arguments.", |
1461 | 1461 | category=PendingDeprecationWarning, |
1462 | 1462 | stacklevel=2 |
@@ -1866,7 +1866,7 @@ def __init__(self, container, title=None, description=None, **kwargs): |
1866 | 1866 | "The use of the undocumented 'prefix_chars' parameter in " |
1867 | 1867 | "ArgumentParser.add_argument_group() is deprecated." |
1868 | 1868 | ) |
1869 | | - _warnings.warn(depr_msg, DeprecationWarning, stacklevel=3) |
| 1869 | + warnings.warn(depr_msg, DeprecationWarning, stacklevel=3) |
1870 | 1870 |
|
1871 | 1871 | # add any missing keyword arguments by checking the container |
1872 | 1872 | update = kwargs.setdefault |
@@ -2792,7 +2792,7 @@ def _check_value(self, action, value): |
2792 | 2792 |
|
2793 | 2793 | if self.suggest_on_error and isinstance(value, str): |
2794 | 2794 | if all(isinstance(choice, str) for choice in action.choices): |
2795 | | - suggestions = _difflib.get_close_matches(value, action.choices, 1) |
| 2795 | + suggestions = difflib.get_close_matches(value, action.choices, 1) |
2796 | 2796 | if suggestions: |
2797 | 2797 | args['closest'] = suggestions[0] |
2798 | 2798 | msg = _('invalid choice: %(value)r, maybe you meant %(closest)r? ' |
@@ -2931,6 +2931,6 @@ def _warning(self, message): |
2931 | 2931 |
|
2932 | 2932 | def __getattr__(name): |
2933 | 2933 | if name == "__version__": |
2934 | | - _warnings._deprecated("__version__", remove=(3, 20)) |
| 2934 | + warnings._deprecated("__version__", remove=(3, 20)) |
2935 | 2935 | return "1.1" # Do not change |
2936 | 2936 | raise AttributeError(f"module {__name__!r} has no attribute {name!r}") |
0 commit comments