nebius/SWE-bench-extra huggingface dataset:
Repository: pydantic/pydantic

Issue:
when extra is allowed, representation is break
### Checks

* [x] I added a descriptive title to this issue
* [x] I have searched (google, github) for similar issues and couldn't find anything
* [x] I have read and followed [the docs](https://pydantic-docs.helpmanual.io/) and still think this is a bug

<!-- Sorry to sound so draconian, but every second saved replying to issues is time spend improving pydantic :-) -->

# Bug

Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`:
```
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
             pydantic version: 1.8.2
            pydantic compiled: False
                 install path: /Users/Sol/Project/pydantic/pydantic
               python version: 3.9.5 (default, Jun 23 2021, 22:47:04)  [Clang 11.0.3 (clang-1103.0.32.62)]
                     platform: macOS-10.15.6-x86_64-i386-64bit
     optional deps. installed: ['devtools', 'dotenv', 'email-validator', 'typing-extensions']
```
<!-- or if you're using pydantic prior to v1.3, manually include: OS, python version and pydantic version -->

<!-- Please read the [docs](https://pydantic-docs.helpmanual.io/) and search through issues to
confirm your bug hasn't already been reported. -->

<!-- Where possible please include a self-contained code snippet describing your bug: -->

```py
from pydantic import BaseModel
from pydantic import Extra



class Foo(BaseModel):
    a: int

    class Config:
        extra = Extra.allow


f = Foo(a=1, b=2)
breakpoint()
print(f) # << raise error. not only 'print', also str(Model), breakpoint().. etc

```

because

field b that allowed is not in Model.fields


in `main.BaseModel`

```
class BaseModel(Representation, metaclass=ModelMetaclass):

    ...

    def __repr_args__(self) -> 'ReprArgs':
        return [(k, v) for k, v in self.__dict__.items() if self.__fields__[k].field_info.repr] # KeyError
```





Comments:

Patch:
diff --git a/pydantic/main.py b/pydantic/main.py
--- a/pydantic/main.py
+++ b/pydantic/main.py
@@ -853,7 +853,9 @@ def __eq__(self, other: Any) -> bool:
             return self.dict() == other
 
     def __repr_args__(self) -> 'ReprArgs':
-        return [(k, v) for k, v in self.__dict__.items() if self.__fields__[k].field_info.repr]
+        return [
+            (k, v) for k, v in self.__dict__.items() if k not in self.__fields__ or self.__fields__[k].field_info.repr
+        ]
 
 
 _is_base_model_class_defined = True


Test patch:
diff --git a/tests/test_main.py b/tests/test_main.py
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -194,6 +194,16 @@ class Config:
     assert Model(a='10.2', b=12).dict() == {'a': 10.2, 'b': 12}
 
 
+def test_allow_extra_repr():
+    class Model(BaseModel):
+        a: float = ...
+
+        class Config:
+            extra = Extra.allow
+
+    assert str(Model(a='10.2', b=12)) == 'a=10.2 b=12'
+
+
 def test_forbidden_extra_success():
     class ForbiddenExtra(BaseModel):
         foo = 'whatever'
Repository: pydantic/pydantic

Issue:
Color comparison is always false
# Bug

Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`:
```
             pydantic version: 1.9.0
            pydantic compiled: True
                 install path: /home/xxxxxxx/xxxxxxx/xxxxxxx/venv310/lib/python3.10/site-packages/pydantic
               python version: 3.10.1 (main, Dec 21 2021, 17:46:38) [GCC 9.3.0]
                     platform: Linux-5.11.0-44-generic-x86_64-with-glibc2.31
     optional deps. installed: ['dotenv', 'typing-extensions']

```
<!-- or if you're using pydantic prior to v1.3, manually include: OS, python version and pydantic version -->

<!-- Please read the [docs](https://pydantic-docs.helpmanual.io/) and search through issues to
confirm your bug hasn't already been reported. -->

<!-- Where possible please include a self-contained code snippet describing your bug: -->
How to reproduce:

```py
>>> from pydantic.color import Color
>>> Color("red") == Color("red")
False
```
As a consequence, when using Color fields, the comparison of equal models is always false.


Comments:
This is not a bug. It's a feature request.

We don't currently implement special equals methods.

PR welcome. 

Patch:
diff --git a/pydantic/color.py b/pydantic/color.py
--- a/pydantic/color.py
+++ b/pydantic/color.py
@@ -198,6 +198,9 @@ def __str__(self) -> str:
     def __repr_args__(self) -> 'ReprArgs':
         return [(None, self.as_named(fallback=True))] + [('rgb', self.as_rgb_tuple())]  # type: ignore
 
+    def __eq__(self, other: Any) -> bool:
+        return isinstance(other, Color) and self.as_rgb_tuple() == other.as_rgb_tuple()
+
 
 def parse_tuple(value: Tuple[Any, ...]) -> RGBA:
     """


Test patch:
diff --git a/tests/test_color.py b/tests/test_color.py
--- a/tests/test_color.py
+++ b/tests/test_color.py
@@ -184,3 +184,12 @@ def test_str_repr():
     assert repr(Color('red')) == "Color('red', rgb=(255, 0, 0))"
     assert str(Color((1, 2, 3))) == '#010203'
     assert repr(Color((1, 2, 3))) == "Color('#010203', rgb=(1, 2, 3))"
+
+
+def test_eq():
+    assert Color('red') == Color('red')
+    assert Color('red') != Color('blue')
+    assert Color('red') != 'red'
+
+    assert Color('red') == Color((255, 0, 0))
+    assert Color('red') != Color((0, 0, 255))
Repository: pydantic/pydantic

Issue:
create_model not support generics model
### Checks

* [x] I added a descriptive title to this issue
* [x] I have searched (google, github) for similar issues and couldn't find anything
* [x] I have read and followed [the docs](https://pydantic-docs.helpmanual.io/) and still think this is a bug

# Bug

```
from typing import Generic, TypeVar

from pydantic import Field, create_model
from pydantic.generics import GenericModel

T = TypeVar("T")


class TestGenericModel(GenericModel):
    pass


AAModel = create_model("AAModel", __base__=(TestGenericModel, Generic[T]), aa=(int, Field(0)))

AAModel[int](aa=1)
```

output
```py
Traceback (most recent call last):
  File "test.py", line 13, in <module>
    AAModel = create_model("AAModel", __base__=(TestGenericModel, Generic[T]), aa=(int, Field(0)))
  File "pydantic/main.py", line 972, in pydantic.main.create_model
TypeError: type() doesn't support MRO entry resolution; use types.new_class()
```



Comments:

Patch:
diff --git a/pydantic/main.py b/pydantic/main.py
--- a/pydantic/main.py
+++ b/pydantic/main.py
@@ -4,7 +4,7 @@
 from enum import Enum
 from functools import partial
 from pathlib import Path
-from types import FunctionType
+from types import FunctionType, prepare_class, resolve_bases
 from typing import (
     TYPE_CHECKING,
     AbstractSet,
@@ -996,8 +996,12 @@ def create_model(
     namespace.update(fields)
     if __config__:
         namespace['Config'] = inherit_config(__config__, BaseConfig)
-
-    return type(__model_name, __base__, namespace, **__cls_kwargs__)
+    resolved_bases = resolve_bases(__base__)
+    meta, ns, kwds = prepare_class(__model_name, resolved_bases, kwds=__cls_kwargs__)
+    if resolved_bases is not __base__:
+        ns['__orig_bases__'] = __base__
+    namespace.update(ns)
+    return meta(__model_name, resolved_bases, namespace, **kwds)
 
 
 _missing = object()


Test patch:
diff --git a/tests/test_create_model.py b/tests/test_create_model.py
--- a/tests/test_create_model.py
+++ b/tests/test_create_model.py
@@ -1,6 +1,9 @@
+from typing import Generic, TypeVar
+
 import pytest
 
 from pydantic import BaseModel, Extra, Field, ValidationError, create_model, errors, validator
+from pydantic.generics import GenericModel
 
 
 def test_create_model():
@@ -205,3 +208,17 @@ class Config:
 
     m2 = create_model('M2', __config__=Config, a=(str, Field(...)))
     assert m2.schema()['properties'] == {'a': {'title': 'A', 'description': 'descr', 'type': 'string'}}
+
+
+def test_generics_model():
+    T = TypeVar('T')
+
+    class TestGenericModel(GenericModel):
+        pass
+
+    AAModel = create_model(
+        'AAModel', __base__=(TestGenericModel, Generic[T]), __cls_kwargs__={'orm_mode': True}, aa=(int, Field(0))
+    )
+    result = AAModel[int](aa=1)
+    assert result.aa == 1
+    assert result.__config__.orm_mode is True
Repository: pydantic/pydantic

Issue:
Behaviour of keep_untouched is unclear in docs
# Bug

* Python version `import sys; print(sys.version)`: 3.7.3
* Pydantic version `import pydantic; print(pydantic.VERSION)`: 0.32.2

The `keep_untouched` attribute on a model's Config affects the behaviour for properties' **values**, not their **type annotations**. This is unclear, and is also made particularly misleading by the wording of [this error message](https://github.com/samuelcolvin/pydantic/blob/master/pydantic/validators.py#L572):
```
RuntimeError: no validator found for {type_} see `keep_untouched` or `arbitrary_types_allowed` in Config
```
These should both be improved, and perhaps the config attribute's name should also be changed?


Comments:
I agree the name isn't that clear, but I think it's too late to change.

Happy to accept a PR to update the documentation, or even update the error message if we can do it asap.

Patch:
diff --git a/pydantic/validators.py b/pydantic/validators.py
--- a/pydantic/validators.py
+++ b/pydantic/validators.py
@@ -568,9 +568,7 @@ def find_validators(  # noqa: C901 (ignore complexity)
     if config.arbitrary_types_allowed:
         yield make_arbitrary_type_validator(type_)
     else:
-        raise RuntimeError(
-            f'no validator found for {type_} see `keep_untouched` or `arbitrary_types_allowed` in Config'
-        )
+        raise RuntimeError(f'no validator found for {type_}, see `arbitrary_types_allowed` in Config')
 
 
 def _find_supertype(type_: AnyType) -> Optional[AnyType]:


Test patch:
diff --git a/tests/test_main.py b/tests/test_main.py
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -951,7 +951,7 @@ def class_name(cls) -> str:
 
     assert str(e.value) == (
         "no validator found for <class 'tests.test_main.test_custom_types_fail_without_keep_untouched.<locals>."
-        "_ClassPropertyDescriptor'> see `keep_untouched` or `arbitrary_types_allowed` in Config"
+        "_ClassPropertyDescriptor'>, see `arbitrary_types_allowed` in Config"
     )
 
     class Model(BaseModel):