Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade ruff target version to Python 3.8 #8341

Merged
merged 1 commit into from Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 2 additions & 10 deletions pydantic/plugin/_loader.py
@@ -1,16 +1,8 @@
from __future__ import annotations

import sys
import importlib.metadata as importlib_metadata
import warnings
from typing import TYPE_CHECKING, Iterable

from typing_extensions import Final

if sys.version_info >= (3, 8):
import importlib.metadata as importlib_metadata
else:
import importlib_metadata

from typing import TYPE_CHECKING, Final, Iterable
sydney-runkle marked this conversation as resolved.
Show resolved Hide resolved

if TYPE_CHECKING:
from . import PydanticPluginProtocol
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -181,7 +181,7 @@ extend-ignore = ['D105', 'D107', 'D205', 'D415']
flake8-quotes = {inline-quotes = 'single', multiline-quotes = 'double'}
mccabe = { max-complexity = 14 }
isort = { known-first-party = ['pydantic', 'tests'] }
target-version = "py37"
target-version = "py38"
extend-exclude = ['pydantic/v1', 'tests/mypy/outputs']

[tool.ruff.extend-per-file-ignores]
Expand Down
34 changes: 16 additions & 18 deletions tests/test_edge_cases.py
Expand Up @@ -2724,22 +2724,20 @@ def test_eq_with_cached_property():
model instances. This is not compatible with e.g. functools.cached_property,
which caches the computed values in the instance's __dict__
"""
# functools.cached_property doesn't exist in python 3.7
if sys.version_info >= (3, 8):

class Model(BaseModel):
attr: int

@functools.cached_property
def cached(self) -> int:
return 0

obj1 = Model(attr=1)
obj2 = Model(attr=1)
# ensure the instances are indeed equal before __dict__ mutations
assert obj1 == obj2
# This access to the cached_property has the side-effect of modifying obj1.__dict__
# See functools.cached_property documentation and source code
obj1.cached
# Ensure the objects still compare equals after caching a property
assert obj1 == obj2
class Model(BaseModel):
attr: int

@functools.cached_property
def cached(self) -> int:
return 0

obj1 = Model(attr=1)
obj2 = Model(attr=1)
# ensure the instances are indeed equal before __dict__ mutations
assert obj1 == obj2
# This access to the cached_property has the side-effect of modifying obj1.__dict__
# See functools.cached_property documentation and source code
obj1.cached
# Ensure the objects still compare equals after caching a property
assert obj1 == obj2
8 changes: 1 addition & 7 deletions tests/test_typing.py
Expand Up @@ -27,13 +27,7 @@
except ImportError:
typing_extensions_TypedDict = None


try:
from mypy_extensions import TypedDict as mypy_extensions_TypedDict
except ImportError:
mypy_extensions_TypedDict = None

ALL_TYPEDDICT_KINDS = (typing_TypedDict, typing_extensions_TypedDict, mypy_extensions_TypedDict)
ALL_TYPEDDICT_KINDS = (typing_TypedDict, typing_extensions_TypedDict)


def test_is_namedtuple():
Expand Down