209 |
209 |
210 @param filename name of the Python file to be analyzed (string) |
210 @param filename name of the Python file to be analyzed (string) |
211 @param total dictionary receiving the overall code statistics |
211 @param total dictionary receiving the overall code statistics |
212 @return a statistics object with the collected code statistics (SourceStat) |
212 @return a statistics object with the collected code statistics (SourceStat) |
213 """ |
213 """ |
214 file = open(filename, 'r') |
|
215 try: |
214 try: |
216 text = file.read() |
215 text = Utilities.readEncodedFile(filename)[0] |
217 finally: |
216 except (UnicodeError, IOError): |
218 file.close() |
217 return SourceStat() |
219 |
218 |
220 parser = Parser() |
219 parser = Parser() |
221 parser.parse(text) |
220 parser.parse(text) |
222 |
221 |
223 stats = SourceStat() |
222 stats = SourceStat() |