-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add suggested features #1
Conversation
@alexmojaki Am I reading the output correctly in that you expect the faulty line to not be present in the expected output? |
Pull Request Test Coverage Report for Build 2089795818
💛 - Coveralls |
python_runner/runner.py
Outdated
@@ -35,6 +35,22 @@ def __init__( | |||
def set_callback(self, callback): | |||
self._callback = callback | |||
|
|||
def set_source_code(self, source_code, filename): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This signature is weird. Internally, only one argument is really being used at a time. Is it because of something you want to do externally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it is linked to keeping the source code as an attribute. However, to work properly, the source code needs a filename attached to it to have a proper meaning. Both arguments are also used, so I'm not sure what you mean by one at a time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I meant was that either it was only really setting filename
(with source_code="") or only really setting source_code (since filename=self.filename doesn't do much).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The source code could be different from "" in the constructor. However, setting the file separately might also make more sense. If you are changing between files in your editor, you probably don't want to run it immediately but still inform the runner of changes. I'll split it into two methods.
I think your idea of making source_code an attribute is a good one. |
Thanks! |
@alexmojaki Will this then be released on PyPi so I can refactor my own Python code in Papyros for these changes? |
Done. |
This PR adds the features discussed here.
The code is backed by a file using set_source_code, which is called in pre_run.
Overrides for builtins are set in pre_run.