Skip to content

Commit c858ec3

Browse files
chore: fix pre-commit lint errors
- Add ClassVar annotation to mutable class attrs in search.py (RUF012) - Exclude vms/public/frontend/ from prettier and eslint pre-commit hooks - Auto-format Python files via ruff Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 5898063 commit c858ec3

14 files changed

Lines changed: 998 additions & 112 deletions

File tree

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ repos:
4040
exclude: |
4141
(?x)^(
4242
vms/public/dist/.*|
43+
vms/public/frontend/.*|
4344
.*node_modules.*|
4445
.*boilerplate.*|
4546
vms/templates/includes/.*|
@@ -57,6 +58,7 @@ repos:
5758
exclude: |
5859
(?x)^(
5960
vms/public/dist/.*|
61+
vms/public/frontend/.*|
6062
cypress/.*|
6163
.*node_modules.*|
6264
.*boilerplate.*|

vms/api.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,12 @@ def rename_folder(folder_name_id: str, new_name: str):
422422
# Check for duplicate name in same project (exclude trashed)
423423
existing = frappe.db.exists(
424424
"VMS Folder",
425-
{"folder_name": new_name, "project": folder.project, "name": ["!=", folder.name], "deleted_at": ["is", "not set"]},
425+
{
426+
"folder_name": new_name,
427+
"project": folder.project,
428+
"name": ["!=", folder.name],
429+
"deleted_at": ["is", "not set"],
430+
},
426431
)
427432
if existing:
428433
frappe.throw(_("A folder named '{0}' already exists in this project").format(new_name))
@@ -744,8 +749,7 @@ def get_trash_assets(page=1, page_size=20):
744749

745750
# Enrich with user info (uploader + deleter)
746751
user_emails = list(
747-
{a.uploaded_by for a in assets if a.uploaded_by}
748-
| {a.deleted_by for a in assets if a.deleted_by}
752+
{a.uploaded_by for a in assets if a.uploaded_by} | {a.deleted_by for a in assets if a.deleted_by}
749753
)
750754
user_map = {}
751755
if user_emails:
@@ -1026,7 +1030,11 @@ def search_assets(query: str, project: str | None = None, limit: int = 10):
10261030
)
10271031
except Exception:
10281032
# Fallback to SQL LIKE search if index doesn't exist
1029-
like_filters = {"file_name": ["like", f"%{query}%"], "status": ["!=", "Uploading"], "deleted_at": ["is", "not set"]}
1033+
like_filters = {
1034+
"file_name": ["like", f"%{query}%"],
1035+
"status": ["!=", "Uploading"],
1036+
"deleted_at": ["is", "not set"],
1037+
}
10301038
if project:
10311039
like_filters["project"] = project
10321040

vms/install.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,7 @@ def _build_whisper_from_source():
147147
src_dir = Path(tmpdir) / "whisper.cpp"
148148
build_dir = src_dir / "build"
149149

150-
_run(
151-
["git", "clone", "--depth=1", f"--branch={WHISPER_CPP_VERSION}", WHISPER_CPP_REPO, str(src_dir)]
152-
)
150+
_run(["git", "clone", "--depth=1", f"--branch={WHISPER_CPP_VERSION}", WHISPER_CPP_REPO, str(src_dir)])
153151
build_dir.mkdir(exist_ok=True)
154152
_run(["cmake", "-B", str(build_dir), "-S", str(src_dir)])
155153
_run(["cmake", "--build", str(build_dir), "--config", "Release", "-j"])
@@ -162,9 +160,7 @@ def _build_whisper_from_source():
162160
if binary.exists():
163161
_run(["sudo", "install", "-m", "0755", str(binary), "/usr/local/bin/whisper-cli"])
164162
else:
165-
raise FileNotFoundError(
166-
f"whisper-cli binary not found in build output at {build_dir}"
167-
)
163+
raise FileNotFoundError(f"whisper-cli binary not found in build output at {build_dir}")
168164

169165

170166
def _run(cmd: list[str], **kwargs) -> subprocess.CompletedProcess:

vms/notifications.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ def _process_comment_notifications(comment_name):
7878
if alert_emails:
7979
is_reply = bool(comment.parent_comment)
8080
action = _("replied to your comment") if is_reply else _("commented")
81-
alert_subject = _("<b>{0}</b> {1} on <b>{2}</b>").format(
82-
commenter_name, action, asset.file_name
83-
)
81+
alert_subject = _("<b>{0}</b> {1} on <b>{2}</b>").format(commenter_name, action, asset.file_name)
8482
enqueue_create_notification(
8583
alert_emails,
8684
{

vms/proxy.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,24 @@ def _ffmpeg_proxy(input_path: str, output_path: str):
119119
"ffmpeg",
120120
"-hide_banner",
121121
"-y",
122-
"-i", input_path,
123-
"-c:v", "libx264",
124-
"-preset", "fast",
125-
"-crf", "28",
126-
"-pix_fmt", "yuv420p",
127-
"-vf", "scale='min(1280,iw)':-2",
128-
"-c:a", "aac",
129-
"-b:a", "128k",
130-
"-movflags", "+faststart",
122+
"-i",
123+
input_path,
124+
"-c:v",
125+
"libx264",
126+
"-preset",
127+
"fast",
128+
"-crf",
129+
"28",
130+
"-pix_fmt",
131+
"yuv420p",
132+
"-vf",
133+
"scale='min(1280,iw)':-2",
134+
"-c:a",
135+
"aac",
136+
"-b:a",
137+
"128k",
138+
"-movflags",
139+
"+faststart",
131140
output_path,
132141
]
133142

vms/public/frontend/sw.js

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,75 @@
1-
if(!self.define){let s,e={};const l=(l,r)=>(l=new URL(l+".js",r).href,e[l]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()}).then(()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s}));self.define=(r,i)=>{const n=s||("document"in self?document.currentScript.src:"")||location.href;if(e[n])return;let a={};const o=s=>l(s,n),t={module:{uri:n},exports:a,require:o};e[n]=Promise.all(r.map(s=>t[s]||o(s))).then(s=>(i(...s),a))}}define(["./workbox-004510d2"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"vms-logo.png",revision:"6aa35055d335a040d6eadfeafd05976d"},{url:"pwa-512x512.png",revision:"27187594c3538abaa333f5b60a1c947f"},{url:"pwa-192x192.png",revision:"5371c9ae9233f24ae2bd93426db5bf6e"},{url:"index.html",revision:"b4e7bbf812ca9be968c8e599a572d3c2"},{url:"apple-touch-icon.png",revision:"587f03ca22ec0daf2ccdc80a102df05c"},{url:"assets/workbox-window.prod.es5-CcvICf7O.js",revision:null},{url:"assets/useDownload-DtmUnrK5.js",revision:null},{url:"assets/textarea-CIf4UEi_.js",revision:null},{url:"assets/table-CFJnUA1U.js",revision:null},{url:"assets/switch-BOEG2NBU.js",revision:null},{url:"assets/popover-DUE_Hdtj.js",revision:null},{url:"assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2",revision:null},{url:"assets/inter-latin-wght-normal-Dx4kXJAl.woff2",revision:null},{url:"assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2",revision:null},{url:"assets/inter-greek-wght-normal-CkhJZR-_.woff2",revision:null},{url:"assets/inter-greek-ext-wght-normal-DlzME5K_.woff2",revision:null},{url:"assets/inter-cyrillic-wght-normal-DqGufNeO.woff2",revision:null},{url:"assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2",revision:null},{url:"assets/index-wapHyRJt.css",revision:null},{url:"assets/index-CE69mJ0e.js",revision:null},{url:"assets/checkbox-EK8zSqmV.js",revision:null},{url:"assets/card-5jHAikN0.js",revision:null},{url:"assets/calendar-BQCM0Pkh.js",revision:null},{url:"assets/alert-dialog-DLizlOWG.js",revision:null},{url:"assets/UserAvatar-_vEubEZs.js",revision:null},{url:"assets/TrashPage-D2NT3vWk.js",revision:null},{url:"assets/ToolsPage-DQA2QEc7.js",revision:null},{url:"assets/SharedProjectPage-Bsqn7dQE.js",revision:null},{url:"assets/ReviewPage-DUQSfUZt.js",revision:null},{url:"assets/ProjectsPage-BCDWf0q2.js",revision:null},{url:"assets/ProjectDetailPage-8LzaIdXd.js",revision:null},{url:"assets/MediaPlayerDialog-DERnjxAR.js",revision:null},{url:"assets/InboxPage-CkW6rQpw.js",revision:null},{url:"assets/DashboardPage-9pEcx5UJ.js",revision:null},{url:"assets/AuditLogPage-BockXIJV.js",revision:null},{url:"pwa-192x192.png",revision:"5371c9ae9233f24ae2bd93426db5bf6e"},{url:"pwa-512x512.png",revision:"27187594c3538abaa333f5b60a1c947f"},{url:"manifest.webmanifest",revision:"3484d5e8592677e350c54443ff248abd"}],{}),s.cleanupOutdatedCaches()});
1+
if (!self.define) {
2+
let s,
3+
e = {};
4+
const l = (l, r) => (
5+
(l = new URL(l + ".js", r).href),
6+
e[l] ||
7+
new Promise((e) => {
8+
if ("document" in self) {
9+
const s = document.createElement("script");
10+
(s.src = l), (s.onload = e), document.head.appendChild(s);
11+
} else (s = l), importScripts(l), e();
12+
}).then(() => {
13+
let s = e[l];
14+
if (!s) throw new Error(`Module ${l} didn’t register its module`);
15+
return s;
16+
})
17+
);
18+
self.define = (r, i) => {
19+
const n = s || ("document" in self ? document.currentScript.src : "") || location.href;
20+
if (e[n]) return;
21+
let a = {};
22+
const o = (s) => l(s, n),
23+
t = { module: { uri: n }, exports: a, require: o };
24+
e[n] = Promise.all(r.map((s) => t[s] || o(s))).then((s) => (i(...s), a));
25+
};
26+
}
27+
define(["./workbox-004510d2"], function (s) {
28+
"use strict";
29+
self.skipWaiting(),
30+
s.clientsClaim(),
31+
s.precacheAndRoute(
32+
[
33+
{ url: "vms-logo.png", revision: "6aa35055d335a040d6eadfeafd05976d" },
34+
{ url: "pwa-512x512.png", revision: "27187594c3538abaa333f5b60a1c947f" },
35+
{ url: "pwa-192x192.png", revision: "5371c9ae9233f24ae2bd93426db5bf6e" },
36+
{ url: "index.html", revision: "b4e7bbf812ca9be968c8e599a572d3c2" },
37+
{ url: "apple-touch-icon.png", revision: "587f03ca22ec0daf2ccdc80a102df05c" },
38+
{ url: "assets/workbox-window.prod.es5-CcvICf7O.js", revision: null },
39+
{ url: "assets/useDownload-DtmUnrK5.js", revision: null },
40+
{ url: "assets/textarea-CIf4UEi_.js", revision: null },
41+
{ url: "assets/table-CFJnUA1U.js", revision: null },
42+
{ url: "assets/switch-BOEG2NBU.js", revision: null },
43+
{ url: "assets/popover-DUE_Hdtj.js", revision: null },
44+
{ url: "assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2", revision: null },
45+
{ url: "assets/inter-latin-wght-normal-Dx4kXJAl.woff2", revision: null },
46+
{ url: "assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2", revision: null },
47+
{ url: "assets/inter-greek-wght-normal-CkhJZR-_.woff2", revision: null },
48+
{ url: "assets/inter-greek-ext-wght-normal-DlzME5K_.woff2", revision: null },
49+
{ url: "assets/inter-cyrillic-wght-normal-DqGufNeO.woff2", revision: null },
50+
{ url: "assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2", revision: null },
51+
{ url: "assets/index-wapHyRJt.css", revision: null },
52+
{ url: "assets/index-CE69mJ0e.js", revision: null },
53+
{ url: "assets/checkbox-EK8zSqmV.js", revision: null },
54+
{ url: "assets/card-5jHAikN0.js", revision: null },
55+
{ url: "assets/calendar-BQCM0Pkh.js", revision: null },
56+
{ url: "assets/alert-dialog-DLizlOWG.js", revision: null },
57+
{ url: "assets/UserAvatar-_vEubEZs.js", revision: null },
58+
{ url: "assets/TrashPage-D2NT3vWk.js", revision: null },
59+
{ url: "assets/ToolsPage-DQA2QEc7.js", revision: null },
60+
{ url: "assets/SharedProjectPage-Bsqn7dQE.js", revision: null },
61+
{ url: "assets/ReviewPage-DUQSfUZt.js", revision: null },
62+
{ url: "assets/ProjectsPage-BCDWf0q2.js", revision: null },
63+
{ url: "assets/ProjectDetailPage-8LzaIdXd.js", revision: null },
64+
{ url: "assets/MediaPlayerDialog-DERnjxAR.js", revision: null },
65+
{ url: "assets/InboxPage-CkW6rQpw.js", revision: null },
66+
{ url: "assets/DashboardPage-9pEcx5UJ.js", revision: null },
67+
{ url: "assets/AuditLogPage-BockXIJV.js", revision: null },
68+
{ url: "pwa-192x192.png", revision: "5371c9ae9233f24ae2bd93426db5bf6e" },
69+
{ url: "pwa-512x512.png", revision: "27187594c3538abaa333f5b60a1c947f" },
70+
{ url: "manifest.webmanifest", revision: "3484d5e8592677e350c54443ff248abd" },
71+
],
72+
{}
73+
),
74+
s.cleanupOutdatedCaches();
75+
});

0 commit comments

Comments
 (0)