aboutsummaryrefslogtreecommitdiff
path: root/gen
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-04-29 17:54:30 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-04-29 17:54:30 +0200
commit08b8a6d6b483ecf2c5b0b0dcc3c6d706d441936b (patch)
treebb807e1a46b00351c32db6e5f843dd77f9424f2a /gen
parentd332d2a58a9438a69801dbdc8358b99c4f16f705 (diff)
Use ‘with’ syntax
Diffstat (limited to 'gen')
-rwxr-xr-xgen/prop/age5
1 files changed, 3 insertions, 2 deletions
diff --git a/gen/prop/age b/gen/prop/age
index 5733344..7105ae1 100755
--- a/gen/prop/age
+++ b/gen/prop/age
@@ -71,7 +71,6 @@ uprop_get_age(rune ch)
def main() -> None:
cwd_init()
- sys.stdout = open('lib/unicode/prop/uprop_get_age.c', 'w')
xs = parse('data/DerivedAge')
blksize = -1
@@ -92,7 +91,9 @@ def main() -> None:
blksize = bs
Cs = [tuple(x) for x in chunks(xs, blksize)]
- genfile(Cs, blksize)
+ with open('lib/unicode/prop/uprop_get_age.c', 'w') as f:
+ sys.stdout = f
+ genfile(Cs, blksize)
if __name__ == '__main__':
main()