Phase-2

July 24, 2017

Phase 2 is coming to an end today (24’th of July, 11:30 PM IST). It had been an intensive and healthy work-period with a high steep-learning curve. Let me reflect on my journey throughout the month.

Overview

Differentiating between functions and classes

vulture previously saved the defined_classes in the defined_functions list. I just needed to change the visitClassDef function which is triggered whenever ast finds any Class Definition node.

Allow running “python -m vulture”

Changing the entry_point did the work. :-)

Choose whitelists depending on used imports

So, our plan was to make whitelists for some modules default based on whether or not thaat corresponding module was imported or not.

In the previous phase, we started shipping vulture as a package. Because of the change, we could now ship additional data with the package, like the

Source Range Acquisition

Perhaps, the most important part of my GSoC Proposal. The idea was to implement such a function which if given an ast node could find it’s end. For demo purposes, we started source. From the first commit [here] to the current implementation, there is affiliated an impressive amount of research, debigging and creativity (special credits to @jendrikseipp).

Let item inherit from object rather than str

vulture stores dead code in a special data structure - Item - a lightwight representation of the ast node. Previously, Item inherited from str although there was no absolute need of doing so, and changing it would give us more command and flexibilty with the design. So, we decided to change it. The implementation was pretty basic. You may see the changes here:commit

This required me to run vulture over a few web-apps powered by both, flask and django. Analysing flasky, the book on flask, we uncovered several interesting facts and surprisingly, we ended up making a whitelist for the unittest library.

Other things

I read @damngamerz post on EuroPython and felt pretty thrilled. I also recieved the news that we are gonna hack PyCon India (or Pune) and make it coalaCon. We will also get coala stickers. Yay!

It has been a pretty awesome journey up till now. I really accredit this to both, my mentor @jendrikseipp and student-admin @jayvdb and to the awesome coala community where every one is so open minded and intelligent.

Thanks! :-)

Phase-2 - July 24, 2017 - Rahul Jha