: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=(),