diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-04-19 16:37:00 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-04-19 16:37:00 +0200 |
commit | f162ae0de0f71391c56957389cc3c8babc8022e1 (patch) | |
tree | c85c8117da6e20fe49f91c933d8c7e57eb808cb8 /pyload/remote/socketbackend | |
parent | Merge pull request #8 from ardi69/0.4.10 (diff) | |
download | pyload-f162ae0de0f71391c56957389cc3c8babc8022e1.tar.xz |
Use with statement
Diffstat (limited to 'pyload/remote/socketbackend')
-rw-r--r-- | pyload/remote/socketbackend/create_ttypes.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pyload/remote/socketbackend/create_ttypes.py b/pyload/remote/socketbackend/create_ttypes.py index 9b001f1bf..26dd5d06b 100644 --- a/pyload/remote/socketbackend/create_ttypes.py +++ b/pyload/remote/socketbackend/create_ttypes.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- +from __future__ import with_statement + import inspect import os import platform @@ -30,10 +32,9 @@ def main(): enums.append(klass) - f = open(os.path.join(pypath, "pyload", "api", "types.py"), "wb") - - f.write( - """# -*- coding: utf-8 -*- + with open(os.path.join(pypath, "pyload", "api", "types.py"), "wb") as f: + f.write( +"""# -*- coding: utf-8 -*- # Autogenerated by pyload # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING |