Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 9005301
Author: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Date:   Mon Feb 22 12:45:33 2021 +0100

    Fix black issues

commit 08a95a9
Author: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Date:   Mon Feb 22 12:41:27 2021 +0100

    Fix trailing whitespaces

commit b466fde
Author: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Date:   Mon Feb 22 13:04:51 2021 +0100

    Fix end of files

commit 90da020
Author: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Date:   Mon Feb 22 11:12:30 2021 +0100

    Update black version - tox

commit e6038e4
Author: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Date:   Mon Feb 22 10:53:02 2021 +0100

    Update pre-commit config
  • Loading branch information
cdce8p committed Feb 23, 2021
1 parent 3ef6aa6 commit 1f862cb
Show file tree
Hide file tree
Showing 29 changed files with 57 additions and 61 deletions.
1 change: 0 additions & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# These are supported funding model platforms

tidelift: "pypi/astroid"

1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@


### ``python -c "from astroid import __pkginfo__; print(__pkginfo__.version)"`` output

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ astroid.egg-info/
.cache/
.eggs/
.pytest_cache/
.mypy_cache/
.mypy_cache/
13 changes: 7 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
repos:
- repo: https://github.com/ambv/black
rev: 18.6b4
rev: 20.8b1
hooks:
- id: black
args: [--safe, --quiet]
exclude: tests/testdata
python_version: python3.6
exclude: tests/testdata|doc/
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
rev: v3.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: trailing-whitespace
exclude: .github/|tests/testdata
- id: end-of-file-fixer
exclude: tests/testdata
20 changes: 9 additions & 11 deletions COPYING.LESSER
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.

Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
Expand Down Expand Up @@ -113,7 +113,7 @@ modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.

GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

Expand Down Expand Up @@ -160,7 +160,7 @@ Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.

2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
Expand Down Expand Up @@ -218,7 +218,7 @@ instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.

Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
Expand Down Expand Up @@ -269,7 +269,7 @@ Library will still fall under Section 6.)
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.

6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
Expand Down Expand Up @@ -331,7 +331,7 @@ restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.

7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
Expand Down Expand Up @@ -372,7 +372,7 @@ subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.

11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
Expand Down Expand Up @@ -425,7 +425,7 @@ conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.

14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
Expand Down Expand Up @@ -459,7 +459,7 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.

END OF TERMS AND CONDITIONS

How to Apply These Terms to Your New Libraries

If you develop a new library, and you want it to be of the greatest
Expand Down Expand Up @@ -506,5 +506,3 @@ if necessary. Here is a sample; alter the names:
Ty Coon, President of Vice

That's all there is to it!


2 changes: 1 addition & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ What's New in astroid 2.5.1?
============================
Release Date: TBA

* The ``context.path`` is reverted to a set because otherwise it leds to false positives
* The ``context.path`` is reverted to a set because otherwise it leds to false positives
for non `numpy` functions.

Closes #895 #899
Expand Down
4 changes: 2 additions & 2 deletions astroid/as_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def _precedence_parens(self, node, child, is_left=True):

def _should_wrap(self, node, child, is_left):
"""Wrap child if:
- it has lower precedence
- same precedence with position opposite to associativity direction
- it has lower precedence
- same precedence with position opposite to associativity direction
"""
node_precedence = node.op_precedence()
child_precedence = child.op_precedence()
Expand Down
4 changes: 2 additions & 2 deletions astroid/brain/brain_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
Guido Van Rossum proposed a hack to handle this in the interpreter:
https://github.com/python/cpython/blob/master/Objects/abstract.c#L186-L189
This brain follows the same logic. It is no wise to add permanently the __class_getitem__ method
This brain follows the same logic. It is no wise to add permanently the __class_getitem__ method
to the type object. Instead we choose to add it only in the case of a subscript node
which inside name node is type.
which inside name node is type.
Doing this type[int] is allowed whereas str[int] is not.
Thanks to Lukasz Langa for fruitful discussion.
Expand Down
2 changes: 1 addition & 1 deletion astroid/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def cached(func, instance, args, kwargs):


class cachedproperty:
""" Provides a cached property equivalent to the stacking of
"""Provides a cached property equivalent to the stacking of
@cached and @property, but more efficient.
After first usage, the <property_name> becomes part of the object's
Expand Down
2 changes: 1 addition & 1 deletion astroid/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _infer_map(node, context):


def _higher_function_scope(node):
""" Search for the first function which encloses the given
"""Search for the first function which encloses the given
scope. This can be used for looking up in that function's
scope, in case looking up in a lower scope for a particular
name fails.
Expand Down
2 changes: 1 addition & 1 deletion astroid/interpreter/_import/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def _cached_set_diff(left, right):

def _precache_zipimporters(path=None):
"""
For each path that has not been already cached
For each path that has not been already cached
in the sys.path_importer_cache, create a new zipimporter
instance and add it into the cache.
Return a dict associating all paths, stored in the cache, to corresponding
Expand Down
2 changes: 1 addition & 1 deletion astroid/interpreter/objectmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ def attr_fset(self):

def find_setter(func: objects.Property) -> Optional[astroid.FunctionDef]:
"""
Given a property, find the corresponding setter function and returns it.
Given a property, find the corresponding setter function and returns it.
:param func: property for which the setter has to be found
:return: the setter function or None
Expand Down
3 changes: 1 addition & 2 deletions astroid/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ def _infer_name(self, frame, name):
return name

def do_import_module(self, modname=None):
"""return the ast for a module whose name is <modname> imported by <self>
"""
"""return the ast for a module whose name is <modname> imported by <self>"""
# handle special case where we are on a package node importing a module
# using the same name as the package, which may end in an infinite loop
# on relative imports
Expand Down
2 changes: 1 addition & 1 deletion astroid/node_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def _container_getitem(instance, elts, index, context=None):


class NodeNG:
""" A node of the new Abstract Syntax Tree (AST).
"""A node of the new Abstract Syntax Tree (AST).
This is the base class for all Astroid node classes.
"""
Expand Down
2 changes: 1 addition & 1 deletion astroid/raw_building.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def inspect_build(self, module, modname=None, path=None):

def object_build(self, node, obj):
"""recursive method which create a partial ast from real objects
(only function, class, and method are handled)
(only function, class, and method are handled)
"""
if obj in self._done:
return self._done[obj]
Expand Down
6 changes: 3 additions & 3 deletions astroid/scoped_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def builtin_lookup(name):

# TODO move this Mixin to mixins.py; problem: 'FunctionDef' in _scope_lookup
class LocalsDictNodeNG(node_classes.LookupMixIn, node_classes.NodeNG):
""" this class provides locals handling common to Module, FunctionDef
"""this class provides locals handling common to Module, FunctionDef
and ClassDef nodes, including a dict like interface for direct access
to locals information
"""
Expand Down Expand Up @@ -1454,7 +1454,7 @@ def extra_decorators(self):
# pylint: disable=invalid-overridden-method
@decorators_mod.cachedproperty
def type(
self
self,
): # pylint: disable=invalid-overridden-method,too-many-return-statements
"""The function type for this node.
Expand Down Expand Up @@ -1791,7 +1791,7 @@ def _rec_get_names(args, names=None):


def _is_metaclass(klass, seen=None):
""" Return if the given class can be
"""Return if the given class can be
used as a metaclass.
"""
if klass.name == "type":
Expand Down
2 changes: 1 addition & 1 deletion astroid/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


def require_version(minver=None, maxver=None):
""" Compare version of python interpreter to the given one. Skip the test
"""Compare version of python interpreter to the given one. Skip the test
if older.
"""

Expand Down
2 changes: 0 additions & 2 deletions debian.sid/control
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,3 @@ Description: rebuild a new abstract syntax tree from Python's ast
the AST and building an extended ast. The new node
classes have additional methods and attributes for different usages.
Furthermore, astroid builds partial trees by inspecting living objects.


1 change: 0 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ astroid (1.0.0-1) unstable; urgency=low
* new upstream release, project renamed to astroid instead of logilab-astng

-- Sylvain Thénault <sylvain.thenault@logilab.fr> Mon, 29 Jul 2013 16:32:51 +0200

2 changes: 0 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,3 @@ Description: rebuild a new abstract syntax tree from Python's ast
AST and building an extended ast. The new node classes
have additional methods and attributes for different usages.
Furthermore, astroid builds partial trees by inspecting living objects.


1 change: 0 additions & 1 deletion doc/api/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ General API
------------

.. automodule:: astroid

2 changes: 1 addition & 1 deletion doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.. include:: ../ChangeLog
.. include:: ../ChangeLog
3 changes: 1 addition & 2 deletions doc/release.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ Release Process
https://github.com/PyCQA/astroid

6. Run

$ git clean -fd && find . -name '*.pyc' -delete
$ rm dist/*
$ python setup.py sdist --formats=gztar bdist_wheel
$ twine upload dist/*


to release a new version to PyPI.

2 changes: 1 addition & 1 deletion doc/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ The "Changelog" contains *all* nontrivial changes to astroid for the current ver
.. toctree::
:maxdepth: 2

changelog
changelog
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
from setuptools.command import easy_install # pylint: disable=unused-import
from setuptools.command import install_lib # pylint: disable=unused-import

if sys.version_info.major == 3 and sys.version_info.minor <=5:
warnings.warn("You will soon need to upgrade to python 3.6 in order to use the latest version of Astroid.", DeprecationWarning)
if sys.version_info.major == 3 and sys.version_info.minor <= 5:
warnings.warn(
"You will soon need to upgrade to python 3.6 in order to use the latest version of Astroid.",
DeprecationWarning,
)

real_path = os.path.realpath(__file__)
astroid_dir = os.path.dirname(real_path)
Expand Down
16 changes: 11 additions & 5 deletions tests/unittest_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ def _(self):
self.assertEqual(cdef.col_offset, orig_offset)

def test_no_runtime_error_in_repeat_inference(self):
""" Stop repeat inference attempt causing a RuntimeError in Python3.7
"""Stop repeat inference attempt causing a RuntimeError in Python3.7
See https://github.com/PyCQA/pylint/issues/2317
"""
Expand Down Expand Up @@ -5498,9 +5498,15 @@ def test(self, value):
A.test.getter #@
A.test.deleter #@
"""
prop, prop_result, prop_fget_result, prop_fset_result, prop_setter, prop_getter, prop_deleter = extract_node(
code
)
(
prop,
prop_result,
prop_fget_result,
prop_fset_result,
prop_setter,
prop_getter,
prop_deleter,
) = extract_node(code)

inferred = next(prop.infer())
assert isinstance(inferred, objects.Property)
Expand Down Expand Up @@ -5793,7 +5799,7 @@ def a(self):
node = extract_node(code)
# Infer the class
cls = next(node.infer())
prop, = cls.getattr("a")
(prop,) = cls.getattr("a")

# Try to infer the property function *multiple* times. `A.locals` should be modified only once
for _ in range(3):
Expand Down
3 changes: 1 addition & 2 deletions tests/unittest_modutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,7 @@ def test_get_module_files_1(self):
self.assertEqual(modules, {os.path.join(package, x) for x in expected})

def test_get_all_files(self):
"""test that list_all returns all Python files from given location
"""
"""test that list_all returns all Python files from given location"""
non_package = resources.find("data/notamodule")
modules = modutils.get_module_files(non_package, [], list_all=True)
self.assertEqual(modules, [os.path.join(non_package, "file.py")])
Expand Down
6 changes: 2 additions & 4 deletions tests/unittest_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,13 @@ def test_varargs_kwargs_as_string(self):
self.assertEqual(ast.as_string(), "raise_string(*args, **kwargs)")

def test_module_as_string(self):
"""check as_string on a whole module prepared to be returned identically
"""
"""check as_string on a whole module prepared to be returned identically"""
module = resources.build_file("data/module.py", "data.module")
with open(resources.find("data/module.py")) as fobj:
self.assertMultiLineEqual(module.as_string(), fobj.read())

def test_module2_as_string(self):
"""check as_string on a whole module prepared to be returned identically
"""
"""check as_string on a whole module prepared to be returned identically"""
module2 = resources.build_file("data/module2.py", "data.module2")
with open(resources.find("data/module2.py")) as fobj:
self.assertMultiLineEqual(module2.as_string(), fobj.read())
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ commands =

[testenv:formatting]
basepython = python3
deps = black==18.6b4
deps =
black==20.8b1
commands = black --check --exclude "tests/testdata" astroid tests
changedir = {toxinidir}

Expand Down

0 comments on commit 1f862cb

Please sign in to comment.