Skip to content

Commit d13ed5f

Browse files
committed
Add pre-commit hooks
1 parent 2ecdec0 commit d13ed5f

File tree

6 files changed

+148
-6
lines changed

6 files changed

+148
-6
lines changed

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: check-added-large-files
6+
args: ["--maxkb=16384"]
7+
- id: check-yaml
8+
9+
- repo: https://github.com/yelp/detect-secrets
10+
rev: v1.4.0
11+
hooks:
12+
- id: detect-secrets
13+
args:
14+
["--baseline", ".secrets.baseline"]
15+
exclude: package.lock.json
16+
17+
- repo: https://github.com/psf/black-pre-commit-mirror
18+
rev: 23.9.0
19+
hooks:
20+
- id: black-jupyter

.secrets.baseline

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
{
2+
"version": "1.4.0",
3+
"plugins_used": [
4+
{
5+
"name": "ArtifactoryDetector"
6+
},
7+
{
8+
"name": "AWSKeyDetector"
9+
},
10+
{
11+
"name": "AzureStorageKeyDetector"
12+
},
13+
{
14+
"name": "Base64HighEntropyString",
15+
"limit": 4.5
16+
},
17+
{
18+
"name": "BasicAuthDetector"
19+
},
20+
{
21+
"name": "CloudantDetector"
22+
},
23+
{
24+
"name": "DiscordBotTokenDetector"
25+
},
26+
{
27+
"name": "GitHubTokenDetector"
28+
},
29+
{
30+
"name": "HexHighEntropyString",
31+
"limit": 3.0
32+
},
33+
{
34+
"name": "IbmCloudIamDetector"
35+
},
36+
{
37+
"name": "IbmCosHmacDetector"
38+
},
39+
{
40+
"name": "JwtTokenDetector"
41+
},
42+
{
43+
"name": "KeywordDetector",
44+
"keyword_exclude": ""
45+
},
46+
{
47+
"name": "MailchimpDetector"
48+
},
49+
{
50+
"name": "NpmDetector"
51+
},
52+
{
53+
"name": "PrivateKeyDetector"
54+
},
55+
{
56+
"name": "SendGridDetector"
57+
},
58+
{
59+
"name": "SlackDetector"
60+
},
61+
{
62+
"name": "SoftlayerDetector"
63+
},
64+
{
65+
"name": "SquareOAuthDetector"
66+
},
67+
{
68+
"name": "StripeDetector"
69+
},
70+
{
71+
"name": "TwilioKeyDetector"
72+
}
73+
],
74+
"filters_used": [
75+
{
76+
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
77+
},
78+
{
79+
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
80+
"min_level": 2
81+
},
82+
{
83+
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
84+
},
85+
{
86+
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
87+
},
88+
{
89+
"path": "detect_secrets.filters.heuristic.is_lock_file"
90+
},
91+
{
92+
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
93+
},
94+
{
95+
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
96+
},
97+
{
98+
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
99+
},
100+
{
101+
"path": "detect_secrets.filters.heuristic.is_sequential_string"
102+
},
103+
{
104+
"path": "detect_secrets.filters.heuristic.is_swagger_file"
105+
},
106+
{
107+
"path": "detect_secrets.filters.heuristic.is_templated_secret"
108+
}
109+
],
110+
"results": {},
111+
"generated_at": "2023-09-10T23:08:58Z"
112+
}

prepare/downloader.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ class Downloader:
88
Downloads data from a url or bucket.
99
"""
1010

11-
def __init__(self, url: str, prefix: str = "", mode: Literal["url", "s3"] = "url") -> None:
11+
def __init__(
12+
self, url: str, prefix: str = "", mode: Literal["url", "s3"] = "url"
13+
) -> None:
1214
"""
1315
Initialize this class.
1416
@@ -29,7 +31,6 @@ def download(self, name: str, save_to: Optional[str | Path] = None) -> str | Non
2931
3032
:return: return the downloaded data or None if saving.
3133
"""
32-
3334
if self.mode == "url":
3435
if save_to is None:
3536
with urllib.request.urlopen(self.url + self.prefix + name) as f:
@@ -39,7 +40,9 @@ def download(self, name: str, save_to: Optional[str | Path] = None) -> str | Non
3940
else:
4041
raise NotImplementedError
4142

42-
def get_or_download(self, output_dir: str, name: str, read_data: bool = True) -> str | None:
43+
def get_or_download(
44+
self, output_dir: str, name: str, read_data: bool = True
45+
) -> str | None:
4346
"""
4447
Get the data from the output_dir or download and save it to the output directory.
4548

prepare/prepare_serve.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ class PrepareServe:
1515

1616
_data: dict[str, str] = {}
1717

18-
def __init__(self, url: str = "https://storage.googleapis.com/hmf-public/HMFtools-Resources/serve/38/", output_dir: str = "data/serve/") -> None:
18+
def __init__(
19+
self,
20+
url: str = "https://storage.googleapis.com/hmf-public/HMFtools-Resources/serve/38/",
21+
output_dir: str = "data/serve/",
22+
) -> None:
1923
"""
2024
Initialize this class.
2125

prepare/prepare_software.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ class PrepareSoftware:
99
_protect_jar = "protect-v2.3/protect.jar"
1010
_linx_jar = "linx-v1.21/linx_v1.21.jar"
1111

12-
def __init__(self, url: str = "https://github.com/hartwigmedical/hmftools/releases/download/",
13-
output_dir: str = "data/software/") -> None:
12+
def __init__(
13+
self,
14+
url: str = "https://github.com/hartwigmedical/hmftools/releases/download/",
15+
output_dir: str = "data/software/",
16+
) -> None:
1417
"""
1518
Initialize this class.
1619

requirements.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)