Skip to content

Commit 22e80c2

Browse files
authored
Merge pull request #80 from kxrd/fix-issue-74
Exclude concurrent{,.futures} from stdlib if py2
2 parents 9d02b40 + 0b0f54a commit 22e80c2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pipreqs/pipreqs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@
4343

4444
if sys.version_info[0] > 2:
4545
open_func = open
46+
py2 = False
4647
else:
4748
open_func = codecs.open
49+
py2 = True
50+
py2_exclude = ["concurrent", "concurrent.futures"]
4851

4952

5053
def get_all_imports(path, encoding=None, extra_ignore_dirs=None):
@@ -102,6 +105,7 @@ def get_all_imports(path, encoding=None, extra_ignore_dirs=None):
102105

103106
with open(join("stdlib"), "r") as f:
104107
data = [x.strip() for x in f.readlines()]
108+
data = [x for x in data if x not in py2_exclude] if py2 else data
105109
return sorted(list(set(packages) - set(data)))
106110

107111

0 commit comments

Comments
 (0)