Skip to content

Sum and multiply #740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 94 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
bb7fe8d
Adds two missing ufunc instances (add and multiply)
hippo91 Dec 27, 2019
0cd44c7
Add the test of functions add and multiply
hippo91 Dec 27, 2019
4fc45c5
Insures that numpy functions returning arrays are inferred only as ar…
hippo91 Dec 30, 2019
cc3bfc5
Turns the context.path from a set to a dict which values are the numb…
hippo91 Dec 30, 2019
be78cd4
Updates two tests that deal with the number of visits and the context…
hippo91 Dec 30, 2019
06c98d3
Added an entry
hippo91 Dec 30, 2019
e3e2d8a
Corrects the use of numpy.multiply function
hippo91 Dec 30, 2019
14de71c
Merge branch 'master' into sum_and_multiply
hippo91 Dec 30, 2019
1322e5d
Merge branch 'master' into sum_and_multiply
hippo91 Jun 20, 2020
184b591
Fix exception causes all over the codebase (#806)
cool-RR Jun 20, 2020
4b7566b
Squash one-off inference utility functions to help reduce recursion e…
brycepg Jun 22, 2020
ec96745
Separate string and bytes classes patching (#807)
PCManticore Jun 23, 2020
25384d4
Squash one-off inference utility functions to help reduce recursion e…
brycepg Jun 22, 2020
8b19be2
Add comments and changelog entry (#830)
hippo91 Sep 14, 2020
d184697
Skip test for | in dictionaries due to PEP-584 in Python 3.9+ (#829)
tirkarthi Sep 14, 2020
e39d8fe
Fix warning regarding ABC import from collections (#825)
tirkarthi Sep 14, 2020
bb35723
Add the value parameter in the signature of the __or__ method of the …
hippo91 Sep 14, 2020
290df48
Teach astroid about Hypothesis (#820)
Zac-HD Sep 14, 2020
1d14e98
Adds ndarray as rtype for T attribute.
hippo91 Sep 14, 2020
7f1d513
Fix incorrect MRO being calculated for scoped multiple inheritance
timmartin Oct 7, 2020
c89dc01
Fix formatting regression
timmartin Oct 16, 2020
46633c5
Drop tracebacks on Astroid import errors for caches
rtpg Oct 26, 2020
72ff0fd
Explicitly return None on certain functions
rtpg Oct 27, 2020
4629777
Add changelog for memory fix
rtpg Oct 28, 2020
c9c5792
Merge branch 'master' into issue843
timmartin Oct 31, 2020
8dafae9
When inferring argument takes into account possible posonyargs before…
hippo91 Nov 22, 2020
736930c
Thanks to the preceeding commit the inference is more precise for cla…
hippo91 Nov 22, 2020
11ecc08
Adds python3.9 test
hippo91 Nov 22, 2020
6b11429
Adds an entry
hippo91 Nov 22, 2020
80d2f63
Takes into account the fact that in python3.9 NamedTuple in typing mo…
hippo91 Nov 22, 2020
dbe56fc
Formatting according to black
hippo91 Nov 22, 2020
ac2b173
Remove dependency on imp.
pkolbus Nov 22, 2020
6ed58db
Merge pull request #844 from timmartin/issue843
hippo91 Dec 12, 2020
969a5cf
Merge pull request #857 from pkolbus/remove-imp
hippo91 Dec 13, 2020
b798f40
Add tests environment for python3.8 and python3.9
hippo91 Dec 13, 2020
a35ff54
Remove tests environment 3.9 because it is not python3.9 is not yet a…
hippo91 Dec 13, 2020
8ad8381
Merge pull request #858 from hippo91/fix_python39_new
hippo91 Dec 13, 2020
4f8ac13
Changes the return value of the _precache_zipimporters function so th…
hippo91 Dec 24, 2020
75910f4
Adds docstring to the _precache_zipimporters function
hippo91 Dec 24, 2020
614a8a8
Adds copyright notice
hippo91 Dec 24, 2020
c9b9a00
Adds an entry
hippo91 Dec 24, 2020
ef0edfe
Allow wrapt 1.12
FelixMoelder Nov 26, 2020
caa8a64
Fix starred_assigned_stmts elts cast (introduced in d68f2935)
vtermanis Sep 17, 2020
922820e
Add None check on inferred_node
sjhewitt Dec 4, 2020
744a9a8
Allow lazy-object-proxy >= 1.5.0
priv-kweihmann Jun 10, 2020
f1613f4
Reformated according to black
hippo91 Dec 24, 2020
2f889b7
handle deprecation warnings when walking module members
CrepeGoat May 7, 2020
2494796
Do not crash when encountering starred assignments in enums.
PCManticore Dec 26, 2020
3c5ff57
Fix incorrect error message formatting
PCManticore Dec 26, 2020
ef28852
Fix a crash in functools.partial inference when the arguments cannot …
PCManticore Dec 27, 2020
7aff333
Adds release date for 2.5.0
hippo91 Dec 27, 2020
f05a518
Python3.9 is officially supported
hippo91 Dec 27, 2020
daecc59
New copyright notices
hippo91 Dec 27, 2020
06c9eb1
Adds deprecation warning as suggested by Pierre Sassoulas
hippo91 Dec 28, 2020
f8e32f1
Adds print to debug travis failure with pyp
hippo91 Dec 28, 2020
2395381
Adds debug msg
hippo91 Dec 28, 2020
321e950
Back to original file after debugging session
hippo91 Dec 28, 2020
e42e5f6
sys.real_prefix doesn't exist anymore with recent version of venv. Us…
hippo91 Dec 28, 2020
d75cb3c
Seems like the only way to have a valid get_python_lib(standard_lib=T…
hippo91 Dec 28, 2020
2faedec
Adds comment to explain the use of sys.base_prefix
hippo91 Dec 28, 2020
dca633a
Adds copyright notice
hippo91 Dec 28, 2020
a324fbd
Formatting according to black
hippo91 Dec 28, 2020
6f8de0e
Removes insecable whitespaces
hippo91 Dec 29, 2020
9270a21
Do not set the release date until it has been really released.
hippo91 Dec 29, 2020
99d9c77
Merge pull request #872 from hippo91/astroid_2.5.0
hippo91 Dec 29, 2020
be47792
Merge branch 'master' into fix_deprecated_importlib_methods
hippo91 Dec 29, 2020
b1992e7
Adds the ufunc degrees and radians
hippo91 Dec 29, 2020
0fa35ba
Adds the ufunc degrees and radians tests
hippo91 Dec 29, 2020
6c72c27
Add the function random that is an alias of random_sample
hippo91 Dec 29, 2020
f64ca15
Adds an entry
hippo91 Dec 29, 2020
670707e
Adds a note dealing with numpy version 1.18 and the __getattr__ method
hippo91 Dec 29, 2020
3554cab
Formatting according to black
hippo91 Dec 29, 2020
bdf1bea
Update astroid/interpreter/_import/spec.py
hippo91 Dec 29, 2020
714abbc
Update astroid/interpreter/_import/spec.py
hippo91 Dec 29, 2020
f91f52e
Update astroid/interpreter/_import/spec.py
hippo91 Dec 29, 2020
b6e03f2
Update astroid/interpreter/_import/spec.py
hippo91 Dec 29, 2020
a8bde99
Merge pull request #869 from hippo91/fix_deprecated_importlib_methods
hippo91 Dec 30, 2020
da2f454
Merge branch 'master' into bug_pylint_3856
hippo91 Dec 30, 2020
98fd217
Merge pull request #873 from hippo91/bug_pylint_3856
hippo91 Dec 30, 2020
00ccda6
Fix a bug for dunder methods inference of function objects
PCManticore Dec 30, 2020
58212bd
Fix a crash in inference caused by `Uninferable` container elements
PCManticore Jan 1, 2021
c9fd193
``is_generator`` correctly considers `Yield` nodes in `AugAssign` nodes
PCManticore Jan 1, 2021
294623e
brain: Add `__class_getitem__` to `subprocess.Popen` starting from Py…
dbaty Jan 18, 2021
6e9a69d
Adds a brain to mock the __class_getitem__ method on the `type` class…
hippo91 Jan 18, 2021
bfad347
Adds unittest for brain_type module
hippo91 Jan 18, 2021
c89ccb7
Deletes unused import
hippo91 Jan 19, 2021
f184c8a
Adds doc
hippo91 Jan 19, 2021
e7a4244
Adds an entry
hippo91 Jan 19, 2021
01c678a
Formatting according to black
hippo91 Jan 20, 2021
1bd5976
Defines PY39 variable
hippo91 Jan 20, 2021
869b851
Merge pull request #882 from Polyconseil/dbaty/subprocess_popen_class…
hippo91 Jan 23, 2021
ded22ec
Corrects a comment concerning node type as suggested by @PIerre-Sasso…
hippo91 Jan 23, 2021
7c7848b
Merge pull request #883 from hippo91/bug_pylint_4001
hippo91 Jan 23, 2021
7c614b3
Merge branch 'sum_and_multiply' of https://github.com/hippo91/astroid
hippo91 Jan 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ astroid.egg-info/
.cache/
.eggs/
.pytest_cache/
.mypy_cache/
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
env: TOXENV=py37
- python: 3.8
env: TOXENV=py38
- python: 3.9
env: TOXENV=py39
before_install:
- python --version
- uname -a
Expand Down
89 changes: 86 additions & 3 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,80 @@
astroid's ChangeLog
===================

* The ``context.path`` is now a ``dict`` and the ``context.push`` method
returns ``True`` if the node has been visited a certain amount of times.

Close #669

What's New in astroid 2.5.0?
============================
Release Date: TBA
* Adds a brain for type object so that it is possible to write `type[int]` in annotation.

Fixes PyCQA/pylint#4001

* Add ``__class_getitem__`` method to ``subprocess.Popen`` brain under Python 3.9 so that it is seen as subscriptable by pylint.

Fixes PyCQA/pylint#4034

* Adds `degrees`, `radians`, which are `numpy ufunc` functions, in the `numpy` brain. Adds `random` function in the `numpy.random` brain.

Fixes PyCQA/pylint#3856

* Fix deprecated importlib methods

Closes #703

* Fix a crash in inference caused by `Uninferable` container elements

Close #866

* Add `python 3.9` support.

* The flat attribute of ``numpy.ndarray`` is now inferred as an ``numpy.ndarray`` itself.
It should be a ``numpy.flatiter`` instance, but this class is not yet available in the numpy brain.

Fixes PyCQA/pylint#3640

* Fix a bug for dunder methods inference of function objects

Fixes #819

* Fixes a bug in the signature of the ``ndarray.__or__`` method,
in the ``brain_numpy_ndarray.py`` module.

Fixes #815

* Fixes a to-list cast bug in ``starred_assigned_stmts`` method,
in the ``protocols.py` module.

* Added a brain for ``hypothesis.strategies.composite``

* The transpose of a ``numpy.ndarray`` is also a ``numpy.ndarray``

Fixes PyCQA/pylint#3387

* Added a brain for ``sqlalchemy.orm.session``

* Separate string and bytes classes patching

Fixes PyCQA/pylint#3599

* Prevent recursion error for self referential length calls

Close #777

* Added missing methods to the brain for ``mechanize``, to fix pylint false positives

Close #793

* Added more supported parameters to ``subprocess.check_output``

* Fix recursion errors with pandas

Fixes PyCQA/pylint#2843
Fixes PyCQA/pylint#2811

* Added exception inference for `UnicodeDecodeError`

Close PyCQA/pylint#3639
Expand All @@ -23,15 +84,37 @@ Release Date: TBA

Close PyCQA/pylint#3583

* Fixed exception-chaining error messages.

What's New in astroid 2.4.3?
============================
Release Date: TBA
* Fix failure to infer base class type with multiple inheritance and qualified names

Fixes #843

* Reduce memory usage of astroid's module cache.

* Remove dependency on `imp`.

Close #594
Close #681

* Do not crash when encountering starred assignments in enums.

Close #835

* Fix a crash in functools.partial inference when the arguments cannot be determined

Close PyCQA/pylint#3776

* Fix a crash caused by a lookup of a monkey-patched method

Close PyCQA/pylint#3686

* ``is_generator`` correctly considers `Yield` nodes in `AugAssign` nodes

This fixes a false positive with the `assignment-from-no-return` pylint check.

Close PyCQA/pylint#3904


What's New in astroid 2.4.2?
============================
Expand Down
3 changes: 3 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ environment:
- PYTHON: "C:\\Python37"
TOXENV: "py37"

- PYTHON: "C:\\Python38"
TOXENV: "py38"

init:
- ps: echo $env:TOXENV
- ps: ls C:\Python*
Expand Down
2 changes: 1 addition & 1 deletion astroid/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2006-2013, 2015 LOGILAB S.A. (Paris, FRANCE) <[email protected]>
# Copyright (c) 2014 Google, Inc.
# Copyright (c) 2014 Eevee (Alex Munroe) <[email protected]>
# Copyright (c) 2015-2016, 2018 Claudiu Popa <[email protected]>
# Copyright (c) 2015-2016, 2018, 2020 Claudiu Popa <[email protected]>
# Copyright (c) 2015-2016 Ceridwen <[email protected]>
# Copyright (c) 2016 Derek Gustafson <[email protected]>
# Copyright (c) 2016 Moises Lopez <[email protected]>
Expand Down
9 changes: 6 additions & 3 deletions astroid/__pkginfo__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2006-2014 LOGILAB S.A. (Paris, FRANCE) <[email protected]>
# Copyright (c) 2014-2019 Claudiu Popa <[email protected]>
# Copyright (c) 2014-2020 Claudiu Popa <[email protected]>
# Copyright (c) 2014 Google, Inc.
# Copyright (c) 2015-2017 Ceridwen <[email protected]>
# Copyright (c) 2015 Florian Bruhin <[email protected]>
Expand All @@ -14,6 +14,8 @@
# Copyright (c) 2018 Bryce Guinta <[email protected]>
# Copyright (c) 2019 Uilian Ries <[email protected]>
# Copyright (c) 2019 Thomas Hisch <[email protected]>
# Copyright (c) 2020 Konrad Weihmann <[email protected]>
# Copyright (c) 2020 Felix Mölder <[email protected]>
# Copyright (c) 2020 Michael <[email protected]>

# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
Expand All @@ -26,9 +28,9 @@

extras_require = {}
install_requires = [
"lazy_object_proxy==1.4.*",
"lazy_object_proxy>=1.4.0",
"six~=1.12",
"wrapt~=1.11",
"wrapt>=1.11,<1.13",
'typed-ast>=1.4.0,<1.5;implementation_name== "cpython" and python_version<"3.8"',
]

Expand All @@ -51,6 +53,7 @@
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
5 changes: 3 additions & 2 deletions astroid/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Copyright (c) 2018 Bryce Guinta <[email protected]>
# Copyright (c) 2018 Nick Drozd <[email protected]>
# Copyright (c) 2018 Anthony Sottile <[email protected]>
# Copyright (c) 2020 hippo91 <[email protected]>

# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
Expand Down Expand Up @@ -173,7 +174,7 @@ def infer_argument(self, funcnode, name, context):

# Too many arguments given and no variable arguments.
if len(self.positional_arguments) > len(funcnode.args.args):
if not funcnode.args.vararg:
if not funcnode.args.vararg and not funcnode.args.posonlyargs:
raise exceptions.InferenceError(
"Too many positional arguments "
"passed to {func!r} that does "
Expand Down Expand Up @@ -292,7 +293,7 @@ def infer_argument(self, funcnode, name, context):
except exceptions.NoDefault:
pass
raise exceptions.InferenceError(
"No value found for argument {name} to " "{func!r}",
"No value found for argument {arg} to {func!r}",
call_site=self,
func=funcnode,
arg=name,
Expand Down
Loading