Fix several ResourceWarning: unclosed file in subset
This commit is contained in:
parent
2011ccf6ec
commit
ee244406ee
@ -3253,7 +3253,8 @@ def main(args=None):
|
||||
text += g[7:]
|
||||
continue
|
||||
if g.startswith('--text-file='):
|
||||
text += open(g[12:], encoding='utf-8').read().replace('\n', '')
|
||||
with open(g[12:], encoding='utf-8') as f:
|
||||
text += f.read().replace('\n', '')
|
||||
continue
|
||||
if g.startswith('--unicodes='):
|
||||
if g[11:] == '*':
|
||||
@ -3262,14 +3263,16 @@ def main(args=None):
|
||||
unicodes.extend(parse_unicodes(g[11:]))
|
||||
continue
|
||||
if g.startswith('--unicodes-file='):
|
||||
for line in open(g[16:]).readlines():
|
||||
with open(g[16:]) as f:
|
||||
for line in f.readlines():
|
||||
unicodes.extend(parse_unicodes(line.split('#')[0]))
|
||||
continue
|
||||
if g.startswith('--gids='):
|
||||
gids.extend(parse_gids(g[7:]))
|
||||
continue
|
||||
if g.startswith('--gids-file='):
|
||||
for line in open(g[12:]).readlines():
|
||||
with open(g[12:]) as f:
|
||||
for line in f.readlines():
|
||||
gids.extend(parse_gids(line.split('#')[0]))
|
||||
continue
|
||||
if g.startswith('--glyphs='):
|
||||
@ -3279,7 +3282,8 @@ def main(args=None):
|
||||
glyphs.extend(parse_glyphs(g[9:]))
|
||||
continue
|
||||
if g.startswith('--glyphs-file='):
|
||||
for line in open(g[14:]).readlines():
|
||||
with open(g[14:]) as f:
|
||||
for line in f.readlines():
|
||||
glyphs.extend(parse_glyphs(line.split('#')[0]))
|
||||
continue
|
||||
glyphs.append(g)
|
||||
|
Loading…
x
Reference in New Issue
Block a user