From 7c7c066096433fc11718938e9d03d3915216bd7a Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 7 May 2025 12:39:53 +0100 Subject: [PATCH] Bump Python version used for linters to 3.10 Change-Id: I693516fc2a08218c50d83a3ab121b51254f97958 Signed-off-by: Stephen Finucane --- .pre-commit-config.yaml | 2 +- openstackclient/compute/v2/server.py | 3 +-- openstackclient/shell.py | 2 +- openstackclient/tests/unit/volume/v2/fakes.py | 3 +-- pyproject.toml | 3 ++- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a8382cf11b..09a9172bd2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: files: .*\.(yaml|yml)$ args: ['--unsafe'] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.2 + rev: v0.11.8 hooks: - id: ruff args: ['--fix', '--unsafe-fixes'] diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index 4260e7888c..524eae5490 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -21,7 +21,6 @@ import getpass import json import logging import os -import typing as ty from cliff import columns as cliff_columns import iso8601 @@ -1874,7 +1873,7 @@ class CreateServer(command.ShowOne): # Default to empty list if nothing was specified and let nova # decide the default behavior. - networks: ty.Union[str, list[dict[str, str]], None] = [] + networks: str | list[dict[str, str]] | None = [] if 'auto' in parsed_args.nics or 'none' in parsed_args.nics: if len(parsed_args.nics) > 1: diff --git a/openstackclient/shell.py b/openstackclient/shell.py index 50a767ec35..6bbbb5f7b6 100644 --- a/openstackclient/shell.py +++ b/openstackclient/shell.py @@ -94,7 +94,7 @@ class OpenStackShell(shell.OpenStackShell): # instead. mod_versions = getattr(mod, 'API_VERSIONS', None) if mod_versions is not None and not isinstance( - mod_versions, (dict, tuple) + mod_versions, dict | tuple ): raise TypeError( f'Plugin {mod} has incompatible API_VERSIONS. ' diff --git a/openstackclient/tests/unit/volume/v2/fakes.py b/openstackclient/tests/unit/volume/v2/fakes.py index 1c183728c0..c2303d3880 100644 --- a/openstackclient/tests/unit/volume/v2/fakes.py +++ b/openstackclient/tests/unit/volume/v2/fakes.py @@ -14,7 +14,6 @@ import copy import random -import typing as ty from unittest import mock import uuid @@ -92,7 +91,7 @@ class FakeClientMixin: self.volume_sdk_client = self.app.client_manager.sdk_connection.volume self.set_volume_api_version() # default to the lowest - def set_volume_api_version(self, version: ty.Optional[str] = None): + def set_volume_api_version(self, version: str | None = None): """Set a fake block storage API version. :param version: The fake microversion to "support". This must be None diff --git a/pyproject.toml b/pyproject.toml index 2a532cef68..50092d406d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.mypy] -python_version = "3.9" +python_version = "3.10" show_column_numbers = true show_error_context = true ignore_missing_imports = true @@ -22,6 +22,7 @@ ignore_errors = true [tool.ruff] line-length = 79 +target-version = "py310" [tool.ruff.format] quote-style = "preserve"