Repository: pydantic/pydantic

Issue:
Impossible to use validators in a way that passes Pyright 1.1.344 validation.
### Initial Checks

- [X] I confirm that I'm using Pydantic V2

### Description

I wanted to raise awareness of [this issue](https://github.com/microsoft/pyright/issues/6875) here.

Currently, Eric is suggesting that defining the Protocols that do the typing for the decorators should be changed from `(self, cls, __value...` to `(self, __cls, __value...`.  However, the [conversation in the typing forum](https://discuss.python.org/t/ambiguities-about-positional-only-parameters/42328) also pointed out that the __ syntax for position-only parameters is only needed for py3.7 or earlier, and since 3.7 is EOL perhaps it makes sense to change to `(self, cls, value, /)`?

### Example Code

_No response_

### Python, Pydantic & OS Version

```Text
pydantic version: 2.5.3
        pydantic-core version: 2.14.6
          pydantic-core build: profile=release pgo=true
                 install path: /path/to/.venv/lib/python3.12/site-packages/pydantic
               python version: 3.12.1 (main, Dec 11 2023, 09:33:58) [GCC 11.4.0]
                     platform: Linux-6.6.6-76060606-generic-x86_64-with-glibc2.35
             related packages: typing_extensions-4.9.0 email-validator-2.1.0.post1
```



Discussion:

Resolving patch:
diff --git a/pydantic/functional_validators.py b/pydantic/functional_validators.py
--- a/pydantic/functional_validators.py
+++ b/pydantic/functional_validators.py
@@ -216,20 +216,21 @@ def __get_pydantic_core_schema__(self, source_type: Any, handler: _GetCoreSchema
 if TYPE_CHECKING:
 
     class _OnlyValueValidatorClsMethod(Protocol):
-        def __call__(self, __cls: Any, __value: Any) -> Any:
+        def __call__(self, cls: Any, value: Any, /) -> Any:
             ...
 
     class _V2ValidatorClsMethod(Protocol):
-        def __call__(self, __cls: Any, __input_value: Any, __info: _core_schema.ValidationInfo) -> Any:
+        def __call__(self, cls: Any, value: Any, info: _core_schema.ValidationInfo, /) -> Any:
             ...
 
     class _V2WrapValidatorClsMethod(Protocol):
         def __call__(
             self,
-            __cls: Any,
-            __input_value: Any,
-            __validator: _core_schema.ValidatorFunctionWrapHandler,
-            __info: _core_schema.ValidationInfo,
+            cls: Any,
+            value: Any,
+            handler: _core_schema.ValidatorFunctionWrapHandler,
+            info: _core_schema.ValidationInfo,
+            /,
         ) -> Any:
             ...
 
@@ -379,7 +380,10 @@ class ModelWrapValidatorHandler(_core_schema.ValidatorFunctionWrapHandler, Proto
     """@model_validator decorated function handler argument type. This is used when `mode='wrap'`."""
 
     def __call__(  # noqa: D102
-        self, input_value: Any, outer_location: str | int | None = None
+        self,
+        value: Any,
+        outer_location: str | int | None = None,
+        /,
     ) -> _ModelTypeCo:  # pragma: no cover
         ...
 
@@ -395,8 +399,9 @@ def __call__(  # noqa: D102
         # this can be a dict, a model instance
         # or anything else that gets passed to validate_python
         # thus validators _must_ handle all cases
-        __value: Any,
-        __handler: ModelWrapValidatorHandler[_ModelType],
+        value: Any,
+        handler: ModelWrapValidatorHandler[_ModelType],
+        /,
     ) -> _ModelType:
         ...
 
@@ -410,9 +415,10 @@ def __call__(  # noqa: D102
         # this can be a dict, a model instance
         # or anything else that gets passed to validate_python
         # thus validators _must_ handle all cases
-        __value: Any,
-        __handler: ModelWrapValidatorHandler[_ModelType],
-        __info: _core_schema.ValidationInfo,
+        value: Any,
+        handler: ModelWrapValidatorHandler[_ModelType],
+        info: _core_schema.ValidationInfo,
+        /,
     ) -> _ModelType:
         ...
 
@@ -427,7 +433,8 @@ def __call__(  # noqa: D102
         # this can be a dict, a model instance
         # or anything else that gets passed to validate_python
         # thus validators _must_ handle all cases
-        __value: Any,
+        value: Any,
+        /,
     ) -> Any:
         ...
 
@@ -443,7 +450,8 @@ def __call__(  # noqa: D102
         # this can be a dict, a model instance
         # or anything else that gets passed to validate_python
         # thus validators _must_ handle all cases
-        __value: Any,
+        value: Any,
+        /,
     ) -> Any:
         ...
 
@@ -456,8 +464,9 @@ def __call__(  # noqa: D102
         # this can be a dict, a model instance
         # or anything else that gets passed to validate_python
         # thus validators _must_ handle all cases
-        __value: Any,
-        __info: _core_schema.ValidationInfo,
+        value: Any,
+        info: _core_schema.ValidationInfo,
+        /,
     ) -> Any:
         ...
 
@@ -471,8 +480,9 @@ def __call__(  # noqa: D102
         # this can be a dict, a model instance
         # or anything else that gets passed to validate_python
         # thus validators _must_ handle all cases
-        __value: Any,
-        __info: _core_schema.ValidationInfo,
+        value: Any,
+        info: _core_schema.ValidationInfo,
+        /,
     ) -> Any:
         ...
 


Test patch: