We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c18842b + 29bcf2c commit 6ef5e61Copy full SHA for 6ef5e61
pkgs/by-name/_1/_1password-gui/update-sources.py
@@ -14,14 +14,12 @@
14
15
class Sources(OrderedDict):
16
def __init__(self):
17
- self._jsonfp = open("sources.json", "r+")
18
- self.update(json.load(self._jsonfp))
19
- self._jsonfp.seek(0, os.SEEK_SET)
+ with open("sources.json", "r") as fp:
+ self.update(json.load(fp))
20
21
def persist(self):
22
- json.dump(self, self._jsonfp, indent=2)
23
- self._jsonfp.write("\n") # keep fmt.check happy
24
-
+ with open("sources.json", "w") as fp:
+ print(json.dumps(self, indent=2), file=fp)
25
26
class GPG:
27
def __new__(cls):
0 commit comments