diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 43a717b..2a093ab 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ default_language_version: python: python3 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -21,7 +21,7 @@ repos: - id: sort-simple-yaml - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 23.11.0 hooks: - id: black additional_dependencies: [".[jupyter]"] @@ -31,13 +31,13 @@ repos: hooks: - id: isort - repo: https://github.com/codespell-project/codespell - rev: v2.2.5 + rev: v2.2.6 hooks: - id: codespell additional_dependencies: ["tomli"] - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.0.290' + rev: 'v0.1.6' hooks: - id: ruff args: ['--fix'] diff --git a/tests/test_AutomaticInit.py b/tests/test_AutomaticInit.py index e95e5ba..e23a36e 100644 --- a/tests/test_AutomaticInit.py +++ b/tests/test_AutomaticInit.py @@ -1,4 +1,5 @@ """Test for the automatic __init__.""" + import datetime import pytest diff --git a/tests/test_descriptor.py b/tests/test_descriptor.py index a3a3b57..bc937ae 100644 --- a/tests/test_descriptor.py +++ b/tests/test_descriptor.py @@ -1,4 +1,5 @@ """Test ZnInit descriptors.""" + import pytest from zninit import Descriptor, get_descriptors diff --git a/tests/test_i_zninit.py b/tests/test_i_zninit.py index 2fd37cd..0af5aac 100644 --- a/tests/test_i_zninit.py +++ b/tests/test_i_zninit.py @@ -1,4 +1,5 @@ """General 'ZnInit' integration tests.""" + import pytest import zninit diff --git a/tests/test_subclass_automatic.py b/tests/test_subclass_automatic.py index d725e2d..07a3133 100644 --- a/tests/test_subclass_automatic.py +++ b/tests/test_subclass_automatic.py @@ -1,4 +1,5 @@ """Test subclass handling.""" + import pytest from zninit import Descriptor, ZnInit diff --git a/tests/test_u_core.py b/tests/test_u_core.py index 59fda63..e05da23 100644 --- a/tests/test_u_core.py +++ b/tests/test_u_core.py @@ -1,4 +1,5 @@ """'ZnInit' unit tests.""" + from zninit import Descriptor, ZnInit from zninit.core import _get_auto_init_kwargs, get_args_type_error, get_init_type_error diff --git a/tests/test_u_descriptor.py b/tests/test_u_descriptor.py index 348a7af..5db15ff 100644 --- a/tests/test_u_descriptor.py +++ b/tests/test_u_descriptor.py @@ -1,4 +1,5 @@ """Unit tests for 'ZnInit'.""" + import collections.abc import sys import typing diff --git a/zninit/__init__.py b/zninit/__init__.py index c5488c0..c2cff59 100644 --- a/zninit/__init__.py +++ b/zninit/__init__.py @@ -1,4 +1,5 @@ """ZnInit Package for automatic __init__ generation.""" + import importlib.metadata from zninit.core import ZnInit diff --git a/zninit/core/__init__.py b/zninit/core/__init__.py index fda98ae..73218d4 100644 --- a/zninit/core/__init__.py +++ b/zninit/core/__init__.py @@ -1,4 +1,5 @@ """Functionality to generate the automatic __init__.""" + from __future__ import annotations import logging @@ -142,9 +143,9 @@ def auto_init(self, *args, **kwargs): # noqa: C901 if kwarg_name not in priority_kwargs: required_keys.append(kwarg_name) - init_kwargs.update( - {name: kwargs.pop(name, value) for name, value in kwargs_with_default.items()} - ) + init_kwargs.update({ + name: kwargs.pop(name, value) for name, value in kwargs_with_default.items() + }) super_init(self, **kwargs) # call the super_init explicitly instead of super # must call the super_init first e.g. it is required to set the node_name diff --git a/zninit/descriptor/__init__.py b/zninit/descriptor/__init__.py index c09f200..0e5a22c 100644 --- a/zninit/descriptor/__init__.py +++ b/zninit/descriptor/__init__.py @@ -1,4 +1,5 @@ """Definition and utils for the Descriptor class.""" + from __future__ import annotations import contextlib