Check the given path, printing out any warnings detected. @param reporter: A L{Reporter} instance, where errors and warnings will be reported. @return: the number of warnings printed
(filename, reporter=None)
| 52 | |
| 53 | |
| 54 | def checkPath(filename, reporter=None): |
| 55 | """ |
| 56 | Check the given path, printing out any warnings detected. |
| 57 | |
| 58 | @param reporter: A L{Reporter} instance, where errors and warnings will be |
| 59 | reported. |
| 60 | |
| 61 | @return: the number of warnings printed |
| 62 | """ |
| 63 | if reporter is None: |
| 64 | reporter = modReporter._makeDefaultReporter() |
| 65 | try: |
| 66 | with open(filename, 'rb') as f: |
| 67 | codestr = f.read() |
| 68 | except OSError as e: |
| 69 | reporter.unexpectedError(filename, e.args[1]) |
| 70 | return 1 |
| 71 | return check(codestr, filename, reporter) |
| 72 | |
| 73 | |
| 74 | def isPythonFile(filename): |
searching dependent graphs…