jendrikseipp / vulture

Find dead Python code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Whitelist parameter of specific function

VakarisZ opened this issue · comments

I have a vulture complaint:

C:\Users\vzilius\Desktop\infection_monkey\monkey\common\utils\IJSONSerializable.py:9: unused variable 'json_string' (100% confidence)

The method looks like:

class IJSONSerializable(ABC):
    @classmethod
    @abstractmethod
    def from_json(cls, json_string: str) -> IJSONSerializable:
        pass

The method is an abstract class method, thus it doesn't use the variable. Is there a way to whitelist this parameter without 1. changing the code 2. whitelisting everything that's json_string? Couldn't find anything in the documentation or examples, except "rename the parameter to _json_string".

For this specific example, I'd replace pass by del json_string (see README).

I don't think there's a solution that satisfies both 1. and 2. at the same time.