[tor-dev] Chutney code refactoring

Nick Mathewson nickm at freehaven.net
Thu May 14 23:58:45 UTC 2020


On Thu, May 14, 2020 at 7:04 PM c <c at chroniko.jp> wrote:
>
> On Sat, 18 Apr 2020 11:02:03 +0000
> c <c at chroniko.jp> wrote:
>
> > I came across Node.specialize() which does not seem to be called
> > elsewhere, and I cannot guess at its purpose.
>
> I ran vulture (a static analyzer for dead code), trimmed the output to
> omit things I know were being used (some functions/attributes are used
> solely in Python 2), and found these unused names:
>
> lib/chutney/Templating.py:280: unused function 'getUpdateTime' (60% confidence)
> lib/chutney/TorNet.py:439: unused function 'specialize' (60% confidence)
> lib/chutney/TorNet.py:658: unused function '_getFreeVars' (60% confidence)
> lib/chutney/TorNet.py:1232: unused function 'isBootstrapped' (60% confidence)
> lib/chutney/TorNet.py:1799: unused function 'isInExpectedDirInfoDocs' (60% confidence)
> lib/chutney/TorNet.py:2151: unused function 'configure' (60% confidence)
> lib/chutney/TorNet.py:2191: unused function 'restart' (60% confidence)
> lib/chutney/TorNet.py:2286: unused function 'wait_for_bootstrap' (60% confidence)
> lib/chutney/Traffic.py:335: unused attribute 'am_closing' (60% confidence)
> lib/chutney/Traffic.py:345: unused attribute 'am_closing' (60% confidence)
> lib/chutney/Traffic.py:400: unused attribute 'pending_close' (60% confidence)
> lib/chutney/Traffic.py:406: unused attribute 'dot_repetitions' (60% confidence)
>
> Aside from isBootstrapped() which we discussed previously and are
> likely going to use, is there any code that stands out as unnecessary
> or dead?

Hm. Of these:

isInExpectedDirInfoDocs looks like it might once have done something useful.

configure and restart and wait_for_bootstrap are all in use; they are
invoked by name, from the command line, at the end of runConfigFile,
where it says `return getattr(network, verb)()`.

I think the rest are likely to be unused.


More information about the tor-dev mailing list