summaryrefslogtreecommitdiff
path: root/astroid/node_classes.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Public facing node documentationAshley Whetter2017-11-051-148/+2331
|
* Fix lint warningsClaudiu Popa2017-10-121-2/+4
|
* Arguments node gained a new attribute, kwonlyargs_annotations, for holding ↵Claudiu Popa2017-04-121-3/+12
| | | | the keyword-only args annotations
* Add support for asynchronous comprehensions (#400)Łukasz Rogalski2017-03-011-1/+4
| | | Closes #399
* Add support for Python 3.6's annotated assignment nodesrr-2017-02-091-0/+17
|
* Make is_argument search kwonlyargs. (#386)Derek Gustafson2017-01-221-1/+2
|
* Raise AstroidTypeError whenever a slice cannot be inferred, instead of ↵Claudiu Popa2016-12-181-1/+4
| | | | raising TypeError and letting the upper context to handle it.
* Remove occurrences of no-else-return and consider-using-ternaryClaudiu Popa2016-12-181-11/+7
|
* Reraise the exceptions as astroid exceptions in .getitem.Claudiu Popa2016-12-031-5/+9
|
* Let the type error propagate as an AstroidTypeError.Claudiu Popa2016-12-031-24/+40
|
* Remove pylint errorsDerek Gustafson2016-12-031-9/+8
|
* getitem() method accepts nodes now, instead of Python objects.Claudiu Popa2016-11-211-12/+67
|
* add format string support (#365)Jared Garst2016-10-241-0/+22
| | | Format strings require support for two new nodes, FormattedValue, respectively JoinedStr.
* Even more granular copyrights (thanks to copyrite)Claudiu Popa2016-07-221-2/+6
|
* Keep a consistent copyright notice across the board.Claudiu Popa2016-07-191-0/+2
|
* Introduce a special attributes modelClaudiu Popa2016-06-031-0/+11
| | | | | | | | Through this model, astroid starts knowing special attributes of certain Python objects, such as functions, classes, super objects and so on. This was previously possible before, but now the lookup and the attributes themselves are separated into a new module, objectmodel.py, which describes, in a more comprehensive way, the data model of each object.
* Fix typosJakub Wilk2016-06-021-10/+10
|
* Convert all files to new license headerCeridwen2016-05-161-17/+3
|
* Propagate error information to @raise_if_nothing_inferred in unpack_infer()Ceridwen2016-01-151-2/+7
|
* Fix unpack_infer to fail if results are emptyDave Baum2016-01-151-0/+1
| | | | | This should prevent a StopIteration leaking when next is called over unpack_infer.
* Enforce strong updates per frames.Claudiu Popa2016-01-121-3/+0
| | | | | | | | | | | | When looking up a name in a scope, Scope.lookup will return only the values which will be reachable after execution, as seen in the following code: a = 1 a = 2 In this case it doesn't make sense to return two values, but only the last one.
* Fix pylint errors.Claudiu Popa2015-12-141-0/+1
|
* Cleanup pylint's warnings over astroid codebaseClaudiu Popa2015-12-141-12/+30
| | | | | | | | | | 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.
* Ignore elements of sequences when converting them to AST with const_factoryClaudiu Popa2015-12-111-1/+11
| | | | | | | | | | | | | | | const_factory is buggy in master, as well as the entire raw_building module, which means that at given points during rebuilding of ASTs from live objects, nodes are constructed with Python objects as elements, leading to various crashes with pylint and with astroid during certain inference paths. This is fixed in 2.0 though, where raw_building was completely rewritten, but bringing those changes back into master will need some more work to be done. Until this happens, we ignore the elements of sequences passed to const_factory, since they are not useful in anyway (and the code that uses them crashes anyway). This is just a temporary solution until we either merge master with 2.0 or backport raw_building changes from 2.0 to master.
* Some nodes got a new attribute, 'ctx', which tells in which context the said ↵Claudiu Popa2015-12-081-0/+25
| | | | | | | | | | | | | | | | | | | node was used. The possible values for the contexts are `Load` ('a'), `Del` ('del a'), `Store` ('a = 4') and the nodes that got the new attribute are Starred, Subscript, List and Tuple. The builtin ast module provides contexts for Name and Attribute as well, but we took a different approach in the past, by having different nodes for each type of context. For instance, Name used in a Del context is a DelName, while Name used in a Store context is AssignName. Since this is ingrained in astroid since quite some time, it makes no sense to change them as well, even though it's a loss of consistency. The patch introduces a new dependency to enum34 on older Python versions, which is used for building the three possible enum values for the contexts. Closes issue #267.
* assigned_stmts methods have the same signature from now on.Claudiu Popa2015-12-051-2/+25
| | | | | | | They used to have different signatures and each one made assumptions about what could be passed to other implementations, leading to various possible crashes when one or more arguments weren't given. Closes issue #277.
* Merge structured exceptions into masterClaudiu Popa2015-11-231-8/+9
|\
| * Rename Uninferable and instatiate_classCeridwen2015-11-061-7/+7
| |
| * This bookmark adds structured exceptions to astroid.Ceridwen2015-11-021-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Handle the cases when a List can contain Uninferable as its elementsClaudiu Popa2015-11-231-0/+3
| | | | | | | | | | | | | | This can happen for instance when the list contains objects which weren't inferable in the first place. There were a bunch of places affected by this bug: unpack_infer, the inference of list additions and the handling of the namedtuple's fields.
* | Rename Uninferable and instantiate_class, fix broken tests, improveCeridwen2015-11-061-7/+7
|/ | | | | | | | | | | 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.
* Fix Arguments' _other_fieldsCeridwen2015-10-121-1/+1
|
* Move proxy_alias function to util.pyClaudiu Popa2015-10-111-25/+8
|
* Move bases.NodeNG and bases.Statement in node_classesClaudiu Popa2015-10-111-55/+530
| | | | | | We're doing this in order to reduce the dependency hell which occurs when a module such as bases.py wants to use classes defined in node_classes.
* Add support for looking up into DictUnpack's value in Dict.getitemClaudiu Popa2015-10-061-0/+6
|
* Remove the value from the DictUnpack node, since it's used mostly to ↵Claudiu Popa2015-10-061-9/+1
| | | | represent the ** operation.
* Add a new node, DictUnpack, for representing the unpacking of a dict using ↵Claudiu Popa2015-10-061-0/+12
| | | | | | | | | PEP 448 This is a different approach than what the builtin ast module does, since it just uses None to represent this kind of operation, which seems conceptually wrong, due to the fact the AST contains non-AST nodes. Closes issue #206.
* Remove trailing whitespace.Claudiu Popa2015-10-031-1/+1
|
* Move objects.Slice back into nodes.SliceClaudiu Popa2015-10-031-1/+33
| | | | | | We did this because objects.Slice had more capabilities than nodes.Slice, such as inferring the slice attributes (start, stop, step) and it was used mostly for inferring the slice() builtin.
* Hopefully actually fix #185Ceridwen2015-09-261-2/+2
|
* Make instancecheck a private function.Claudiu Popa2015-09-261-2/+2
|
* Add Call.starargs and Call.kwargs propertiesClaudiu Popa2015-09-121-0/+10
| | | | | | | They were added in order to have a minimum level of backward compatibility, since they were removed from the class. This is also an easy way to retrieve them, instead of looking explicitly for them in args or keywords respectively.
* Final draft of state printing after mergeCeridwen2015-09-131-7/+20
|\ | | | | | | | | | | | | | | | | | | | | | | | | This patch adds __str__` and `__repr__` methods to InferenceContext and alters the `__str__, `__repr__, and repr_tree() methods for NodeNG. The `__str__` methods print out formatted information about the object's fields; NodeNG's `__str__` method is not recursive. InferenceContext's __repr__` gives a compact representation of its fields. I slightly shortened NodeNG's `__repr__` method by removing a field that's usually empty. I rewrote repr_tree() to better format the information it contains and to display *all* the fields for each AST node, with some fields controlled by options to avoid spam. I also fixed https://bitbucket.org/logilab/astroid/issues/185/as_string-gives-wrong-result-for-keyword .
| * Second pass of the Python 3.5 support: adding Async nodes.Claudiu Popa2015-09-071-0/+18
| |
| * First pass of the Python 3.5 support.Claudiu Popa2015-09-071-7/+2
| |
* | Final draft of improved state printingCeridwen2015-09-131-3/+3
| |
* | First draft of improved state printingCeridwen2015-09-091-1/+1
|/
* Fix pylint issues.Claudiu Popa2015-08-251-0/+1
|
* Emit a warning when an old AST name is used in an isinstance call.Claudiu Popa2015-08-251-1/+8
|
* Use a stack level of 2 when emitting warnings, since the call site of the ↵Claudiu Popa2015-08-251-1/+1
| | | | deprecated method should be warned upon.