_1password-gui: Fix update-sources.py truncation bug (#422521)

Changed files
+4 -6
pkgs
by-name
_1
_1password-gui
+4 -6
pkgs/by-name/_1/_1password-gui/update-sources.py
···
class Sources(OrderedDict):
def __init__(self):
-
self._jsonfp = open("sources.json", "r+")
-
self.update(json.load(self._jsonfp))
-
self._jsonfp.seek(0, os.SEEK_SET)
def persist(self):
-
json.dump(self, self._jsonfp, indent=2)
-
self._jsonfp.write("\n") # keep fmt.check happy
-
class GPG:
def __new__(cls):
···
class Sources(OrderedDict):
def __init__(self):
+
with open("sources.json", "r") as fp:
+
self.update(json.load(fp))
def persist(self):
+
with open("sources.json", "w") as fp:
+
print(json.dumps(self, indent=2), file=fp)
class GPG:
def __new__(cls):