Skip to content

Commit aa5d838

Browse files
committed
[0007_no_len] use not stack instead of len(stack) == 0
------------------------------------------------------------------------------------------------------------ benchmark: 4 tests ------------------------------------------------------------------------------------------------------------ Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_benchmark_extract_tokens_short_simple 917.0035 (1.0) 30,542.0253 (1.0) 1,116.1783 (1.0) 703.1331 (3.24) 1,083.0117 (1.0) 41.9095 (1.0) 228;817 895.9142 (1.0) 35346 1 test_benchmark_extract_tokens_long_simple 1,332.9554 (1.45) 46,208.0352 (1.51) 1,483.3709 (1.33) 216.9831 (1.0) 1,459.0332 (1.35) 42.0259 (1.00) 820;5565 674.1402 (0.75) 183217 1 test_benchmark_extract_tokens_short_nested 1,624.9251 (1.77) 185,417.0114 (6.07) 1,924.2939 (1.72) 1,860.9511 (8.58) 1,792.0975 (1.65) 167.0560 (3.99) 722;1138 519.6711 (0.58) 89214 1 test_benchmark_extract_tokens_long_nested 2,417.0149 (2.64) 16,447,208.9382 (538.51) 3,852.3560 (3.45) 100,246.2894 (462.00) 2,707.9368 (2.50) 208.0342 (4.96) 20;836 259.5814 (0.29) 51283 1 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 parent 18b884b commit aa5d838

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

casbin/persist/adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def _extract_tokens(line):
4444
stack.append(c)
4545
elif c == "]" or c == ")":
4646
stack.pop()
47-
elif len(stack) == 0:
47+
elif not stack:
4848
# must be a comma outside of any nesting: we've found the end of a top level token so
4949
# save that and start a new one
5050
tokens.append(line[start_idx : match.start()])

0 commit comments

Comments
 (0)