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([
|
||||||
for part in part_strings
|
part
|
||||||
if part and part is not SUPPRESS])
|
for part in part_strings
|
||||||
|
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([
|
||||||
for option_string, action
|
option_string
|
||||||
in conflicting_actions])
|
for option_string, action
|
||||||
|
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 [
|
||||||
for action in self._actions
|
action
|
||||||
if action.option_strings]
|
for action in self._actions
|
||||||
|
if action.option_strings
|
||||||
|
]
|
||||||
|
|
||||||
def _get_positional_actions(self):
|
def _get_positional_actions(self):
|
||||||
return [action
|
return [
|
||||||
for action in self._actions
|
action
|
||||||
if not action.option_strings]
|
for action in self._actions
|
||||||
|
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 = [
|
||||||
for action in group._group_actions
|
_get_action_name(action)
|
||||||
if action.help is not SUPPRESS]
|
for action in group._group_actions
|
||||||
|
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