Closed zhudotexe closed 2 years ago
Hello @mommothazaz123! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:
simpleeval.py
:Line 366:80: E501 line too long (82 > 79 characters) Line 368:80: E501 line too long (103 > 79 characters) Line 610:80: E501 line too long (97 > 79 characters) Line 611:80: E501 line too long (109 > 79 characters) Line 612:80: E501 line too long (81 > 79 characters) Line 626:80: E501 line too long (82 > 79 characters) Line 680:80: E501 line too long (86 > 79 characters) Line 684:80: E501 line too long (101 > 79 characters) Line 707:80: E501 line too long (86 > 79 characters) Line 726:80: E501 line too long (103 > 79 characters) Line 736:80: E501 line too long (112 > 79 characters) Line 738:80: E501 line too long (119 > 79 characters) Line 752:80: E501 line too long (101 > 79 characters) Line 784:80: E501 line too long (85 > 79 characters) Line 801:80: E501 line too long (105 > 79 characters) Line 803:80: E501 line too long (106 > 79 characters) Line 806:80: E501 line too long (93 > 79 characters) Line 838:80: E501 line too long (112 > 79 characters)
test_simpleeval.py
:Line 16:80: E501 line too long (110 > 79 characters) Line 17:80: E501 line too long (83 > 79 characters) Line 597:45: E231 missing whitespace after ':' Line 597:50: E231 missing whitespace after ':' Line 597:55: E231 missing whitespace after ':' Line 602:59: E231 missing whitespace after ':' Line 602:64: E231 missing whitespace after ':' Line 602:69: E231 missing whitespace after ':' Line 605:66: E231 missing whitespace after ',' Line 607:68: E231 missing whitespace after ':' Line 607:73: E231 missing whitespace after ':' Line 622:53: E231 missing whitespace after ':' Line 622:58: E231 missing whitespace after ':' Line 627:68: E231 missing whitespace after ':' Line 627:73: E231 missing whitespace after ':' Line 656:80: E501 line too long (83 > 79 characters) Line 823:80: E501 line too long (90 > 79 characters) Line 858:23: E231 missing whitespace after ':' Line 858:26: E231 missing whitespace after ':'
Note: This PR includes the changes in #62, #63, and #64.
I'd like to hear any comments on the idea of extending SimpleEval to execute a full body of statements, akin to py3's
exec()
function! This draft PR includes an implementation (starting on L746) that builds off of my changes in #63 ofSimpleExecutor.execute(expression)
.Additionally, I implemented multi-line statements and control flow (
if
,for
,while
,break
, etc) inExecutorWithControl
.Let me know if this sounds like something that's out of this library's scope, or if I should write up some test cases for executors!
Here's some examples of executors in action:
If-else
For
Nested control
Keyword control