chore: Refactor glance animtions, p=#10690

This commit is contained in:
mr. m
2025-10-05 18:57:35 +02:00
committed by GitHub
parent 3ac31a96a6
commit f273cd8fd1
14 changed files with 1322 additions and 461 deletions

View File

@@ -6,6 +6,7 @@ import os
import sys
import json
from pathlib import Path
from typing import Any
IGNORE_PREFS_FILE_IN = os.path.join(
'src', 'zen', 'tests', 'ignorePrefs.json'
@@ -15,6 +16,15 @@ IGNORE_PREFS_FILE_OUT = os.path.join(
)
class JSONWithCommentsDecoder(json.JSONDecoder):
def __init__(self, **kw):
super().__init__(**kw)
def decode(self, s: str) -> Any:
s = '\n'.join(l for l in s.split('\n') if not l.lstrip(' ').startswith('//'))
return super().decode(s)
def copy_ignore_prefs():
print("Copying ignorePrefs.json from src/zen/tests to engine/testing/mochitest...")
# if there are prefs that dont exist on output file, copy them from input file
@@ -22,7 +32,7 @@ def copy_ignore_prefs():
with open(IGNORE_PREFS_FILE_OUT, 'r') as f:
all_prefs = json.load(f)
with open(IGNORE_PREFS_FILE_IN, 'r') as f_in:
new_prefs = json.load(f_in)
new_prefs = json.load(f_in, cls=JSONWithCommentsDecoder)
all_prefs.extend(p for p in new_prefs if p not in all_prefs)
with open(IGNORE_PREFS_FILE_OUT, 'w') as f_out:
json.dump(all_prefs, f_out, indent=2)