mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-06 09:56:36 +00:00
chore: Refactor glance animtions, p=#10690
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user