diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 35fe7fca31..143e7ccadb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -44,7 +44,7 @@ repos: - id: black-disable-checker exclude: tests/unittest_nodes_lineno.py - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.1a1 hooks: - id: black args: [--safe, --quiet] diff --git a/astroid/brain/brain_namedtuple_enum.py b/astroid/brain/brain_namedtuple_enum.py index 53d89bcf93..5be9eeb082 100644 --- a/astroid/brain/brain_namedtuple_enum.py +++ b/astroid/brain/brain_namedtuple_enum.py @@ -193,7 +193,6 @@ def infer_named_tuple( call_site = arguments.CallSite.from_call(node, context=context) node = extract_node("import collections; collections.namedtuple") try: - func = next(node.infer()) except StopIteration as e: raise InferenceError(node=node) from e diff --git a/astroid/builder.py b/astroid/builder.py index 1e188e5d15..72f63c9355 100644 --- a/astroid/builder.py +++ b/astroid/builder.py @@ -217,7 +217,7 @@ def sort_locals(my_list: list[nodes.NodeNG]) -> None: my_list.sort(key=_key_func) assert node.parent # It should always default to the module - for (name, asname) in node.names: + for name, asname in node.names: if name == "*": try: imported = node.do_import_module() diff --git a/astroid/interpreter/objectmodel.py b/astroid/interpreter/objectmodel.py index 9741db562e..5a12ef8ddb 100644 --- a/astroid/interpreter/objectmodel.py +++ b/astroid/interpreter/objectmodel.py @@ -832,7 +832,6 @@ def attr_keys(self): @property def attr_values(self): - values = [value for (_, value) in self._instance.items] obj = node_classes.List(parent=self._instance) obj.postinit(values) diff --git a/astroid/protocols.py b/astroid/protocols.py index 1c851ffdb1..0638c669a1 100644 --- a/astroid/protocols.py +++ b/astroid/protocols.py @@ -741,6 +741,7 @@ def starred_assigned_stmts( # noqa: C901 A list of indices, where each index specifies what item to fetch from the inference results. """ + # pylint: disable=too-many-locals,too-many-statements def _determine_starred_iteration_lookups( starred: nodes.Starred, target: nodes.Tuple, lookups: list[tuple[int, int]] diff --git a/astroid/raw_building.py b/astroid/raw_building.py index fcb076d8e4..214884cb00 100644 --- a/astroid/raw_building.py +++ b/astroid/raw_building.py @@ -377,7 +377,7 @@ def object_build( with warnings.catch_warnings(): warnings.simplefilter("ignore") member = getattr(obj, name) - except (AttributeError): + except AttributeError: # damned ExtensionClass.Base, I know you're there ! attach_dummy_node(node, name) continue diff --git a/astroid/rebuilder.py b/astroid/rebuilder.py index a8c750824c..e75aa737a9 100644 --- a/astroid/rebuilder.py +++ b/astroid/rebuilder.py @@ -1413,7 +1413,7 @@ def visit_import(self, node: ast.Import, parent: NodeNG) -> nodes.Import: parent=parent, ) # save import names in parent's locals: - for (name, asname) in newnode.names: + for name, asname in newnode.names: name = asname or name parent.set_local(name.split(".")[0], newnode) return newnode diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt index 1755c4be4e..ff9819e0c2 100644 --- a/requirements_test_pre_commit.txt +++ b/requirements_test_pre_commit.txt @@ -1,4 +1,4 @@ -black==22.12.0 +black==23.1a1 pylint==2.15.9 isort==5.11.4 flake8==5.0.4 diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py index 12092be775..fc799ee9b2 100644 --- a/tests/unittest_inference.py +++ b/tests/unittest_inference.py @@ -86,7 +86,6 @@ def partialmethod(func, arg): class InferenceTest(resources.SysPathSetup, unittest.TestCase): - # additional assertInfer* method for builtin types def assertInferConst(self, node: nodes.Call, expected: str) -> None: @@ -6498,7 +6497,7 @@ def __init__(self, *args, **kwargs): assert inferred is util.Uninferable -def test_inferring_properties_multiple_time_does_not_mutate_locals_multiple_times() -> None: +def test_inferring_properties_multiple_time_does_not_mutate_locals() -> None: code = """ class A: @property