Skip to content

Commit 90c60c8

Browse files
authored
chore: Pre-Commit update, maintenance passes (#266)
* chore: Update pre-commit * chore: Add secrets baseline * chore: Add tools configs * chore: Ruff check --fix + manual fixes * chore: Ruff format * Chore: Biome format --fix + manual amends * chore: Biome check --fix + manual amends * chore: Run mypy - manual amends * chore: Run general pre-commit hooks * chore: Add c++ pre-commit * chore: Add mypy types to pre-commit * fix: Remove unused prefix on used fn * fix: typo * refactor: Fix react code and types * chore: Revert biome changes on gate-controller, webhook-preview
1 parent 2bd2210 commit 90c60c8

File tree

122 files changed

+1540
-1365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+1540
-1365
lines changed

.github/workflows/installers.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,3 @@ jobs:
6868
with:
6969
name: PlateRecognizer-Installer-MacOS
7070
path: docker/platerec_installer/dist/*
71-

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ output/
1414

1515
.env
1616
dot_config.csv
17+
18+
node_modules/

.pre-commit-config.yaml

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,48 @@
11
repos:
2-
- repo: https://github.com/charliermarsh/ruff-pre-commit
3-
# Ruff version.
4-
rev: "v0.0.254"
5-
hooks:
6-
- id: ruff
7-
args: [--fix, --exit-non-zero-on-fix]
8-
- repo: https://github.com/ambv/black
9-
rev: 24.8.0
10-
hooks:
11-
- id: black
12-
language_version: python3
13-
args: ["-C"]
2+
- repo: https://github.com/Yelp/detect-secrets
3+
rev: v1.5.0
4+
hooks:
5+
- id: detect-secrets
6+
args: ['--baseline', '.secrets.baseline']
7+
exclude: '.*test.*\.py$|pnpm-lock\.yaml$'
148

15-
- repo: https://github.com/pre-commit/mirrors-mypy
16-
rev: v1.0.1
17-
hooks:
18-
- id: mypy
19-
args:
20-
- --allow-untyped-globals
21-
- --ignore-missing-imports
22-
additional_dependencies:
23-
- types-requests
24-
- types-python-dateutil
25-
- types-paramiko
26-
- repo: https://github.com/pre-commit/pre-commit-hooks
27-
rev: v4.4.0
28-
hooks:
29-
- id: trailing-whitespace
30-
args: [--markdown-linebreak-ext=md]
31-
- id: check-yaml
32-
- id: check-merge-conflict
33-
- id: debug-statements
34-
- id: check-added-large-files
35-
- repo: https://github.com/pre-commit/mirrors-prettier
36-
rev: v3.0.0-alpha.4
37-
hooks:
38-
- id: prettier
39-
exclude: ".*.min.js"
40-
types:
41-
- javascript
9+
- repo: https://github.com/astral-sh/ruff-pre-commit
10+
rev: v0.14.4
11+
hooks:
12+
- id: ruff-check
13+
args: [--fix]
14+
- id: ruff-format
15+
args: [--exit-non-zero-on-fix]
16+
17+
- repo: https://github.com/biomejs/pre-commit
18+
rev: "v2.3.4"
19+
hooks:
20+
- id: biome-check
21+
22+
- repo: https://github.com/pre-commit/mirrors-mypy
23+
rev: v1.18.2
24+
hooks:
25+
- id: mypy
26+
additional_dependencies:
27+
- types-requests
28+
- types-paramiko
29+
- types-python-dateutil
30+
31+
- repo: https://github.com/cpp-linter/cpp-linter-hooks
32+
rev: v1.1.8
33+
hooks:
34+
- id: clang-format
35+
args: ["--style={BasedOnStyle: Google, ColumnLimit: 100}"] # Use Google's C++ style guide with 100 char line length
36+
files: \.(cpp|hpp|cc|cxx|h|c)
37+
38+
- repo: https://github.com/pre-commit/pre-commit-hooks
39+
rev: v6.0.0
40+
hooks:
41+
- id: check-merge-conflict
42+
- id: check-yaml
43+
- id: debug-statements
44+
- id: end-of-file-fixer
45+
- id: mixed-line-ending
46+
- id: check-added-large-files
47+
- id: trailing-whitespace
48+
args: [--markdown-linebreak-ext=md]

.secrets.baseline

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
{
2+
"version": "1.5.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": "GitLabTokenDetector"
31+
},
32+
{
33+
"name": "HexHighEntropyString",
34+
"limit": 3.0
35+
},
36+
{
37+
"name": "IbmCloudIamDetector"
38+
},
39+
{
40+
"name": "IbmCosHmacDetector"
41+
},
42+
{
43+
"name": "IPPublicDetector"
44+
},
45+
{
46+
"name": "JwtTokenDetector"
47+
},
48+
{
49+
"name": "KeywordDetector",
50+
"keyword_exclude": ""
51+
},
52+
{
53+
"name": "MailchimpDetector"
54+
},
55+
{
56+
"name": "NpmDetector"
57+
},
58+
{
59+
"name": "OpenAIDetector"
60+
},
61+
{
62+
"name": "PrivateKeyDetector"
63+
},
64+
{
65+
"name": "PypiTokenDetector"
66+
},
67+
{
68+
"name": "SendGridDetector"
69+
},
70+
{
71+
"name": "SlackDetector"
72+
},
73+
{
74+
"name": "SoftlayerDetector"
75+
},
76+
{
77+
"name": "SquareOAuthDetector"
78+
},
79+
{
80+
"name": "StripeDetector"
81+
},
82+
{
83+
"name": "TelegramBotTokenDetector"
84+
},
85+
{
86+
"name": "TwilioKeyDetector"
87+
}
88+
],
89+
"filters_used": [
90+
{
91+
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
92+
},
93+
{
94+
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
95+
"min_level": 2
96+
},
97+
{
98+
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
99+
},
100+
{
101+
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
102+
},
103+
{
104+
"path": "detect_secrets.filters.heuristic.is_lock_file"
105+
},
106+
{
107+
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
108+
},
109+
{
110+
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
111+
},
112+
{
113+
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
114+
},
115+
{
116+
"path": "detect_secrets.filters.heuristic.is_sequential_string"
117+
},
118+
{
119+
"path": "detect_secrets.filters.heuristic.is_swagger_file"
120+
},
121+
{
122+
"path": "detect_secrets.filters.heuristic.is_templated_secret"
123+
},
124+
{
125+
"path": "detect_secrets.filters.regex.should_exclude_file",
126+
"pattern": [
127+
".*test.*\\.py$|pnpm-lock\\.yaml$"
128+
]
129+
}
130+
],
131+
"results": {
132+
"parkpow/axis-lpr/assets/event.json": [
133+
{
134+
"type": "Hex High Entropy String",
135+
"filename": "parkpow/axis-lpr/assets/event.json",
136+
"hashed_secret": "fc33a79ba22256162bfecc1e7689416d81eb47a0",
137+
"is_verified": false
138+
}
139+
],
140+
"stream/ipro-adam-app/installer.py": [
141+
{
142+
"type": "Secret Keyword",
143+
"filename": "stream/ipro-adam-app/installer.py",
144+
"hashed_secret": "c7236b67c4bdaf668fd346a4b696a7d2ad3632f5",
145+
"is_verified": false
146+
}
147+
],
148+
"webhooks/stream-parkpow-webhook-worker/worker-configuration.d.ts": [
149+
{
150+
"type": "Hex High Entropy String",
151+
"filename": "webhooks/stream-parkpow-webhook-worker/worker-configuration.d.ts",
152+
"hashed_secret": "1807820b6b15ccf9664a18f55f461a639208daf2",
153+
"is_verified": false
154+
},
155+
{
156+
"type": "Hex High Entropy String",
157+
"filename": "webhooks/stream-parkpow-webhook-worker/worker-configuration.d.ts",
158+
"hashed_secret": "bf7880346db356f8bde663da980520465db086b0",
159+
"is_verified": false
160+
},
161+
{
162+
"type": "Hex High Entropy String",
163+
"filename": "webhooks/stream-parkpow-webhook-worker/worker-configuration.d.ts",
164+
"hashed_secret": "759e3faf25afa19e695c1a160e8dc1ba76229206",
165+
"is_verified": false
166+
},
167+
{
168+
"type": "Hex High Entropy String",
169+
"filename": "webhooks/stream-parkpow-webhook-worker/worker-configuration.d.ts",
170+
"hashed_secret": "7f6b2b8fa115daac162636dec36688d592c4614d",
171+
"is_verified": false
172+
},
173+
{
174+
"type": "Hex High Entropy String",
175+
"filename": "webhooks/stream-parkpow-webhook-worker/worker-configuration.d.ts",
176+
"hashed_secret": "409094c4d37c2e6c7223629165edca50f0b6b0d3",
177+
"is_verified": false
178+
},
179+
{
180+
"type": "Hex High Entropy String",
181+
"filename": "webhooks/stream-parkpow-webhook-worker/worker-configuration.d.ts",
182+
"hashed_secret": "cac40cc1d64cb25e9d52168abc50d6726ed8d091",
183+
"is_verified": false
184+
}
185+
],
186+
"webhooks/webhook_preview/.env.sample": [
187+
{
188+
"type": "Secret Keyword",
189+
"filename": "webhooks/webhook_preview/.env.sample",
190+
"hashed_secret": "e3a8809017dd76bd26557a5b923ab2ae16c0cdb3",
191+
"is_verified": false
192+
}
193+
],
194+
"webhooks/webhook_preview/README.md": [
195+
{
196+
"type": "Basic Auth Credentials",
197+
"filename": "webhooks/webhook_preview/README.md",
198+
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
199+
"is_verified": false
200+
}
201+
]
202+
}
203+
}

benchmark/benchmark_blur.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ NumLogicals: 8
2929
CPUFrequency: 4400
3030
Passmark: 10432
3131

32-
#### WORKERS = 1
32+
#### WORKERS = 1
3333
Image: `assets/car-4k.jpg`
3434

3535
| Resolution | Speed | Peak CPU% (Blur, Snapshot) | Peak MEM in MiB (Blur, Snapshot) |
@@ -133,4 +133,4 @@ Image: `assets/car-4k.jpg`
133133
| 800x600 | 295.1 | 378.88, 41.19 | 1665.84, 661.40 |
134134
| 1280x720 | 291.8 | 396.42, 68.414 | 1630.47, 690.65 |
135135
| 1920x1080 | 360.1 | 371.16, 93.14 | 1711.66, 715.22 |
136-
| 2560x1440 | 614.7 | 402.30, 164.91 | 1800.31, 790.79 |
136+
| 2560x1440 | 614.7 | 402.30, 164.91 | 1800.31, 790.79 |

benchmark/benchmark_snapshot.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,15 @@ def call_duration(path, sdk_url, config, mmc, blur):
7878

7979
def benchmark(args, executor):
8080
image = Image.open(args.image)
81-
for resolution in [(800, 600), (1280, 720), (1920, 1080), (2560, 1440), (3840, 2160)]:
81+
for resolution in [
82+
(800, 600),
83+
(1280, 720),
84+
(1920, 1080),
85+
(2560, 1440),
86+
(3840, 2160),
87+
]:
8288
image.resize(resolution).save("/tmp/platerec-benchmark.jpg")
83-
if args.blur:
84-
configs = [{}]
85-
else:
86-
configs = [{}, dict(mode="fast")]
89+
configs = [{}] if args.blur else [{}, dict(mode="fast")]
8790

8891
for config in configs:
8992
stats = list(
@@ -99,7 +102,7 @@ def benchmark(args, executor):
99102
)
100103
)
101104
yield dict(
102-
resolution="%sx%s" % resolution,
105+
resolution=f"{resolution[0]}x{resolution[1]}",
103106
mode=config.get("mode", "regular"),
104107
min=min(stats),
105108
max=max(stats),

biome.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,20 @@
1616
"linter": {
1717
"enabled": true,
1818
"rules": {
19-
"recommended": true
19+
"recommended": true,
20+
"suspicious": {
21+
"noUnknownAtRules": {
22+
"level": "error",
23+
"options": {
24+
"ignore": ["tailwind"]
25+
}
26+
}
27+
}
28+
}
29+
},
30+
"css": {
31+
"parser": {
32+
"tailwindDirectives": true
2033
}
2134
},
2235
"javascript": {

blur/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# This file marks the directory as a Python package.

blur/main.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,7 @@ def process(args, path: Path, output: Path, logo=None):
101101
}
102102
if args.copy_metadata:
103103
data["copy_metadata"] = "true"
104-
105-
if args.api_key:
106-
headers = {"Authorization": f"Token {args.api_key}"}
107-
else:
108-
headers = None
104+
headers = {"Authorization": f"Token {args.api_key}"} if args.api_key else None
109105

110106
response = requests.post(
111107
args.blur_url,

blur/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
requests==2.31.0
1+
requests==2.31.0

0 commit comments

Comments
 (0)