Skip to content

Commit

Permalink
[0007_no_len] use not stack instead of len(stack) == 0
Browse files Browse the repository at this point in the history
------------------------------------------------------------------------------------------------------------ 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
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  • Loading branch information
huonw committed Aug 26, 2024
1 parent 18b884b commit aa5d838
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion casbin/persist/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _extract_tokens(line):
stack.append(c)
elif c == "]" or c == ")":
stack.pop()
elif len(stack) == 0:
elif not stack:
# must be a comma outside of any nesting: we've found the end of a top level token so
# save that and start a new one
tokens.append(line[start_idx : match.start()])
Expand Down

0 comments on commit aa5d838

Please sign in to comment.