From d92a2fbd47004128d6c05ac16a5d310845a2ca6a Mon Sep 17 00:00:00 2001 From: Andrew Lin Date: Thu, 9 Jul 2015 14:03:24 -0400 Subject: [PATCH] Close a file a little earlier. Former-commit-id: b4bae84aac7dda6314467a42c16e7f24959a3540 --- wordfreq/__init__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/wordfreq/__init__.py b/wordfreq/__init__.py index 80244e1..857995b 100644 --- a/wordfreq/__init__.py +++ b/wordfreq/__init__.py @@ -114,13 +114,13 @@ def read_cBpack(filename): """ with gzip.open(filename, 'rb') as infile: data = msgpack.load(infile, encoding='utf-8') - header = data[0] - if ( - not isinstance(header, dict) or header.get('format') != 'cB' - or header.get('version') != 1 - ): - raise ValueError("Unexpected header: %r" % header) - return data[1:] + header = data[0] + if ( + not isinstance(header, dict) or header.get('format') != 'cB' + or header.get('version') != 1 + ): + raise ValueError("Unexpected header: %r" % header) + return data[1:] def available_languages(wordlist='combined'):