~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to utilities/xxxreport.py

  • Committer: Curtis Hovey
  • Date: 2008-08-28 19:46:35 UTC
  • mto: This revision was merged to the branch mainline in revision 6941.
  • Revision ID: curtis.hovey@canonical.com-20080828194635-puk6dy9scqhooo3x
Minor changes per review.

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
                    yield os.path.join(path, file)
82
82
 
83
83
    def _is_traversable(self, path, dir_name):
84
 
        """Return True if dir_name does not match skip_dir_pattern."""
 
84
        """Return True if path/dir_name does not match dir_re pattern."""
85
85
        return dir_re.match(os.path.join(path, dir_name)) is None
86
86
 
87
87
    def _extract_comments(self, file_path):
123
123
                elif xxx_mark is None and len(comment['context']) == 2:
124
124
                    # Finalise the comment.
125
125
                    comment['context'].append(line)
126
 
                    comment['context'] = ''.join(comment['context'])
127
 
                    comment['text'] = ''.join(comment['text']).strip()
128
 
                    comments.append(comment)
 
126
                    self._finalise_comment(comments, comment)
129
127
                    comment = None
130
128
                else:
131
129
                    raise ValueError, (
132
130
                        "comment or xxx_mark are in an unknown state.")
 
131
            if comment is not None:
 
132
                self._finalise_comment(comments, comment)
133
133
        finally:
134
134
            file.close()
135
135
        return comments
136
136
 
 
137
    def _finalise_comment(self, comments, comment):
 
138
        """Change the lists to strs and append the comment to comments."""
 
139
        comment['context'] = ''.join(comment['context'])
 
140
        comment['text'] = ''.join(comment['text']).strip()
 
141
        comments.append(comment)
 
142
 
137
143
    # The standard XXX comment form of:
138
144
    # 'XXX: First Last Name 2007-07-01 bug=nnnn spec=cccc:'
139
 
    # Colans, commas, and spaces may follow each token.
 
145
    # Colons, commas, and spaces may follow each token.
140
146
    xxx_person_date_re = re.compile(r"""
141
147
        .*XXX[:,]?[ ]                               # The XXX indicator.
142
148
        (?P<person>[a-zA-Z][^:]*[\w])[,: ]*         # The persons's nick.