161 |
161 |
162 @return generated AST |
162 @return generated AST |
163 @rtype ast.Module |
163 @rtype ast.Module |
164 """ |
164 """ |
165 source = "".join(self.__source) |
165 source = "".join(self.__source) |
166 # Check type for py2: if not str it's unicode |
|
167 if sys.version_info[0] == 2: |
|
168 try: |
|
169 source = source.encode('utf-8') |
|
170 except UnicodeError: |
|
171 pass |
|
172 |
|
173 return compile(source, self.__filename, 'exec', ast.PyCF_ONLY_AST) |
166 return compile(source, self.__filename, 'exec', ast.PyCF_ONLY_AST) |
174 |
167 |
175 def run(self): |
168 def run(self): |
176 """ |
169 """ |
177 Public method to check the given source against annotation issues. |
170 Public method to check the given source against annotation issues. |