diff --git a/pipreqs/pipreqs.py b/pipreqs/pipreqs.py index 7e6d0c6..29bdd13 100755 --- a/pipreqs/pipreqs.py +++ b/pipreqs/pipreqs.py @@ -57,7 +57,7 @@ def get_all_imports(path, encoding=None): for file_name in files: with open_func(os.path.join(root, file_name), "r", encoding=encoding) as f: contents = re.sub(re.compile("'''.+?'''", re.DOTALL), '', f.read()) - contents = re.sub(re.compile('""".+"""', re.DOTALL), "", contents) + contents = re.sub(re.compile('""".+?"""', re.DOTALL), "", contents) lines = contents.split("\n") lines = filter( filter_line, map(lambda l: l.partition("#")[0].strip(), lines))