sqlparse
sqlparse copied to clipboard
Avoid tokens copy
Partial fix for #621:
In TokenList._token_matching()
avoid quadratic behavior resulting from taking a slice of self.tokens
during each invocation. Since we are working with indexes anyway, just generate the indexes using range()
and use normal indexing to access the desired tokens instead of calling enumerate()
with a slice from self.tokens
.
Codecov Report
Merging #622 (b4fb5de) into master (23d2993) will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## master #622 +/- ##
=======================================
Coverage 96.82% 96.82%
=======================================
Files 20 20
Lines 1514 1514
=======================================
Hits 1466 1466
Misses 48 48
Impacted Files | Coverage Δ | |
---|---|---|
sqlparse/sql.py | 97.60% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 23d2993...b4fb5de. Read the comment docs.
Nice refactoring, thank you!