Merge branch 'wting_fix_and_run_precommit'

pull/495/merge
William Ting 6 years ago
commit a876bc1f39

1
.gitignore vendored

@ -5,5 +5,6 @@ __pycache__
*~
*.tar.gz
*.patch
.pytest_cache
.tox
tags

@ -1,35 +1,51 @@
- repo: git@github.com:pre-commit/pre-commit-hooks.git
sha: v0.9.1
hooks:
- id: autopep8-wrapper
args:
- --in-place
- --aggressive
- --aggressive
- --max-line-length=131
- --ignore=E126,E128,E402,E731
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-docstring-first
- id: debug-statements
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: fix-encoding-pragma
- id: flake8
args:
- --max-complexity=10
- --max-line-length=131
- --ignore=E126,E128,E402,E731
- --exclude=bin/autojump_argparse.py
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: git@github.com:asottile/reorder_python_imports.git
sha: v0.3.5
hooks:
- id: reorder-python-imports
language_version: python2.7
- repo: https://github.com/asottile/add-trailing-comma
sha: v0.6.1
hooks:
- id: add-trailing-comma
repos:
- repo: git@github.com:pre-commit/pre-commit-hooks.git
rev: v1.4.0
hooks:
- id: autopep8-wrapper
language_version: python2
args:
- --in-place
- --aggressive
- --aggressive
- --ignore=E731
- --max-line-length=131
- id: check-added-large-files
language_version: python2
- id: check-ast
language_version: python2
- id: check-case-conflict
language_version: python2
- id: check-docstring-first
language_version: python2
- id: debug-statements
language_version: python2
- id: double-quote-string-fixer
language_version: python2
- id: end-of-file-fixer
language_version: python2
exclude_types: [batch, lua]
- id: fix-encoding-pragma
language_version: python2
- id: flake8
language_version: python2
args:
- --max-complexity=10
- --max-line-length=131
- --ignore=E402,E731
- --exclude=bin/autojump_argparse.py
- id: name-tests-test
language_version: python2
- id: requirements-txt-fixer
language_version: python2
- id: trailing-whitespace
language_version: python2
- repo: git@github.com:asottile/reorder_python_imports.git
rev: v1.1.1
hooks:
- id: reorder-python-imports
language_version: python2
- repo: git@github.com:asottile/add-trailing-comma
rev: v0.7.0
hooks:
- id: add-trailing-comma

@ -1,5 +1,5 @@
## Summary of release changes, see commit history for more details:
## https://github.com/joelthelion/autojump/commits/master/
## https://github.com/wting/autojump/commits/master/
### Release v22.4.0:
- minor zsh performance improvement

@ -1,14 +1,15 @@
VERSION = $(shell grep -oE "[0-9]+\.[0-9]+\.[0-9]+" bin/autojump)
TAGNAME = release-v$(VERSION)
.PHONY: clean docs install uninstall pre-commit lint tar test
.PHONY: install
install:
./install.py
.PHONY: uninstall
uninstall:
./uninstall.py
.PHONY: docs
docs:
pandoc -s -w man docs/manpage_header.md docs/header.md docs/body.md -o docs/autojump.1
pandoc -s -w markdown docs/header.md docs/install.md docs/body.md -o README.md
@ -17,9 +18,11 @@ docs:
lint: pre-commit
@tox -e pre-commit -- run --all-files
.PHONY: pre-commit
pre-commit:
@tox -e pre-commit -- install -f --install-hooks
.PHONY: release
release: docs
# Check for tag existence
# git describe release-$(VERSION) 2>&1 >/dev/null || exit 1
@ -37,20 +40,25 @@ release: docs
git archive --format=tar --prefix autojump_v$(VERSION)/ $(TAGNAME) | gzip > autojump_v$(VERSION).tar.gz
sha1sum autojump_v$(VERSION).tar.gz
.PHONY: tar
tar:
# Create tagged archive
git archive --format=tar --prefix autojump_v$(VERSION)/ $(TAGNAME) | gzip > autojump_v$(VERSION).tar.gz
sha1sum autojump_v$(VERSION).tar.gz
.PHONY: test
test: pre-commit
@tox
.PHONY: test-xfail
test-xfail: pre-commit
@tox -- --runxfail
.PHONY: test-fast
test-fast: pre-commit
@tox -e py27
.PHONY: clean
clean:
@find . -type f -iname '*.py[co]' -delete
@find . -type d -iname '__pycache__' -delete

@ -79,7 +79,7 @@ autojump is included in the following distro repositories, please use
relevant package management utilities to install (e.g. yum, apt-get,
etc):
- Debian testing/unstable, Ubuntu, Linux Mint
- Debian, Ubuntu, Linux Mint
All Debian-derived distros require manual activation for policy
reasons, please see `/usr/share/doc/autojump/README.Debian`.

@ -311,9 +311,11 @@ class HelpFormatter(object):
return help
def _join_parts(self, part_strings):
return ''.join([part
for part in part_strings
if part and part is not SUPPRESS])
return ''.join([
part
for part in part_strings
if part and part is not SUPPRESS
])
def _format_usage(self, usage, actions, groups, prefix):
if prefix is None:
@ -1526,9 +1528,11 @@ class _ActionsContainer(object):
def _handle_conflict_error(self, action, conflicting_actions):
message = _('conflicting option string(s): %s')
conflict_string = ', '.join([option_string
for option_string, action
in conflicting_actions])
conflict_string = ', '.join([
option_string
for option_string, action
in conflicting_actions
])
raise ArgumentError(action, message % conflict_string)
def _handle_conflict_resolve(self, action, conflicting_actions):
@ -1760,14 +1764,18 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
return action
def _get_optional_actions(self):
return [action
for action in self._actions
if action.option_strings]
return [
action
for action in self._actions
if action.option_strings
]
def _get_positional_actions(self):
return [action
for action in self._actions
if not action.option_strings]
return [
action
for action in self._actions
if not action.option_strings
]
# =====================================
# Command line argument parsing methods
@ -1991,7 +1999,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
next_option_string_index = min([
index
for index in option_string_indices
if index >= start_index])
if index >= start_index
])
if start_index != next_option_string_index:
positionals_end_index = consume_positionals(start_index)
@ -2040,9 +2049,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
# if no actions were used, report the error
else:
names = [_get_action_name(action)
for action in group._group_actions
if action.help is not SUPPRESS]
names = [
_get_action_name(action)
for action in group._group_actions
if action.help is not SUPPRESS
]
msg = _('one of the arguments %s is required')
self.error(msg % ' '.join(names))
@ -2106,8 +2117,10 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
result = []
for i in range(len(actions), 0, -1):
actions_slice = actions[:i]
pattern = ''.join([self._get_nargs_pattern(action)
for action in actions_slice])
pattern = ''.join([
self._get_nargs_pattern(action)
for action in actions_slice
])
match = _re.match(pattern, arg_strings_pattern)
if match is not None:
result.extend([len(string) for string in match.groups()])

Loading…
Cancel
Save