Message ID | 20241025-better-type-annotations-v1-2-9d7a00a8d754@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Resolve some static typing errors | expand |
diff --git a/src/b4/diff.py b/src/b4/diff.py index 63e60f2fc82c95145a897c2dd319283996ed5a8a..743127ef0a1922eace81686e27cd0366f8e42f9c 100644 --- a/src/b4/diff.py +++ b/src/b4/diff.py @@ -174,8 +174,8 @@ def main(cmdargs: argparse.Namespace) -> None: sys.exit(1) if cmdargs.outdiff is not None: logger.info('Writing %s', cmdargs.outdiff) - fh = open(cmdargs.outdiff, 'w') + with open(cmdargs.outdiff, 'w') as fh: + fh.write(rdiff) else: logger.info('---') - fh = sys.stdout - fh.write(rdiff) + sys.stdout.write(rdiff)
Signed-off-by: Tamir Duberstein <tamird@gmail.com> --- src/b4/diff.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)