John Snow cc6263c44b qapi/gen.py: update write() to be more idiomatic
Make the file handling here just a tiny bit more idiomatic.
(I realize this is heavily subjective.)

Use exist_ok=True for os.makedirs and remove the exception,
use fdopen() to wrap the file descriptor in a File-like object,
and use a context manager for managing the file pointer.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20201009161558.107041-31-jsnow@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-10-10 11:37:49 +02:00
..
2020-10-10 11:37:47 +02:00
2020-10-10 11:37:47 +02:00
2020-10-10 11:37:48 +02:00
2020-10-10 11:37:48 +02:00
2020-10-10 11:37:47 +02:00
2020-10-10 11:37:47 +02:00