| OLD | NEW |
| (Empty) |
| 1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. | |
| 2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr | |
| 3 # copyright 2003-2010 Sylvain Thenault, all rights reserved. | |
| 4 # contact mailto:thenault@gmail.com | |
| 5 # | |
| 6 # This file is part of logilab-astng. | |
| 7 # | |
| 8 # logilab-astng is free software: you can redistribute it and/or modify it | |
| 9 # under the terms of the GNU Lesser General Public License as published by the | |
| 10 # Free Software Foundation, either version 2.1 of the License, or (at your | |
| 11 # option) any later version. | |
| 12 # | |
| 13 # logilab-astng is distributed in the hope that it will be useful, but | |
| 14 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License | |
| 16 # for more details. | |
| 17 # | |
| 18 # You should have received a copy of the GNU Lesser General Public License along | |
| 19 # with logilab-astng. If not, see <http://www.gnu.org/licenses/>. | |
| 20 """Python Abstract Syntax Tree New Generation | |
| 21 | |
| 22 The aim of this module is to provide a common base representation of | |
| 23 python source code for projects such as pychecker, pyreverse, | |
| 24 pylint... Well, actually the development of this library is essentially | |
| 25 governed by pylint's needs. | |
| 26 | |
| 27 It extends class defined in the python's _ast module with some | |
| 28 additional methods and attributes. Instance attributes are added by a | |
| 29 builder object, which can either generate extended ast (let's call | |
| 30 them astng ;) by visiting an existent ast tree or by inspecting living | |
| 31 object. Methods are added by monkey patching ast classes. | |
| 32 | |
| 33 Main modules are: | |
| 34 | |
| 35 * nodes and scoped_nodes for more information about methods and | |
| 36 attributes added to different node classes | |
| 37 | |
| 38 * the manager contains a high level object to get astng trees from | |
| 39 source files and living objects. It maintains a cache of previously | |
| 40 constructed tree for quick access | |
| 41 | |
| 42 * builder contains the class responsible to build astng trees | |
| 43 """ | |
| 44 __doctype__ = "restructuredtext en" | |
| 45 | |
| 46 import sys | |
| 47 if sys.version_info >= (3, 0): | |
| 48 BUILTINS_MODULE = 'builtins' | |
| 49 else: | |
| 50 BUILTINS_MODULE = '__builtin__' | |
| 51 | |
| 52 # WARNING: internal imports order matters ! | |
| 53 | |
| 54 # make all exception classes accessible from astng package | |
| 55 from logilab.astng.exceptions import * | |
| 56 | |
| 57 # make all node classes accessible from astng package | |
| 58 from logilab.astng.nodes import * | |
| 59 | |
| 60 # trigger extra monkey-patching | |
| 61 from logilab.astng import inference | |
| 62 | |
| 63 # more stuff available | |
| 64 from logilab.astng import raw_building | |
| 65 from logilab.astng.bases import YES, Instance, BoundMethod, UnboundMethod | |
| 66 from logilab.astng.node_classes import are_exclusive, unpack_infer | |
| 67 from logilab.astng.scoped_nodes import builtin_lookup | |
| 68 | |
| 69 # make a manager instance (borg) as well as Project and Package classes | |
| 70 # accessible from astng package | |
| 71 from logilab.astng.manager import ASTNGManager, Project | |
| 72 MANAGER = ASTNGManager() | |
| 73 del ASTNGManager | |
| OLD | NEW |