<div dir="ltr"><div>I would like to see twisted code base free of pyflakes errors.</div><div><br></div><div>In this way, when someone sees pyflakes errors in his/her branch will know for sure that those errors are generated by changes in that branch. Also developers could run pyflakes on local computers, before sending a patch and have instance feedback for pyflakes errors.</div>

<div><br></div><div>One problem is that pyflakes will complain about unused imports.</div><div><br></div><div>JP suggested a fix for that and I have created a ticket:</div><a href="https://twistedmatrix.com/trac/ticket/7014">https://twistedmatrix.com/trac/ticket/7014</a><br clear="all">

<div><br></div><div>I am not sure how the suggested requireModule("OpenSSL") style API should work, but in the same comment, JP suggested to use 'namedAny' to get the same effect as the unused import.</div>

<div><br></div><div>My problem with namedAny is that it does not raise ImportError ... but rather ModuleNotFound or ObjectNotFound.</div><div><br></div><div>But I found 'namedModule' which raise ImportError</div>
<div>
<br></div><div>Here is an example of namedModule usage which should work around pyflakes errors.</div><div><br></div><div><div>Old code:</div><div><br></div><div>try:</div><div>    import threading</div><div>    threading  # Silence the linter.</div>

<div>except ImportError:</div><div>    self.assertFalse(Platform().supportsThreads())</div><div><br></div><div>New code</div><div><br></div><div>try:</div><div>    namedModule('threading')</div><div>except ImportError:</div>

<div>    self.assertFalse(Platform().supportsThreads())</div><div><br></div></div><div>What do you think, is namedModule usage acceptable or we should work at implementing the requireModule("OpenSSL") API?</div>

<div><br></div><div>Thanks!</div>-- <br>Adi Roiban
</div>