forked from pylint-dev/astroid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChangeLog
2200 lines (1300 loc) · 68.7 KB
/
ChangeLog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
===================
astroid's ChangeLog
===================
What's New in astroid 2.4.0?
============================
Release Date: TBA
* Added transform for ``scipy.gaussian``
* Added a brain for ``responses``
* Allow inferring positional only arguments.
* Retry parsing a module that has invalid type comments
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
* Scope the inference to the current bound node when inferring instances of classes
When inferring instances of classes from arguments, such as ``self``
in a bound method, we could use as a hint the context's ``boundnode``,
which indicates the instance from which the inference originated.
As an example, a subclass that uses a parent's method which returns
``self``, will override the ``self`` to point to it instead of pointing
to the parent class.
Close PyCQA/pylint#3157
* Add support for inferring exception instances in all contexts
We were able to infer exception instances as ``ExceptionInstance``
only for a handful of cases, but not all. ``ExceptionInstance`` has
support for better inference of `.args` and other exception related
attributes that normal instances do not have.
This additional support should remove certain false positives related
to ``.args`` and other exception attributes in ``pylint``.
Close PyCQA/pylint#2333
* Add more supported parameters to ``subprocess.check_output``
Close #722
* Infer args unpacking of ``self``
Certain stdlib modules use ``*args`` to encapsulate
the ``self`` parameter, which results in uninferable
instances given we rely on the presence of the ``self``
argument to figure out the instance where we should be
setting attributes.
Close PyCQA/pylint#3216
* Clean up setup.py
Make pytest-runner a requirement only if running tests, similar to what was
done with McCabe.
Clean up the setup.py file, resolving a handful of minor warnings with it.
What's New in astroid 2.3.2?
============================
Release Date: TBA
* All type comments have as parent the corresponding `astroid` node
Until now they had as parent the builtin `ast` node which meant
we were operating with primitive objects instead of our own.
Close PyCQA/pylint#3174
* Pass an inference context to `metaclass()` when inferring an object type
This should prevent a bunch of recursion errors happening in pylint.
Also refactor the inference of `IfExp` nodes to use separate contexts
for each potential branch.
Close PyCQA/pylint#3152
Close PyCQA/pylint#3159
What's New in astroid 2.3.1?
============================
Release Date: 2019-09-30
* A transform for the builtin `dataclasses` module was added.
This should address various `dataclasses` issues that were surfaced
even more after the release of pylint 2.4.0.
In the previous versions of `astroid`, annotated assign nodes were
allowed to be retrieved via `getattr()` but that no longer happens
with the latest `astroid` release, as those attribute are not actual
attributes, but rather virtual ones, thus an operation such as `getattr()`
does not make sense for them.
* Update attr brain to partly understand annotated attributes
Close #656
What's New in astroid 2.3.0?
============================
Release Date: 2019-09-24
* Add a brain tip for ``subprocess.check_output``
Close #689
* Remove NodeNG.nearest method because of lack of usage in astroid and pylint.
Close #691
* Allow importing wheel files. Close #541
* Annotated AST follows PEP8 coding style when converted to string.
* Fix a bug where defining a class using type() could cause a DuplicateBasesError.
Close #644
* Dropped support for Python 3.4.
* Numpy brain support is improved.
Numpy's fundamental type ``numpy.ndarray`` has its own brain : ``brain_numpy_ndarray`` and
each numpy module that necessitates brain action has now its own numpy brain :
- ``numpy.core.numeric``
- ``numpy.core.function_base``
- ``numpy.core.multiarray``
- ``numpy.core.numeric``
- ``numpy.core.numerictypes``
- ``numpy.core.umath``
- ``numpy.random.mtrand``
Close PyCQA/pylint#2865
Close PyCQA/pylint#2747
Close PyCQA/pylint#2721
Close PyCQA/pylint#2326
Close PyCQA/pylint#2021
* ``assert`` only functions are properly inferred as returning ``None``
Close #668
* Add support for Python 3.8's `NamedExpr` nodes, which is part of assignment expressions.
Close #674
* Added support for inferring `IfExp` nodes.
* Instances of exceptions are inferred as such when inferring in non-exception context
This allows special inference support for exception attributes such as `.args`.
Close PyCQA/pylint#2333
* Drop a superfluous and wrong callcontext when inferring the result of a context manager
Close PyCQA/pylint#2859
* ``igetattr`` raises ``InferenceError`` on re-inference of the same object
This prevents ``StopIteration`` from leaking when we encounter the same
object in the current context, which could result in various ``RuntimeErrors``
leaking in other parts of the inference.
Until we get a global context per inference, the solution is sort of a hack,
as with the suggested global context improvement, we could theoretically
reuse the same inference object.
Close #663
* Variable annotations can no longer be retrieved with `ClassDef.getattr`
Unless they have an attached value, class variable annotations can no longer
be retrieved with `ClassDef.getattr.`
* Improved builtin inference for ``tuple``, ``set``, ``frozenset``, ``list`` and ``dict``
We were properly inferring these callables *only* if they had consts as
values, but that is not the case most of the time. Instead we try to infer
the values that their arguments can be and use them instead of assuming
Const nodes all the time.
Close PyCQA/pylint#2841
* The last except handler wins when inferring variables bound in an except handler.
Close PyCQA/pylint#2777
* ``threading.Lock.locked()`` is properly recognized as a member of ``threading.Lock``
Close PyCQA/pylint#2791
* Fix recursion error involving ``len`` and self referential attributes
Close PyCQA/pylint#2736
Close PyCQA/pylint#2734
Close PyCQA/pylint#2740
* Can access per argument type comments through new ``Arguments.type_comment_args`` attribute.
Close #665
* Fix being unable to access class attributes on a NamedTuple.
Close PyCQA/pylint#1628
* Fixed being unable to find distutils submodules by name when in a virtualenv.
Close PyCQA/pylint#73
What's New in astroid 2.2.0?
============================
Release Date: 2019-02-27
* Fix a bug concerning inference of calls to numpy function that should not return Tuple or List instances.
Close PyCQA/pylint#2436
* Fix a bug where a method, which is a lambda built from a function, is not inferred as ``BoundMethod``
Close PyCQA/pylint#2594
* ``typed_ast`` gets installed for Python 3.7, meaning type comments can now work on 3.7.
* Fix a bug concerning inference of unary operators on numpy types.
Close PyCQA/pylint#2436 (first part)
* Fix a crash with ``typing.NamedTuple`` and empty fields. Close PyCQA/pylint#2745
* Add a proper ``strerror`` inference to the ``OSError`` exceptions.
Close PyCQA/pylint#2553
* Support non-const nodes as values of Enum attributes.
Close #612
* Fix a crash in the ``enum`` brain tip caused by non-assign members in class definitions.
Close PyCQA/pylint#2719
* ``brain_numpy`` returns an undefined type for ``numpy`` methods to avoid ``assignment-from-no-return``
Close PyCQA/pylint#2694
* Fix a bug where a call to a function that has been previously called via
functools.partial was wrongly inferred
Close PyCQA/pylint#2588
* Fix a recursion error caused by inferring the ``slice`` builtin.
Close PyCQA/pylint#2667
* Remove the restriction that "old style classes" cannot have a MRO.
This does not make sense any longer given that we run against Python 3
code.
Close PyCQA/pylint#2701
* Added more builtin exceptions attributes. Close #580
* Add a registry for builtin exception models. Close PyCQA/pylint#1432
* Add brain tips for `http.client`. Close PyCQA/pylint#2687
* Prevent crashing when processing ``enums`` with mixed single and double quotes.
Close PyCQA/pylint#2676
* ``typing`` types have the `__args__` property. Close PyCQA/pylint#2419
* Fix a bug where an Attribute used as a base class was triggering a crash
Close #626
* Added special support for `enum.IntFlag`
Close PyCQA/pylint#2534
* Extend detection of data classes defined with attr
Close #628
* Fix typo in description for brain_attrs
What's New in astroid 2.1.0?
============================
Release Date: 2018-11-25
* ``threading.Lock.acquire`` has the ``timeout`` parameter now.
Close PyCQA/pylint#2457
* Pass parameters by keyword name when inferring sequences.
Close PyCQA/pylint#2526
* Correct line numbering for f-strings for complex embedded expressions
When a f-string contained a complex expression, such as an attribute access,
we weren't cloning all the subtree of the f-string expression for attaching the correct
line number. This problem is coming from the builtin AST parser which gives for the f-string
and for its underlying elements the line number 1, but this is causing all sorts of bugs and
problems in pylint, which expects correct line numbering.
Close PyCQA/pylint#2449
* Add support for `argparse.Namespace`
Close PyCQA/pylint#2413
* `async` functions are now inferred as `AsyncGenerator` when inferring their call result.
* Filter out ``Uninferable`` when inferring the call result result of a class with an uninferable ``__call__`` method.
Close PyCQA/pylint#2434
* Make compatible with AST changes in Python 3.8.
* Subscript inference (e.g. "`a[i]`") now pays attention to multiple inferred values for value
(e.g. "`a`") and slice (e.g. "`i`")
Close #614
What's New in astroid 2.0.4?
============================
Release Date: 2018-08-10
* Make sure that assign nodes can find ``yield`` statements in their values
Close PyCQA/pylint#2400
What's New in astroid 2.0.3?
============================
Release Date: 2018-08-08
* The environment markers for PyPy were invalid.
What's New in astroid 2.0.2?
============================
Release Date: 2018-08-01
* Stop repeat inference attempt causing a RuntimeError in Python3.7
Close PyCQA/pylint#2317
* infer_call_result can raise InferenceError so make sure to handle that for the call sites
where it is used
infer_call_result started recently to raise InferenceError for objects for which it
could not find any returns. Previously it was silently raising a StopIteration,
which was especially leaking when calling builtin methods.
Since it is after all an inference method, it is expected that it
could raise an InferenceError rather than returning nothing.
Close PyCQA/pylint#2350
What's New in astroid 2.0.1?
============================
Release Date: 2018-07-19
* Released to clear an old wheel package on PyPI
What's New in astroid 2.0?
==========================
Release Date: 2018-07-15
* String representation of nodes takes in account precedence and associativity rules of operators.
* Fix loading files with `modutils.load_from_module` when
the path that contains it in `sys.path` is a symlink and
the file is contained in a symlinked folder.
Close #583
* Reworking of the numpy brain dealing with numerictypes
(use of inspect module to determine the class hierarchy of
numpy.core.numerictypes module)
Close PyCQA/pylint#2140
* Added inference support for starred nodes in for loops
Close #146
* Support unpacking for dicts in assignments
Close #268
* Add support for inferring functools.partial
Close #125
* Inference support for `dict.fromkeys`
Close #110
* `int()` builtin is inferred as returning integers.
Close #150
* `str()` builtin is inferred as returning strings.
Close #148
* DescriptorBoundMethod has the correct number of arguments defined.
* Improvement of the numpy numeric types definition.
Close PyCQA/pylint#1971
* Subclasses of *property* are now interpreted as properties
Close PyCQA/pylint#1601
* AsStringRegexpPredicate has been removed.
Use transform predicates instead of it.
* Switched to using typed_ast for getting access to type comments
As a side effect of this change, some nodes gained a new `type_annotation` attribute,
which, if the type comments were correctly parsed, should contain a node object
with the corresponding objects from the type comment.
* typing.X[...] and typing.NewType are inferred as classes instead of instances.
* Module.__path__ is now a list
It used to be a string containing the path, but it doesn't reflect the situation
on Python, where it is actually a list.
* Fix a bug with namespace package's __path__ attribute.
Close #528
* Added brain tips for random.sample
Part of PyCQA/pylint#811
* Add brain tip for `issubclass` builtin
Close #101.
* Fix submodule imports from six
Close PyCQA/pylint#1640
* Fix missing __module__ and __qualname__ from class definition locals
Close PYCQA/pylint#1753
* Fix a crash when __annotations__ access a parent's __init__ that does not have arguments
Close #473
* Fix multiple objects sharing the same InferenceContext.path causing uninferable results
Close #483
* Fix improper modification of col_offset, lineno upon inference of builtin functions
Close PyCQA/pylint#1839
* Subprocess.Popen brain now knows of the args member
Close PyCQA/pylint#1860
* add move_to_end method to collections.OrderedDict brain
Close PyCQA/pylint#1872
* Include new hashlib classes added in python 3.6
* Fix RecursionError for augmented assign
Close #437, #447, #313, PyCQA/pylint#1642, PyCQA/pylint#1805, PyCQA/pylint#1854, PyCQA/pylint#1452
* Add missing attrs special attribute
Close PyCQA/pylint#1884
* Inference now understands the 'isinstance' builtin
Close #98
* Stop duplicate nodes with the same key values
from appearing in dictionaries from dictionary unpacking.
Close PyCQA/pylint#1843
* Fix ``contextlib.contextmanager`` inference for nested context managers
Close #1699
* Implement inference for len builtin
Close #112
* Add qname method to Super object preventing potential errors in upstream
pylint
Close #533
* Stop astroid from getting stuck in an infinite loop if a function shares
its name with its decorator
Close #375
* Fix issue with inherited __call__ improperly inferencing self
Close #PyCQA/pylint#2199
* Fix __call__ precedence for classes with custom metaclasses
Close PyCQA/pylint#2159
* Limit the maximum amount of interable result in an NodeNG.infer() call to
100 by default for performance issues with variables with large amounts of
possible values.
The max inferable value can be tuned by setting the `max_inferable_values` flag on
astroid.MANAGER.
What's New in astroid 1.6.0?
============================
Release Date: 2017-12-15
* When verifying duplicates classes in MRO, ignore on-the-fly generated classes
Close PyCQA/pylint#1706
* Add brain tip for attrs library to prevent unsupported-assignment-operation false positives
Close PYCQA/pylint#1698
* file_stream was removed, since it was deprecated for three releases
Instead one should use the .stream() method.
* Vast improvements to numpy support
* Add brain tips for curses
Close PyCQA/pylint#1703
* Add brain tips for UUID.int
Close PyCQA/pylint#961
* The result of using object.__new__ as class decorator is correctly inferred as instance
Close #172
* Enums created with functional syntax are now iterable
* Enums created with functional syntax are now subscriptable
* Don't crash when getting the string representation of BadUnaryOperationMessage
In some cases, when the operand does not have a .name attribute,
getting the string representation of a BadUnaryOperationMessage leads
to a crash.
Close PyCQA/pylint#1563
* Don't raise DuplicateBaseError when classes at different locations are used
For instance, one can implement a namedtuple base class, which gets reused
on a class with the same name later on in the file. Until now, we considered
these two classes as being the same, because they shared the name, but in fact
they are different, being created at different locations and through different
means.
Close PyCQA/pylint#1458
* The func form of namedtuples with keywords is now understood
Close PyCQA/pylint#1530
* Fix inference for nested calls
* Dunder class at method level is now inferred as the class of the method
Close PyCQA/pylint#1328
* Stop most inference tip overwrites from happening by using
predicates on existing inference_tip transforms.
Close #472
* Fix object.__new__(cls) calls in classmethods by using
a context which has the proper boundnode for the given
argument
Close #404
* Fix Pathlib type inference
Close PyCQA/pylint#224
Close PyCQA/pylint#1660
What's New in astroid 1.5.3?
============================
Release Date: 2017-06-03
* enum34 dependency is forced to be at least version 1.1.3. Fixes spurious
bug related to enum classes being falsy in boolean context, which caused
_Inconsistent Hierarchy_ `RuntimeError` in `singledispatch` module.
See links below for details:
- http://bugs.python.org/issue26748
- https://bitbucket.org/ambv/singledispatch/issues/8/inconsistent-hierarchy-with-enum
- https://bitbucket.org/stoneleaf/enum34/commits/da50803651ab644e6fce66ebc85562f1117c344b
* Do not raise an exception when uninferable value is unpacked in ``with`` statement.
* Lock objects from ``threading`` module are now correctly recognised
as context managers.
What's New in astroid 1.5.2?
============================
Release Date: 2017-04-17
* Basic support for the class form of typing.NamedTuple
* mro() can be computed for classes with old style classes in the hierarchy
What's New in astroid 1.5.0?
============================
Release Date: 2017-04-13
* Arguments node gained a new attribute, ``kwonlyargs_annotations``
This new attribute holds the annotations for the keyword-only
arguments.
* `namedtuple` inference now understands `rename` keyword argument
* Classes can now know their definition-time arguments.
Classes can support keyword arguments, which are passed when
a class is constructed using ``__new__``.
* Add support for inferring typing.NamedTuple.
* ClassDef now supports __getitem__ inference through the metaclass.
* getitem() method accepts nodes now, instead of Python objects.
* Add support for explicit namespace packages, created with pkg_resources.
* Add brain tips for _io.TextIOWrapper's buffer and raw attributes.
* Add `returns` into the proper order in FunctionDef._astroid_fields
The order is important, since it determines the last child,
which in turn determines the last line number of a scoped node.
* Add brain tips for functools.lru_cache.
* New function, astroid.extract_node, exported out from astroid.test_utils.
* Stop saving assignment locals in ExceptHandlers, when the context is a store.
This fixes a tripping case, where the RHS of a ExceptHandler can be redefined
by the LHS, leading to a local save. For instance, ``except KeyError, exceptions.IndexError``
could result in a local save for IndexError as KeyError, resulting in potential unexpected
inferences. Since we don't lose a lot, this syntax gets prohibited.
* Fix a crash which occurred when the class of a namedtuple could not be inferred.
* Add support for implicit namespace packages (PEP 420)
This change involves a couple of modifications. First, we're relying on a
spec finder protocol, inspired by importlib's ModuleSpec, for finding where
a file or package is, using importlib's PathFinder as well, which enable
us to discover namespace packages as well.
This discovery is the center piece of the namespace package support,
the other part being the construction of a dummy Module node whenever
a namespace package root directory is requested during astroid's import
references.
* Introduce a special attributes model
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.
* Exceptions have their own object model
Some of exceptions's attributes, such as .args and .message,
can't be inferred correctly since they are descriptors that get
transformed into the proper objects at runtime. This can cause issues
with the static analysis, since they are inferred as different than
what's expected. Now when we're creating instances of exceptions,
we're inferring a special object that knows how to transform those
runtime attributes into the proper objects via a custom object model.
Closes issue #81
* dict.values, dict.keys and dict.items are properly
inferred to their corresponding type, which also
includes the proper containers for Python 3.
* Fix a crash which occurred when a method had a same name as a builtin object,
decorated at the same time by that builtin object ( a property for instance)
* The inference can handle the case where the attribute is accessed through a subclass
of a base class and the attribute is defined at the base class's level,
by taking in consideration a redefinition in the subclass.
This should fix https://github.com/PyCQA/pylint/issues/432
* Calling lambda methods (defined at class level) can be understood.
* Don't take in consideration invalid assignments, especially when __slots__
declaration forbids them.
Close issue #332
* Functional form of enums support accessing values through __call__.
* Brain tips for the ssl library.
* decoratornames() does not leak InferenceError anymore.
* wildcard_imported_names() got replaced by _public_names()
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.
The method is private in 1.4.X.
* unpack_infer raises InferenceError if it can't operate
with the given sequences of nodes.
* Support accessing properties with super().
* Enforce strong updates per frames.
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.
* Add support for inference on threading.Lock
As a matter of fact, astroid can infer on threading.RLock,
threading.Semaphore, but can't do it on threading.Lock (because it comes
from an extension module).
* pkg_resources brain tips are a bit more specific,
by specifying proper returns.
* The slots() method conflates all the slots from the ancestors
into a list of current and parent slots.
We're doing this because this is the right semantics of slots,
they get inherited, as long as each parent defines a __slots__
entry.
* Some nodes got a new attribute, 'ctx', which tells in which context
the said 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. Closes issue #267.
* relative_to_absolute_name or methods calling it will now raise
TooManyLevelsError when a relative import was trying to
access something beyond the top-level package.
* AstroidBuildingException is now AstroidBuildingError. The first
name will exist until astroid 2.0.
* Add two new exceptions, AstroidImportError and AstroidSyntaxError.
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.
* Revert to using printf-style formatting in as_string, in order
to avoid a potential problem with encodings when using .format.
Closes issue #273. Patch by notsqrt.
* assigned_stmts methods have the same signature from now on.
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.
* Fix metaclass detection, when multiple keyword arguments
are used in class definition.
* Add support for annotated variable assignments (PEP 526)
* Starred expressions are now inferred correctly for tuple,
list, set, and dictionary literals.
* Support for asynchronous comprehensions introduced in Python 3.6.
Fixes #399. See PEP530 for details.
What's New in astroid 1.4.1?
============================
Release Date: 2015-11-29
* Add support for handling Uninferable nodes when calling as_string
Some object, for instance List or Tuple can have, after inference,
Uninferable as their elements, happening when their components
weren't couldn't be inferred properly. This means that as_string
needs to cope with expecting Uninferable nodes part of the other
nodes coming for a string transformation. The patch adds a visit
method in AsString and ``accept`` on Yes / Uninferable nodes.
Closes issue #270.
What's New in astroid 1.4.0?
============================
Release Date: 2015-11-29
* Class.getattr('__mro__') returns the actual MRO. Closes issue #128.
* The logilab-common dependency is not needed anymore as the needed code
was integrated into astroid.
* Generated enum member stubs now support IntEnum and multiple
base classes.
* astroid.builder.AstroidBuilder.string_build and
astroid.builder.AstroidBuilder.file_build are now raising
AstroidBuildingException when the parsing of the string raises
a SyntaxError.
* Add brain tips for multiprocessing.Manager and
multiprocessing.managers.SyncManager.
* Add some fixes which enhances the Jython support.
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.
* The Generator objects inferred with `infer_call_result`
from functions have as parent the function from which they
are returned.
* Add brain tips for multiprocessing post Python 3.4+,
where the module level functions are retrieved with getattr
from a context object, leading to many no-member errors
in Pylint.
* Understand partially the 3-argument form of `type`.
The only change is that astroid understands members
passed in as dictionaries as the third argument.
* .slots() will return an empty list for classes with empty slots.
Previously it returned None, which is the same value for
classes without slots at all. This was changed in order
to better reflect what's actually happening.
* Improve the inference of Getattr nodes when dealing with
abstract properties from the abc module.
In astroid.bases.Instance._wrap_attr we had a detection
code for properties, which basically inferred whatever
a property returned, passing the results up the stack,
to the igetattr() method. It handled only the builtin property
but the new patch also handles a couple of other properties,
such as abc.abstractproperty.
* UnboundMethod.getattr calls the getattr of its _proxied object
and doesn't call super(...) anymore.
It previously crashed, since the first ancestor in its mro was
bases.Proxy and bases.Proxy doesn't implement the .getattr method.
Closes issue #91.
* Don't hard fail when calling .mro() on a class which has
combined both newstyle and old style classes. The class
in question is actually newstyle (and the __mro__ can be
retrieved using Python).
.mro() fallbacks to using .ancestors() in that case.
* Class.local_attr and Class.local_attr_ancestors uses internally
a mro lookup, using .mro() method, if they can.
That means for newstyle classes, when trying to lookup a member
using one of these functions, the first one according to the
mro will be returned. This reflects nicely the reality,
but it can have as a drawback the fact that it is a behaviour
change (the previous behaviour was incorrect though). Also,
having bases which can return multiple values when inferred
will not work with the new approach, because .mro() only
retrieves the first value inferred from a base.
* Expose an implicit_metaclass() method in Class. This will return
a builtins.type instance for newstyle classes.
* Add two new exceptions for handling MRO error cases. DuplicateBasesError
is emitted when duplicate bases are found in a class,
InconsistentMroError is raised when the method resolution is determined
to be inconsistent. They share a common class, MroError, which
is a subclass of ResolveError, meaning that this change is backwards
compatible.
* Classes aren't marked as interfaces anymore, in the `type` attribute.
* Class.has_dynamic_getattr doesn't return True for special methods
which aren't implemented in pure Python, as it is the case for extension modules.
Since most likely the methods were coming from a live object, this implies
that all of them will have __getattr__ and __getattribute__ present and it
is wrong to consider that those methods were actually implemented.
* Add basic support for understanding context managers.
Currently, there's no way to understand whatever __enter__ returns in a
context manager and what it is binded using the ``as`` keyword. With these changes,
we can understand ``bar`` in ``with foo() as bar``, which will be the result of __enter__.
* Add a new type of node, called *inference objects*. Inference objects are similar with
AST nodes, but they can be obtained only after inference, so they can't be found
inside the original AST tree. Their purpose is to handle at astroid level
some operations which can't be handled when using brain transforms.
For instance, the first object added is FrozenSet, which can be manipulated
at astroid's level (inferred, itered etc). Code such as this 'frozenset((1,2))'
will not return an Instance of frozenset, without having access to its
content, but a new objects.FrozenSet, which can be used just as a nodes.Set.
* Add a new *inference object* called Super, which also adds support for understanding
super calls. astroid understands the zero-argument form of super, specific to
Python 3, where the interpreter fills itself the arguments of the call. Also, we
are understanding the 2-argument form of super, both for bounded lookups
(super(X, instance)) as well as for unbounded lookups (super(X, Y)),
having as well support for validating that the object-or-type is a subtype
of the first argument. The unbounded form of super (one argument) is not
understood, since it's useless in practice and should be removed from
Python's specification. Closes issue #89.
* Add inference support for getattr builtin. Now getattr builtins are
properly understood. Closes issue #103.