diff --git a/.binder/environment.yml b/.binder/environment.yml index d0f8071d1..c83de3b55 100644 --- a/.binder/environment.yml +++ b/.binder/environment.yml @@ -3,7 +3,7 @@ channels: - conda-forge - defaults dependencies: - - python=3.9 + - python=3.10 - setuptools_scm - pip # jupyterlab setup diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index 89ec9df9d..97f7ac1ee 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -72,7 +72,7 @@ jobs: fetch-depth: 0 # Fetch all history for all tags and branches - uses: actions/setup-python@v4 with: - python-version: '3.9' + python-version: '3.10' - name: Cache pip uses: actions/cache@v3 diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 7a0daf376..b739e8494 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -47,7 +47,7 @@ jobs: with: environment-file: ./environment.yml environment-name: weldx - cache-env: true + cache-env: false extra-specs: | python=${{ matrix.py }} wheel @@ -61,17 +61,17 @@ jobs: run: micromamba activate weldx - name: install cookiecutter - if: matrix.py == '3.9' + if: matrix.py == '3.10' run: | pip install cookiecutter - name: create installable quality standard from repo - if: matrix.py == '3.9' + if: matrix.py == '3.10' run: | cookiecutter --no-input https://github.com/BAMWeldx/quality-standard-template - name: install quality standard - if: matrix.py == '3.9' + if: matrix.py == '3.10' run: | pip install -e ./quality_standard_demo @@ -87,32 +87,32 @@ jobs: path: pytest.xml - name: run pytest on notebooks (append coverage) - if: matrix.py == '3.9' + if: matrix.py == '3.10' run: | pytest -n 2 --dist loadfile --nbval --current-env --cov-append ./doc/src/tutorials/ - name: test with WeldxFile - if: matrix.py == '3.9' + if: matrix.py == '3.10' run: | pytest -n 2 --weldx-file-rw-buffer --weldx-file-rw-buffer-disp-header --cov-append ./weldx/tests/asdf_tests - name: test quality standard - if: matrix.py == '3.9' + if: matrix.py == '3.10' run: | pytest --cov-append ./weldx/tests/asdf_tests/quality_standards_check.py - name: test installable quality standard from template repository - if: matrix.py == '3.9' + if: matrix.py == '3.10' run: | pytest --cov-append ./weldx/tests/asdf_tests/installable_quality_standard_check.py - name: coverage xml (combination is performed by pytest-cov) - if: matrix.py == '3.9' + if: matrix.py == '3.10' run: coverage xml - name: codecov.io - if: matrix.py == '3.9' + if: matrix.py == '3.10' uses: codecov/codecov-action@v3.1.1 compat: @@ -126,7 +126,7 @@ jobs: fail-fast: false matrix: os: [windows-latest] - py: ['3.9'] + py: ['3.10'] steps: - uses: actions/checkout@v3 with: diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 36dc4be91..95410cebb 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -54,7 +54,7 @@ jobs: environment-name: weldx cache-env: true extra-specs: | - python=3.9 + python=3.10 mypy - name: activate env run: micromamba activate weldx diff --git a/devtools/conda.recipe/build_env.yml b/devtools/conda.recipe/build_env.yml index a0cb69761..74dc4e326 100644 --- a/devtools/conda.recipe/build_env.yml +++ b/devtools/conda.recipe/build_env.yml @@ -3,7 +3,7 @@ channels: - conda-forge - defaults dependencies: - - python=3.9 + - python=3.10 - setuptools - setuptools_scm - conda-verify diff --git a/devtools/environment.yml b/devtools/environment.yml index 3e787a7c5..7cb01e4c7 100644 --- a/devtools/environment.yml +++ b/devtools/environment.yml @@ -3,7 +3,7 @@ channels: - defaults - conda-forge dependencies: - - python=3.9 + - python=3.10 - setuptools_scm - numpy>=1.18 - pandas>=1.0 diff --git a/doc/rtd_environment.yml b/doc/rtd_environment.yml index 87dd1fc25..a8b84308b 100644 --- a/doc/rtd_environment.yml +++ b/doc/rtd_environment.yml @@ -2,7 +2,7 @@ channels: - conda-forge - defaults dependencies: - - python=3.9 + - python=3.10 - setuptools_scm # weldx base dependencies - numpy>=1.18 diff --git a/pyproject.toml b/pyproject.toml index 4c529b50a..994d08fea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -146,7 +146,7 @@ exclude_lines = [ ] [tool.mypy] -python_version = "3.9" +python_version = "3.10" files = "weldx" ignore_missing_imports = true # TODO: this is bad! strict_optional = false diff --git a/weldx/asdf/file.py b/weldx/asdf/file.py index 9d75379e7..6aa2a7d9b 100644 --- a/weldx/asdf/file.py +++ b/weldx/asdf/file.py @@ -5,10 +5,10 @@ import io import pathlib import warnings -from collections.abc import Iterable, Mapping, MutableMapping, Set, ValuesView +from collections.abc import Hashable, Iterable, Mapping, MutableMapping, Set, ValuesView from contextlib import contextmanager from io import BytesIO, IOBase -from typing import IO, Any, Dict, Hashable, Optional, Union, get_args +from typing import IO, Any, Optional, Union, get_args import asdf import numpy as np @@ -487,7 +487,7 @@ def software_history_entry(self, value: dict): "version": version, } else: - if not isinstance(value, Dict): + if not isinstance(value, dict): raise ValueError("expected a dictionary type") try: test = AsdfFile(tree=dict(software=Software(value))) diff --git a/weldx/asdf/util.py b/weldx/asdf/util.py index ba5169529..6f556dfeb 100644 --- a/weldx/asdf/util.py +++ b/weldx/asdf/util.py @@ -1,10 +1,10 @@ """Utilities for asdf files.""" from __future__ import annotations -from collections.abc import Callable, Mapping, Set +from collections.abc import Callable, Hashable, Mapping, MutableMapping, Set from io import BytesIO, TextIOBase from pathlib import Path -from typing import Any, Hashable, MutableMapping, Union +from typing import Any, Union from warnings import warn import asdf @@ -753,7 +753,7 @@ def mark_required(path, key, value): def drop_meta(path, key, value): """Drop common metadata fields from the output.""" default = {"examples", "description", "tag", "$ref", "type"} - return key not in default | set(drop) + return key not in (default, set(drop)) def drop_properties(path, key, value): """Drop the 'properties' field.""" diff --git a/weldx/config.py b/weldx/config.py index bcf23a1f1..78c490d4e 100644 --- a/weldx/config.py +++ b/weldx/config.py @@ -2,7 +2,7 @@ from __future__ import annotations from pathlib import Path -from typing import List, Union +from typing import Union import asdf import pkg_resources @@ -177,7 +177,7 @@ def load_installed_standards(): """Load all standards that are installed to the active virtual environment.""" for entry_point in pkg_resources.iter_entry_points("weldx.standard"): standards = entry_point.load()() - if not isinstance(standards, List): + if not isinstance(standards, list): standards = [standards] for standard in standards: if not isinstance(standard, QualityStandard): diff --git a/weldx/core/generic_series.py b/weldx/core/generic_series.py index 0a5ceb979..43cd7ee6a 100644 --- a/weldx/core/generic_series.py +++ b/weldx/core/generic_series.py @@ -683,7 +683,7 @@ def _check_constraints_discrete(cls, data_array: xr.DataArray): # check coordinate constraints _units = cls._required_dimension_units _vals = cls._required_dimension_coordinates - _keys = (set(_units.keys()) & set(data_array.dims)) | set(_vals.keys()) + _keys = ((set(_units.keys()) & set(data_array.dims)), set(_vals.keys())) ref: dict[str, dict] = {k: {} for k in _keys} for k in ref.keys(): diff --git a/weldx/core/math_expression.py b/weldx/core/math_expression.py index bc83cfe58..5de922f8c 100644 --- a/weldx/core/math_expression.py +++ b/weldx/core/math_expression.py @@ -1,7 +1,7 @@ """Contains the MathematicalExpression class.""" from __future__ import annotations -from typing import Any, Tuple, Union +from typing import Any, Union import pint import sympy @@ -10,7 +10,7 @@ from weldx import Q_ ExpressionParameterTypes = Union[ - pint.Quantity, str, Tuple[pint.Quantity, str], xr.DataArray + pint.Quantity, str, tuple[pint.Quantity, str], xr.DataArray ] __all__ = ["MathematicalExpression", "ExpressionParameterTypes"] diff --git a/weldx/tags/core/common_types.py b/weldx/tags/core/common_types.py index 35129ecd2..541f70127 100644 --- a/weldx/tags/core/common_types.py +++ b/weldx/tags/core/common_types.py @@ -1,9 +1,9 @@ from __future__ import annotations import dataclasses -from collections.abc import Mapping +from collections.abc import Hashable, Mapping from dataclasses import dataclass -from typing import Any, Hashable +from typing import Any import numpy as np import pint diff --git a/weldx/tests/test_time.py b/weldx/tests/test_time.py index e064171b0..1931ccffb 100644 --- a/weldx/tests/test_time.py +++ b/weldx/tests/test_time.py @@ -1,7 +1,7 @@ """Test the `Time` class.""" from __future__ import annotations -from typing import List, Union +from typing import Union import numpy as np import pandas as pd @@ -21,13 +21,13 @@ def _initialize_delta_type(cls_type, values, unit): """Initialize the passed time type.""" if cls_type is np.timedelta64: - if isinstance(values, List): + if isinstance(values, list): return np.array(values, dtype=f"timedelta64[{unit}]") return np.timedelta64(values, unit) if cls_type is Time: return Time(Q_(values, unit)) if cls_type is str: - if not isinstance(values, List): + if not isinstance(values, list): return f"{values}{unit}" return [f"{v}{unit}" for v in values] return cls_type(values, unit) @@ -36,7 +36,7 @@ def _initialize_delta_type(cls_type, values, unit): def _initialize_datetime_type(cls_type, values): """Initialize the passed datetime type.""" if cls_type is np.datetime64: - if isinstance(values, List): + if isinstance(values, list): return np.array(values, dtype="datetime64") return np.datetime64(values) if cls_type is str: diff --git a/weldx/time.py b/weldx/time.py index 9de53a697..3ac0b4206 100644 --- a/weldx/time.py +++ b/weldx/time.py @@ -4,7 +4,7 @@ from abc import ABC, abstractmethod from collections.abc import Sequence from functools import reduce -from typing import List, Union +from typing import Union import numpy as np import pandas as pd @@ -784,14 +784,14 @@ def _union_instance(self, times: Sequence[types_time_like]) -> Time: # list of types that are supported to be stored in Time._time _data_base_types = (pd.Timedelta, pd.Timestamp, pd.DatetimeIndex, pd.TimedeltaIndex) -types_datetime_like = Union[DatetimeIndex, np.datetime64, List[str], Time] +types_datetime_like = Union[DatetimeIndex, np.datetime64, list[str], Time] """types that define ascending arrays of time stamps.""" types_timestamp_like = Union[Timestamp, str, Time] """types that define timestamps.""" types_timedelta_like = Union[ - TimedeltaIndex, pint.Quantity, np.timedelta64, List[str], Time + TimedeltaIndex, pint.Quantity, np.timedelta64, list[str], Time ] """types that define ascending time delta arrays.""" diff --git a/weldx/util/util.py b/weldx/util/util.py index 3a1fbd1bb..58262e0a2 100644 --- a/weldx/util/util.py +++ b/weldx/util/util.py @@ -4,11 +4,11 @@ import functools import sys import warnings -from collections.abc import Callable, Sequence, Set +from collections.abc import Callable, Collection, Hashable, Mapping, Sequence, Set from functools import wraps from importlib.util import find_spec from inspect import getmembers, isfunction -from typing import ClassVar, Collection, Hashable, Mapping, Union +from typing import ClassVar, Union import numpy as np import pandas as pd