summaryrefslogtreecommitdiff
path: root/astroid/builder.py
Commit message (Collapse)AuthorAgeFilesLines
* Even more granular copyrights (thanks to copyrite)Claudiu Popa2016-07-221-2/+5
|
* Keep a consistent copyright notice across the board.Claudiu Popa2016-07-191-0/+2
|
* New function, astroid.extract_node, exported out from astroid.test_utils.Claudiu Popa2016-06-291-0/+176
|
* Convert all files to new license headerCeridwen2016-05-171-17/+3
|
* Build a dummy module object for namespace directories and add a test for ↵Claudiu Popa2016-05-091-0/+5
| | | | multiple directories contributing to the same namespace.
* Don't take in consideration invalid assignments, especially when __slots__ ↵Claudiu Popa2016-04-251-0/+4
| | | | | | declaration forbids them. Close issue #332
* Separate the UnboundMethod from BoundMethodClaudiu Popa2016-02-271-1/+1
| | | | | They were previously tied because UnboundMethod had logic for type.__new__. Now this logic was moved into a brain tip, simplifying the implementations of the methods.
* Revert "Try to solve the packaging issues again"Claudiu Popa2016-02-111-0/+249
| | | | This reverts commit d37b81de4f1e64abc2f222c487785d816ab469ea.
* Try to solve the packaging issues againCeridwen2016-02-081-249/+0
|
* Fix an undefined-variable, which was caught by pylint, but ignored lately.Claudiu Popa2015-12-111-1/+1
|
* AstroidBuildingException is now AstroidBuildingError, the former being ↵Claudiu Popa2015-12-061-3/+3
| | | | removed in 2.0.
* Add two new exceptions, AstroidImportError and AstroidSyntaxError.Claudiu Popa2015-12-061-18/+10
| | | | | | | | They are subclasses of AstroidBuildingException and are raised when a module can't be imported from various reasons. Also do_import_module lets the errors to bubble up without converting them to InferenceError. This particular conversion happens only during the inference.
* Add into instance_attrs the actual AST, not the resulting tuple.Claudiu Popa2015-11-171-1/+1
|
* Merge modular-locals into 2.0Ceridwen2015-11-161-71/+55
|\
| * Finish most needed changes for building ASTs from runtime objects.Ceridwen2015-11-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add handling to generate ClassInstance nodes for instance objects. * Fix a number of special cases for building mock ASTs. * Fix an infinite recursion on Python 2 by using the new future_imports property to look up whether absolute_import is active. * Do some minor reorganization on how the builtins module is set up and accessed from various places, mostly to make debugging easier. This is in lieu of a more serious reorganization which needs to happen. * Remove Manager.infer_ast_from_something and Manager.ast_from_class as superceded by the new functions in raw_building.
| * Merge master and structured_exceptionsCeridwen2015-11-061-11/+1
| |\
| * \ Merge structured_exceptions into modular-localsCeridwen2015-11-021-8/+15
| |\ \
| * | | Fix more minor test failuresCeridwen2015-10-271-1/+1
| | | |
| * | | First draft of mock AST generation code finishedCeridwen2015-10-251-3/+6
| | | |
| * | | Transfer build_function and ast_from_function from modular_locals to zipperCeridwen2015-10-231-2/+3
| | | |
| * | | Make instance_attrs mutable again, add external_attrs, refactor delayed ↵Ceridwen2015-10-151-0/+59
| | | | | | | | | | | | | | | | assignments
| * | | Merge upstream changesCeridwen2015-10-111-1/+0
| |\ \ \
| * | | | Handle assigning instance_attrs on ClassDefs through Instances, bug fixesCeridwen2015-10-101-70/+2
| | | | |
| * | | | Example of unclear ImportErrorCeridwen2015-10-081-8/+8
| | | | |
* | | | | Merge structured exceptions into 2.0Claudiu Popa2015-11-131-8/+15
|\ \ \ \ \ | | |_|_|/ | |/| | |
| * | | | Rename Uninferable and instatiate_classCeridwen2015-11-061-1/+1
| | |_|/ | |/| |
| * | | This bookmark adds structured exceptions to astroid.Ceridwen2015-11-021-8/+15
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Major changes: * AstroidError has an __init__ that accepts arbitrary keyword-only arguments for adding information to exceptions, and a __str__ that lazily uses exception attributes to generate a message. The first positional argument to an exception is assigned to .message. The new API should be fully backwards compatible in general. * Some exceptions are combined or renamed; the old names are still available. * The OperationErrors used by pylint are now BadOperationMessages and located in util.py. * The AstroidBuildingException in _data_build stores the SyntaxError in its .error attribute rather than args[0]. * Many places where exceptions are raised have new, hopefully more useful error messages. The only major issue remaining is how to propagate information into decorators.
* | | Rename Uninferable and instantiate_class, fix broken tests, improveCeridwen2015-11-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | testing. * Rename YES to Uninferable * Rename instanciate_class to instantiate_class. * Use six in test_namedtuple_advanced_inference. * Fix test_file_from_module failure on PyPy. * Add enum34 to unittest_brain. * Add unittest_brain dependencies tox.ini.
* | | Remove the astpeepholeClaudiu Popa2015-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was initially added in order to remove a recursion error in rebuilder, which happened when a lot of strings were added together, leading to an actual recursion error when executing the code. The peepholer was more of a constant folding algorithm rather than a real peepholer. Since it's purpose is limited and the original problem is not worth fixing in astroid, but in the user code, this is removed. Closes issue #210
* | | Separate class instances and builtin instances into two conceptsClaudiu Popa2015-11-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One problem with handling both concepts with a single class leads to type-testing using type identity rather than using isinstance, since builtin instances uses the same base class as class instances (even though this is fairly fuzzy). With two classes instead, we can easily distinguish between these cases. The commit includes two new virtual base classes, Instance and BuiltinInstance and separates the Instance class into BaseInstance and Instance, also changing in some places the use of type-identity testing with isinstance testing. Closes issue #214.
* | | Merge runtime namespace with interpreter namespace.Claudiu Popa2015-11-011-1/+1
| | |
* | | Move rebuilder.py into the tree namespaceClaudiu Popa2015-11-011-1/+1
| | |
* | | Separate runtime objects from ASTsClaudiu Popa2015-11-011-3/+3
|/ / | | | | | | | | | | | | The runtime objects from astroid.bases and astroid.objects got merged together into astroid.runtime.objects. bases._infer_stmts was moved into a new namespace, interpreter, which should be the starting point of a the new abstract interpretation component.
* | Remove doctype and future imports which aren't useful.Claudiu Popa2015-10-111-1/+0
|/
* Fix a regression with the reraise of AstroidBuildingException.Claudiu Popa2015-09-261-1/+6
| | | | | | The entire original exception object needs to be passed to AstroidBuildingException in builder.AstroidBuilder._file_build, since pylint uses this as an introspection method, in order to find what error happened.
* Add helper function for reraising exceptionsCeridwen2015-09-211-14/+4
|
* Use six.reraise to avoid losing tracebacks for simple casesCeridwen2015-09-211-7/+16
|
* Merge main into defaultCeridwen2015-08-141-12/+27
|\
| * Move YES to astroid.util.Claudiu Popa2015-08-091-1/+2
| | | | | | | | | | | | | | YES is needed by other components of astroid, components which aren't necessarily related to astroid.bases. In order to reduce circular interdependencies between components, YES is moved into a new module, tailored for various *utilities*.
| * Fix pylint warnings.Claudiu Popa2015-08-021-1/+1
| |
| * There's a new separate step for transforms.Claudiu Popa2015-08-021-11/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, the transforms were applied at the same time the tree was being built. This was problematic if the transform functions were using inference, since the inference was executed on a partially constructed tree, which led to failures when post-building information was needed (such as setting the _from_names for the From imports). Now there's a separate step for transforms, which are applied using transform.TransformVisitor. There's a couple of other related changes: * astroid.parse and AstroidBuilder gained a new parameter `apply_transforms`, which is a boolean flag, which will control if the transforms are applied. We do this because there are uses when the vanilla tree is wanted, without any implicit modification. * the transforms are also applied for builtin modules, as a side effect of the fact that transform visiting was moved in AstroidBuilder._post_build from AstroidBuilder._data_build. Closes issue #116.
* | Fix code review comments.Ceridwen2015-07-131-2/+2
| | | | | | | | | | | | | | | | Added aliases for inferred() and assign_type(), refactor some uses of ternary if, remove some now-unused internal functions in rebuilder, replaced the mutating docstring function with one that returns values as well as side-effects, change back to lazy-object-proxy, and add keyword args to the Module call in rebuilder.
* | Merge logilab/astroid againCeridwen2015-07-111-61/+68
|\ \ | |/
| * Fix pylint issues.Claudiu Popa2015-07-111-1/+1
| |
| * Add a new convenience API, `astroid.parse`.Claudiu Popa2015-07-111-0/+13
| | | | | | | | | | | | This API can be used to retrieve an astroid AST from a source code string, similar to how ast.parse can be used to obtain a Python AST from a source string. This is the test_utils.build_module promoted to a public API.
| * Cleanup builder.pyClaudiu Popa2015-07-111-62/+56
| |
* | Node constructors almost finished except for two bugsCeridwen2015-07-081-9/+9
|/
* Fix Pylint warnings over astroid.Claudiu Popa2015-05-241-0/+1
|
* Add some fixes which enhances the Jython support.Claudiu Popa2015-03-301-2/+2
| | | | | | | The fix mostly includes updates to modutils, which is modified in order to properly lookup paths from live objects, which ends in $py.class, not pyc as for Python 2, Closes issue #83.
* Catch SyntaxError in astroid.builder.AstroidBuilder._data_build and reraise ↵Claudiu Popa2015-03-171-1/+1
| | | | it as AstroidBuildingException.