What did I do this week?This week was spent on the implementation of Code Type Snippets which is probably the most important part of my entire project. There were a lot of roadblocks but it has finally been implemented. The solution I used was to hack Python's
code.InteractiveConsoleand tweak it to my liking and required utility.
The output of the interactive console was then parsed into an AST (Abstract Syntax Tree). I decided to go with ASTs instead of string matching because, same code can be written in different ways, and ASTs would allow the user to do that and be more robust.
code.InteractiveConsoleemulated a REPL, I had to hack it to stop it from running endlessly, so that I could evaluate the code from the user input after every step.
What is coming next?Next I will be working on Creating the different courses for Hub. The main technical part of the project is over. I would also write the necessary documentation and add the required code optimizations. But the most important job at hand right now is to talk to my mentor, and the community in general to figure out what kind of course content they would prefer.
Did I get stuck anywhere?There were many areas where I got stuck. The biggest one being, I was not being able to import modules into my custom InteractiveConsole. I tried to tweak things around to get it to work but absolutely couldn't. So I immediately approached my mentor, David. He responded with a code snippet of the actual
code.InteractiveConsolewhere he got it to work. From, there I dissected my code and figured out the part which was throwing errors, and accordingly changed it. To my great surprise the error was coming from a deepcopy function, so I chucked it out and manually did the deepcopy, myself.