Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update workflow json.dump(ensure ascii=false) #238

Merged
merged 2 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/scripts/build_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import validate

def read_extension(file: Path):
with open(file, 'r') as f:
with open(file, 'r', encoding='utf-8') as f:
extension = json.load(f)
for required_key in [
"name",
Expand All @@ -24,8 +24,8 @@ def read_extension(file: Path):
except:
# add "added": "YYYY-MM-DD"
extension["added"] = str(datetime.datetime.now().date())
with open(file, 'w') as f:
json.dump(extension, f, indent=4)
with open(file, 'w', encoding='utf-8') as f:
json.dump(extension, f, indent=4, ensure_ascii=False)
return extension


Expand All @@ -40,7 +40,7 @@ def read_extension_dir():

def update_index(exts: dict, tags: dict):
# update existing remove removed and add new extensions
with open(build_index_path, 'r') as f:
with open(build_index_path, 'r', encoding='utf-8') as f:
existing_extensions = {extension['url']: extension for extension in json.load(f)['extensions']}

for extensions_url, extension in exts.items():
Expand All @@ -51,14 +51,14 @@ def update_index(exts: dict, tags: dict):
extensions_list = [extension for extensions_url, extension in existing_extensions.items() if extensions_url in extensions]
extension_index = {'tags': tags, 'extensions': extensions_list}

with open(build_index_path, 'w') as f:
json.dump(extension_index, f, indent=4)
with open(build_index_path, 'w', encoding='utf-8') as f:
json.dump(extension_index, f, indent=4, ensure_ascii=False)
return extension_index


def update_master_index(index: dict):
# add keys from master/index that are not in extensions/tags to extensions/tags as new master/index
with open(deploy_index_path, 'r') as f:
with open(deploy_index_path, 'r', encoding='utf-8') as f:
master_exts = {extension['url']: extension for extension in json.load(f)['extensions']}

index_ext = {extension['url']: extension for extension in index['extensions']}
Expand All @@ -71,8 +71,8 @@ def update_master_index(index: dict):
index_ext[master_ext_url][master_exts_key] = master_ext[master_exts_key]

new_master_index = {'tags': index['tags'], 'extensions': list(index_ext.values())}
with open(deploy_index_path, 'w') as f:
json.dump(new_master_index, f, indent=4)
with open(deploy_index_path, 'w', encoding='utf-8') as f:
json.dump(new_master_index, f, indent=4, ensure_ascii=False)
return new_master_index


Expand Down
6 changes: 3 additions & 3 deletions .github/scripts/update_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_github_metadata(extension: dict):
index_path = Path(args.deploy_branch).joinpath('index.json')
get_github_api_call_failed = False

with open(index_path, 'r') as f:
with open(index_path, 'r', encoding='utf-8') as f:
extension_index = json.load(f)

github_api_core_rait_limit = get_github_api_limit()
Expand All @@ -90,8 +90,8 @@ def get_github_metadata(extension: dict):
threads = [executor.submit(get_github_metadata, extension) for extension in extension_index['extensions']]
wait(threads)

with open(index_path, 'w') as f:
json.dump(extension_index, f, indent=4)
with open(index_path, 'w', encoding='utf-8') as f:
json.dump(extension_index, f, indent=4, ensure_ascii=False)

get_github_api_limit()

Expand Down
2 changes: 1 addition & 1 deletion extensions/Stable-Diffusion-Webui-Civitai-Helper.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"UI related",
"online"
]
}
}
2 changes: 1 addition & 1 deletion extensions/ddetailer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"tags": [
"editing"
]
}
}
2 changes: 1 addition & 1 deletion extensions/kandinsky-for-automatic1111.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"script",
"editing"
]
}
}
2 changes: 1 addition & 1 deletion extensions/mine-diffusion.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"tags": [
"tab"
]
}
}
2 changes: 1 addition & 1 deletion extensions/sd-civitai-browser-plus.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"online"
],
"added": "2023-08-24"
}
}
2 changes: 1 addition & 1 deletion extensions/sd-webui-deoldify.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"tab",
"animation"
]
}
}
16 changes: 8 additions & 8 deletions extensions/sd-webui-lobe-theme.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "Lobe Theme",
"url": "https://github.com/canisminor1990/sd-webui-lobe-theme.git",
"description": "The modern theme for stable diffusion webui, legacy verison a.k.a kitchen theme.",
"added": "2023-06-28",
"tags": [
"UI related",
"online"
]
"name": "Lobe Theme",
"url": "https://github.com/canisminor1990/sd-webui-lobe-theme.git",
"description": "The modern theme for stable diffusion webui, legacy verison a.k.a kitchen theme.",
"added": "2023-06-28",
"tags": [
"UI related",
"online"
]
}
2 changes: 1 addition & 1 deletion extensions/sd-webui-qrcode-toolkit.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"editing",
"online"
]
}
}
2 changes: 1 addition & 1 deletion extensions/sd-webui-reactor.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"manipulations"
],
"added": "2023-10-17"
}
}
2 changes: 1 addition & 1 deletion extensions/sd-webui-roop.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"editing",
"manipulations"
]
}
}
2 changes: 1 addition & 1 deletion extensions/seamless-tile-inpainting.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"tags": [
"script"
]
}
}
2 changes: 1 addition & 1 deletion extensions/stable-diffusion-webui-composable-lora.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"tags": [
"manipulations"
]
}
}
2 changes: 1 addition & 1 deletion extensions/stable-diffusion-webui-wd14-tagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"tab",
"training"
]
}
}
4 changes: 2 additions & 2 deletions extensions/uddetailer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "\u00b5 Detection Detailer",
"name": "µ Detection Detailer",
"url": "https://github.com/wkpark/uddetailer.git",
"description": "\u00b5 Detection Detailer. Fork of ddetailer. Supports bbox/segment object detection, auto-mask and inpainting using mmdetection, mediapipe and ultralytics. also supports ControlNet.",
"description": "µ Detection Detailer. Fork of ddetailer. Supports bbox/segment object detection, auto-mask and inpainting using mmdetection, mediapipe and ultralytics. also supports ControlNet.",
"tags": [
"editing",
"manipulations"
Expand Down
Loading