summaryrefslogtreecommitdiff
path: root/astroid/builder.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove IOError that are an alias to OSError see PEP3151Pierre Sassoulas2021-02-171-1/+1
|
* Remove redundant open mode 'r' in opensPierre Sassoulas2021-02-171-1/+1
|
* Remove the # coding, since PEP3120 the default is UTF8Pierre Sassoulas2021-02-171-1/+0
|
* Update copyright noticehippo912021-02-151-0/+1
|
* New copyright noticeshippo912020-12-271-1/+1
|
* Fix the new violations of super-without-argumentsClaudiu Popa2020-05-121-1/+1
|
* Restructure the AST parsing heuristic to always pick the same moduleClaudiu Popa2020-04-291-10/+11
| | | | | | | | | | | | | | When a file contained a misplaced type annotation, we were retrying the parsing without type comments support. That second parsing was using the builtin ast module, but the rest of the tree utilities (the builder and rebuilder) were not aware of the new parsing module that was used to build the AST nodes a second time. This commit moves the logic of picking the parsing module and the corresponding AST node mapping in a single place, which can be used by both the builder and the rebuilder. Close PyCQA/pylint#3540 Close #773
* Add missing copyright annotations for the past releasesClaudiu Popa2020-04-271-1/+1
|
* Retry parsing a module that has invalid type commentsClaudiu Popa2019-11-261-1/+17
| | | | | | | | It is possible for a module to use comments that might be interpreted as type comments by the `ast` library. We do not want to completely crash on those invalid type comments. Close #708
* Allow attribute assignment for exception instancesClaudiu Popa2019-11-171-3/+6
|
* Initial formatting of astroidClaudiu Popa2018-10-021-36/+57
|
* Update the copyright noticesastroid-2.0Claudiu Popa2018-07-151-2/+8
|
* Raise a ValueError if there's no body to extract from in extract_node()Claudiu Popa2018-06-091-0/+3
|
* Remove some code that's always going to be the same now that we run on Python 3Claudiu Popa2018-06-041-35/+8
|
* Bring back error as we use it for exposing it as a public API in pylintClaudiu Popa2018-06-011-3/+3
|
* Replace some for statements with yield fromClaudiu Popa2018-05-311-5/+2
|
* Remove reraise() in favour of using raise..fromClaudiu Popa2018-05-311-9/+9
|
* Add support for type comments (#548)Claudiu Popa2018-05-231-5/+2
|
* pyupgrade (#549)Anthony Sottile2018-05-221-1/+1
|
* Fix lint warningsClaudiu Popa2017-10-121-0/+1
|
* Builder: fix detection of whether file is a package when there is a ↵Łukasz Rogalski2017-04-021-1/+1
| | | | | | __init__.py in filename (#408) Fixes PyCQA/pylint#1348
* Revert "Fix namespace population when wildcard import is used (#397)" (#398)Łukasz Rogalski2017-02-051-1/+1
| | | This reverts commit 3e6ef99928137a396a6ee9c75351f4194b2471e8.
* Fix namespace population when wildcard import is used (#397)Łukasz Rogalski2017-02-051-1/+1
| | | | Fix PyCQA/pylint#1312
* Remove occurrences of no-else-return and consider-using-ternaryClaudiu Popa2016-12-181-5/+4
|
* Remove pylint errorsDerek Gustafson2016-12-031-4/+1
|
* 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/+166
|
* Convert all files to new license headerCeridwen2016-05-161-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/+13
| | | | | | declaration forbids them. Close issue #332
* imported_names() got replaced by public_names()Claudiu Popa2016-02-201-1/+1
| | | | | | | | | | | Our understanding of wildcard imports through __all__ was half baked to say at least, since we couldn't account for modifications of the list, which results in tons of false positives. Instead, we replaced it with public_names(), a method which returns all the names that are publicly available in a module, that is that don't start with an underscore, even though this means that there is a possibility for other names to be leaked out even though they are not present in the __all__ variable.
* Don't use encoding in the except branch, since it's not defined.Claudiu Popa2015-12-171-2/+2
|
* Cleanup pylint's warnings over astroid codebaseClaudiu Popa2015-12-141-5/+6
| | | | | | | | | | Some of the messages were disabled in pylintrc, since they're not very useful for our case. Other parameters, such as the number of arguments / statements / attributes etc were configured so that they won't be too restrictive for our codebase, since making the code to respect them right now requires too much development changes, which is not justified by the end result. Closes issue #284.
* AstroidBuildingException is now AstroidBuildingError.Claudiu Popa2015-12-061-3/+3
| | | | The first name will exist until astroid 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.
* 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.
* 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.