] > RE: [ANN] pylint-0.2 (Logilab.org)

Email RE: [ANN] pylint-0.2

from
to
Sylvain Thenault <syt at logilab dot fr>
subject
RE: [ANN] pylint-0.2
date
2003/10/14 10:53
Hi Sylvain,

It would appear to get broken on an embedded function. If I comment out the
entire definition of "arrange_by_surname" in the following code then pylint
nolonger crashes (either comment out the if test prior to the definition or
add 'None' after it). This may or may not be bad Python ( :-) ), but it was
"stream of conscious coding" at the time I did it, so that is where the
definition ended up going. I can easily understand why none of your tests
found this one :-)

Thanks
Peter

  def read_roll (self, sorted = 1, by_surname = 1, activeonly = 1):
    """ Read the roll. Allow sorting and selection of active or all children
-
    i.e. children are never 'deleted', they just become inactive."""
    # first take a copy
    sorted_list = self.names[0:]

    # first step is to remove that children who have not been marked as
present
    # - but only if the 'activeonly' flag is set!

    if activeonly == 1:
      for i in self.names:
        if self.state[i] == 0:
          sorted_list.remove(i)

    if by_surname == 1:

      def arrange_by_surname (element):
        """Function used to help sort lists of names."""
        data = string.split(element)
        if len(data) > 2:
          # Have a multiple element surname
          result = '%s, %s' % (string.join(data[1:]), data[0])
        else:
          # Normal dual name
          result = '%s, %s' % (data[1], data[0])

        return result

      sorted_list = map(arrange_by_surname, sorted_list)

    if sorted == 1:
      # Now order it alphabetically
      sorted_list.sort()

    self.roll_changed = 0

    return sorted_list



-----Original Message-----
From: Sylvain Thénault [mailto:Sylvain.Thenault@logilab.fr]
Sent: Tuesday, October 07, 2003 9:08 PM
To: Peter Milliken
Subject: Re: [ANN] pylint-0.2


On Friday 03 October à 12:35, Peter Milliken wrote:
> Sylvain,

> I am on leave (starting this afternoon) for a week - will be back on the
> 14th October, 2003. So if you send me any updates I won't be here to
respond
> :-)

ok. When you'll be back, could you send me the module that breaks
pylint ?  I would really need it to debug this since I'm not able to
reproduce it.
Thanks
-- 
Sylvain Thénault                               LOGILAB, Paris (France).

http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org