File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
src/main/kotlin/app/extractors Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ class PythonExtractor : ExtractorInterface {
21
21
val docImportRegex = Regex (""" ^([^\n]*#|\s*\"\"\"|\s*import|\s*from)[^\n]*""" )
22
22
val commentRegex = Regex (""" ^(.*#).*""" )
23
23
val extractImportRegex =
24
- Regex (""" (from\s+(\w+)[.\w+]*\s+import|import\s+(\w+[ ,\s*\w+] *))""" )
24
+ Regex (""" (from\s+(\w+)[.\w+]*\s+import|import\s+(\w+( ,\s*\w+) *))(as\s+)* """ )
25
25
}
26
26
27
27
override fun extract (files : List <DiffFile >): List <CommitStats > {
@@ -64,7 +64,7 @@ class PythonExtractor : ExtractorInterface {
64
64
fileContent.forEach {
65
65
val res = extractImportRegex.find(it)
66
66
if (res != null ) {
67
- val lineLibs = res.groupValues.last { it != " " }
67
+ val lineLibs = res.groupValues.last { it != " " && ! it.startsWith( ' , ' ) }
68
68
.split(Regex (""" ,\s*""" ))
69
69
imports.addAll(lineLibs)
70
70
}
You can’t perform that action at this time.
0 commit comments