aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2024-11-17 20:20:48 +1300
committerTom Ryder <tom@sanctum.geek.nz>2024-11-17 20:20:58 +1300
commit2cc2258b5b1e9f2c4c04d04355c79e965421a35d (patch)
treec8e7bc1bf5fbb78937b18fe5db914e2b8c867478
parentHandle edge case: empty file after edit (diff)
downloadvixf-2cc2258b5b1e9f2c4c04d04355c79e965421a35d.tar.gz
vixf-2cc2258b5b1e9f2c4c04d04355c79e965421a35d.zip
Move encoding fetch inline
We're explicit about using the locale encoding to appease pylint, which doesn't like its being implicit. This is what it does by default anyway.
-rw-r--r--vixf.py37
1 files changed, 5 insertions, 2 deletions
diff --git a/vixf.py3 b/vixf.py3
index de307e9..87f8da7 100644
--- a/vixf.py3
+++ b/vixf.py3
@@ -73,8 +73,11 @@ def main(environ):
]
subprocess.run(command, check=True)
- encoding = locale.getpreferredencoding()
- with open(tf.name, mode='r', encoding=encoding) as tfr:
+ with open(
+ tf.name,
+ mode='r',
+ encoding=locale.getpreferredencoding(),
+ ) as tfr:
content_after = tfr.read()
# If any data in the file after edit, copy it to the clipboard