On Fri, 17 Apr 2020 18:01:42 -0400 Nick Mathewson nickm@freehaven.net wrote:
If you want to work on this it would be helpful to maybe start by listing (here or elsewhere) some places where you *don't* feel like you could (or would want to) write documentation: those would be a good target for devs who _have_ worked on Chutney before.
I came across Node.specialize() which does not seem to be called elsewhere, and I cannot guess at its purpose. So, if anyone knows off the top of their head what this is for (not what it does, because it's quite obvious from the code itself) then I'd greatly appreciate and I will document its purpose accordingly. It is one of the functions that is listed as "to be called by the user".
Other than that I added docstrings where they were missing in TorNet (useful both for Python's on-line help() and for checking whether code agrees with intent) and made mental note of some areas I would like to improve in the code (changing function names to better align with what they actually do, figure out if some longer functions can be split into more atomical and easier-to-digest parts, ...).
Caitlin
On Sat, 18 Apr 2020 11:02:03 +0000 c c@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?
Caitlin
On Thu, May 14, 2020 at 7:04 PM c c@chroniko.jp wrote:
On Sat, 18 Apr 2020 11:02:03 +0000 c c@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.
Hi Caitlin,
On 15 May 2020, at 09:59, Nick Mathewson nickm@freehaven.net wrote:
On Thu, May 14, 2020 at 7:04 PM c c@chroniko.jp wrote:
On Sat, 18 Apr 2020 11:02:03 +0000 c c@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.
You could try deleting functions, and then running tor's "make test-network-all". If that test still passes, then the code is probably unused (in practice).
Chutney's CI does a few more tests for different tor versions, but I'm pretty sure they all use the same code.
T