[pythonwifi] Re: Feedback on get_nic_names_proc

[ Thread Index | Date Index | More lists.tuxfamily.org/pythonwifi Archives ]


Christoffer,

On Sat, April 18, 2015 7:22 pm, Christoffer Jerkeby wrote:
>> The second patch[1] re-factors get_nic_names_proc to avoid the
>> try..except
>> block.  The try..except inside a for loop caught my attention.  The
exception should only trigger on the first two lines -- the expected
condition is success -- so I recommend not setting up and tearing down the
> Hi I like this pattern. Others have also commented that the open should
be contextual using "as devfile". I will add this to an
> additional commit on the missing functions.

When using the open() context manager it is not necessary to manually
close the file object.  You can remove the "fileobj".close() from the
*_sysfs functions.

> One of your testcases breaks pep8 by using long lines but I think we
should let it slip.

Yes.  I now try to generally follow PEP8, but this string is a copy of the
output from 'cat /proc/net/dev'.  I think it is better, here, to match
exactly the expected values.

--
Sean






Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/