mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-07 12:05:33 +00:00
fix(pipreqs): correct regex for docstring
This commit is contained in:
parent
5a01ec01e9
commit
d9434a5ac9
@ -57,7 +57,7 @@ def get_all_imports(path, encoding=None):
|
|||||||
for file_name in files:
|
for file_name in files:
|
||||||
with open_func(os.path.join(root, file_name), "r", encoding=encoding) as f:
|
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), '', f.read())
|
||||||
contents = re.sub(re.compile('""".+"""', re.DOTALL), "", contents)
|
contents = re.sub(re.compile('""".+?"""', re.DOTALL), "", contents)
|
||||||
lines = contents.split("\n")
|
lines = contents.split("\n")
|
||||||
lines = filter(
|
lines = filter(
|
||||||
filter_line, map(lambda l: l.partition("#")[0].strip(), lines))
|
filter_line, map(lambda l: l.partition("#")[0].strip(), lines))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user