mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
py27+ syntax improvements
This commit is contained in:
parent
0a93f3bfdd
commit
ba75867c93
9 changed files with 31 additions and 34 deletions
|
|
@ -75,9 +75,9 @@ def no_git_env():
|
|||
# while running pre-commit hooks in submodules.
|
||||
# GIT_DIR: Causes git clone to clone wrong thing
|
||||
# GIT_INDEX_FILE: Causes 'error invalid object ...' during commit
|
||||
return dict(
|
||||
(k, v) for k, v in os.environ.items() if not k.startswith('GIT_')
|
||||
)
|
||||
return {
|
||||
k: v for k, v in os.environ.items() if not k.startswith('GIT_')
|
||||
}
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
|
@ -164,10 +164,10 @@ def cmd_output(*cmd, **kwargs):
|
|||
|
||||
# py2/py3 on windows are more strict about the types here
|
||||
cmd = tuple(five.n(arg) for arg in cmd)
|
||||
kwargs['env'] = dict(
|
||||
(five.n(key), five.n(value))
|
||||
kwargs['env'] = {
|
||||
five.n(key): five.n(value)
|
||||
for key, value in kwargs.pop('env', {}).items()
|
||||
) or None
|
||||
} or None
|
||||
|
||||
try:
|
||||
cmd = parse_shebang.normalize_cmd(cmd)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue