diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-05 07:52:29 +0300 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-05 07:52:29 +0300 |
commit | 22ecb78b51f7e6f0234cbc0efbde4ee9a2dc466f (patch) | |
tree | 69e3bf4d53f4113f192116c252a2e410bb5b1f90 /modules/styles.py | |
parent | 390bffa81b747a7eb38ac7a0cd6dfb9fcc388151 (diff) | |
parent | 0ae2767ae6bb775de448b0d8cda1806edb2aef67 (diff) |
Merge branch 'dev' into multiple_loaded_models
Diffstat (limited to 'modules/styles.py')
-rw-r--r-- | modules/styles.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/modules/styles.py b/modules/styles.py index ec0e1bc5..0740fe1b 100644 --- a/modules/styles.py +++ b/modules/styles.py @@ -106,10 +106,7 @@ class StyleDatabase: if os.path.exists(path):
shutil.copy(path, f"{path}.bak")
- fd = os.open(path, os.O_RDWR | os.O_CREAT)
- with os.fdopen(fd, "w", encoding="utf-8-sig", newline='') as file:
- # _fields is actually part of the public API: typing.NamedTuple is a replacement for collections.NamedTuple,
- # and collections.NamedTuple has explicit documentation for accessing _fields. Same goes for _asdict()
+ with open(path, "w", encoding="utf-8-sig", newline='') as file:
writer = csv.DictWriter(file, fieldnames=PromptStyle._fields)
writer.writeheader()
writer.writerows(style._asdict() for k, style in self.styles.items())
|