From: Aarni Koskela Date: Wed, 21 Sep 2016 04:58:48 +0000 (+0300) Subject: Merge pull request #436 from akx/correct-lies X-Git-Tag: v2.4.0~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=903898f97d1010f5bf39b6b6d7e153fc6c2cc15b;p=thirdparty%2Fbabel.git Merge pull request #436 from akx/correct-lies Straighten up lying extraction docstrings --- 903898f97d1010f5bf39b6b6d7e153fc6c2cc15b diff --cc babel/messages/extract.py index 1aade43f,030c3f58..efddbf5e --- a/babel/messages/extract.py +++ b/babel/messages/extract.py @@@ -229,10 -232,15 +232,12 @@@ def extract_from_file(method, filename :param strip_comment_tags: a flag that if set to `True` causes all comment tags to be removed from the collected comments. :param options: a dictionary of additional options (optional) + :returns: list of tuples of the form ``(lineno, message, comments, context)`` + :rtype: list[tuple[int, str|tuple[str], list[str], str|None] """ - fileobj = open(filename, 'rb') - try: + with open(filename, 'rb') as fileobj: return list(extract(method, fileobj, keywords, comment_tags, options, strip_comment_tags)) - finally: - fileobj.close() def extract(method, fileobj, keywords=DEFAULT_KEYWORDS, comment_tags=(),