Skip to content

Commit 1a1dd39

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent bf27513 commit 1a1dd39

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pre_commit_hooks/detect_private_key.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import argparse
44
import gzip
5-
65
from collections.abc import Sequence
76

87
BLACKLIST = [
@@ -33,7 +32,7 @@ def main(argv: Sequence[str] | None = None) -> int:
3332
private_key_files.append(filename)
3433
continue
3534
try:
36-
if filename.endswith(".gz"):
35+
if filename.endswith('.gz'):
3736
with gzip.open(filename, 'rb') as f:
3837
content = f.read()
3938
if any(line in content for line in BLACKLIST):
@@ -42,7 +41,6 @@ def main(argv: Sequence[str] | None = None) -> int:
4241
except gzip.BadGzipFile:
4342
pass
4443

45-
4644
if private_key_files:
4745
for private_key_file in private_key_files:
4846
print(f'Private key found: {private_key_file}')

tests/detect_private_key_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import gzip
4+
45
import pytest
56

67
from pre_commit_hooks.detect_private_key import main
@@ -28,6 +29,7 @@ def test_main(input_s, expected_retval, tmpdir):
2829
path.write_binary(input_s)
2930
assert main([str(path)]) == expected_retval
3031

32+
3133
@pytest.mark.parametrize(('input_s', 'expected_retval'), TESTS)
3234
def test_main_gzip(input_s, expected_retval, tmpdir):
3335
path = tmpdir.join('file.txt.gz')

0 commit comments

Comments
 (0)