mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
Run pre-commit hooks.
This commit is contained in:
parent
965296f6b2
commit
fc43204ca1
@ -311,9 +311,11 @@ class HelpFormatter(object):
|
|||||||
return help
|
return help
|
||||||
|
|
||||||
def _join_parts(self, part_strings):
|
def _join_parts(self, part_strings):
|
||||||
return ''.join([part
|
return ''.join([
|
||||||
|
part
|
||||||
for part in part_strings
|
for part in part_strings
|
||||||
if part and part is not SUPPRESS])
|
if part and part is not SUPPRESS
|
||||||
|
])
|
||||||
|
|
||||||
def _format_usage(self, usage, actions, groups, prefix):
|
def _format_usage(self, usage, actions, groups, prefix):
|
||||||
if prefix is None:
|
if prefix is None:
|
||||||
@ -1526,9 +1528,11 @@ class _ActionsContainer(object):
|
|||||||
|
|
||||||
def _handle_conflict_error(self, action, conflicting_actions):
|
def _handle_conflict_error(self, action, conflicting_actions):
|
||||||
message = _('conflicting option string(s): %s')
|
message = _('conflicting option string(s): %s')
|
||||||
conflict_string = ', '.join([option_string
|
conflict_string = ', '.join([
|
||||||
|
option_string
|
||||||
for option_string, action
|
for option_string, action
|
||||||
in conflicting_actions])
|
in conflicting_actions
|
||||||
|
])
|
||||||
raise ArgumentError(action, message % conflict_string)
|
raise ArgumentError(action, message % conflict_string)
|
||||||
|
|
||||||
def _handle_conflict_resolve(self, action, conflicting_actions):
|
def _handle_conflict_resolve(self, action, conflicting_actions):
|
||||||
@ -1760,14 +1764,18 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
|||||||
return action
|
return action
|
||||||
|
|
||||||
def _get_optional_actions(self):
|
def _get_optional_actions(self):
|
||||||
return [action
|
return [
|
||||||
|
action
|
||||||
for action in self._actions
|
for action in self._actions
|
||||||
if action.option_strings]
|
if action.option_strings
|
||||||
|
]
|
||||||
|
|
||||||
def _get_positional_actions(self):
|
def _get_positional_actions(self):
|
||||||
return [action
|
return [
|
||||||
|
action
|
||||||
for action in self._actions
|
for action in self._actions
|
||||||
if not action.option_strings]
|
if not action.option_strings
|
||||||
|
]
|
||||||
|
|
||||||
# =====================================
|
# =====================================
|
||||||
# Command line argument parsing methods
|
# Command line argument parsing methods
|
||||||
@ -1991,7 +1999,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
|||||||
next_option_string_index = min([
|
next_option_string_index = min([
|
||||||
index
|
index
|
||||||
for index in option_string_indices
|
for index in option_string_indices
|
||||||
if index >= start_index])
|
if index >= start_index
|
||||||
|
])
|
||||||
if start_index != next_option_string_index:
|
if start_index != next_option_string_index:
|
||||||
positionals_end_index = consume_positionals(start_index)
|
positionals_end_index = consume_positionals(start_index)
|
||||||
|
|
||||||
@ -2040,9 +2049,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
|||||||
|
|
||||||
# if no actions were used, report the error
|
# if no actions were used, report the error
|
||||||
else:
|
else:
|
||||||
names = [_get_action_name(action)
|
names = [
|
||||||
|
_get_action_name(action)
|
||||||
for action in group._group_actions
|
for action in group._group_actions
|
||||||
if action.help is not SUPPRESS]
|
if action.help is not SUPPRESS
|
||||||
|
]
|
||||||
msg = _('one of the arguments %s is required')
|
msg = _('one of the arguments %s is required')
|
||||||
self.error(msg % ' '.join(names))
|
self.error(msg % ' '.join(names))
|
||||||
|
|
||||||
@ -2106,8 +2117,10 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
|||||||
result = []
|
result = []
|
||||||
for i in range(len(actions), 0, -1):
|
for i in range(len(actions), 0, -1):
|
||||||
actions_slice = actions[:i]
|
actions_slice = actions[:i]
|
||||||
pattern = ''.join([self._get_nargs_pattern(action)
|
pattern = ''.join([
|
||||||
for action in actions_slice])
|
self._get_nargs_pattern(action)
|
||||||
|
for action in actions_slice
|
||||||
|
])
|
||||||
match = _re.match(pattern, arg_strings_pattern)
|
match = _re.match(pattern, arg_strings_pattern)
|
||||||
if match is not None:
|
if match is not None:
|
||||||
result.extend([len(string) for string in match.groups()])
|
result.extend([len(string) for string in match.groups()])
|
||||||
|
Loading…
Reference in New Issue
Block a user