prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Compatibility with pydantic 1.4
  I'm trying to use strawberry in a project that has pydantic pinned at 1.4. I chatted with @patrick91 on discord about this, and he thought it would be reasonable to achieve compatibility with this version.
  
  Pydantic appears to only be used in the [strawberry.experimental](https://github.com/strawberry-graphql/strawberry/blob/main/strawberry/experimental/__init__.py) module, which only gets loaded if pydantic is present. One way to solve this for me in particular would be to lazily load strawberry.experimental/pydantic, such that when an older version of pydantic is present, one can still import other packages in strawberry.
  
  Thank you!
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `strawberry/experimental/pydantic/fields.py`
  Content:
  ```
  1 from decimal import Decimal
  2 from typing import Optional
  3 from uuid import UUID
  4 
  5 import pydantic
  6 
  7 from .exceptions import UnsupportedTypeError
  8 
  9 
  10 FIELDS_MAP = {
  11     pydantic.NoneStr: Optional[str],
  12     pydantic.NoneBytes: Optional[bytes],
  13     pydantic.StrBytes: None,
  14     pydantic.NoneStrBytes: None,
  15     pydantic.StrictStr: str,
  16     pydantic.ConstrainedBytes: bytes,
  17     pydantic.conbytes: bytes,
  18     pydantic.ConstrainedList: None,
  19     pydantic.conlist: None,
  20     pydantic.ConstrainedSet: None,
  21     pydantic.conset: None,
  22     pydantic.ConstrainedStr: str,
  23     pydantic.constr: str,
  24     pydantic.EmailStr: str,
  25     pydantic.PyObject: None,
  26     pydantic.ConstrainedInt: int,
  27     pydantic.conint: int,
  28     pydantic.PositiveInt: int,
  29     pydantic.NegativeInt: int,
  30     pydantic.ConstrainedFloat: float,
  31     pydantic.confloat: float,
  32     pydantic.PositiveFloat: float,
  33     pydantic.NegativeFloat: float,
  34     pydantic.ConstrainedDecimal: Decimal,
  35     pydantic.condecimal: Decimal,
  36     pydantic.UUID1: UUID,
  37     pydantic.UUID3: UUID,
  38     pydantic.UUID4: UUID,
  39     pydantic.UUID5: UUID,
  40     pydantic.FilePath: None,
  41     pydantic.DirectoryPath: None,
  42     pydantic.Json: None,
  43     pydantic.JsonWrapper: None,
  44     pydantic.SecretStr: str,
  45     pydantic.SecretBytes: bytes,
  46     pydantic.StrictBool: bool,
  47     pydantic.StrictInt: int,
  48     pydantic.StrictFloat: float,
  49     pydantic.PaymentCardNumber: None,
  50     pydantic.ByteSize: None,
  51     pydantic.AnyUrl: str,
  52     pydantic.AnyHttpUrl: str,
  53     pydantic.HttpUrl: str,
  54     pydantic.PostgresDsn: str,
  55     pydantic.RedisDsn: str,
  56 }
  57 
  58 
  59 def get_basic_type(type_):
  60     if isinstance(type_, type):
  61         if issubclass(type_, pydantic.ConstrainedInt):
  62             return int
  63         if issubclass(type_, pydantic.ConstrainedStr):
  64             return str
  65 
  66     if type_ in FIELDS_MAP:
  67         type_ = FIELDS_MAP.get(type_)
  68 
  69         if type_ is None:
  70             raise UnsupportedTypeError()
  71 
  72     return type_
  73
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/strawberry/experimental/pydantic/fields.py b/strawberry/experimental/pydantic/fields.py
  --- a/strawberry/experimental/pydantic/fields.py
  +++ b/strawberry/experimental/pydantic/fields.py
  @@ -7,52 +7,59 @@
   from .exceptions import UnsupportedTypeError
   
   
  +ATTR_TO_TYPE_MAP = {
  +    "NoneStr": Optional[str],
  +    "NoneBytes": Optional[bytes],
  +    "StrBytes": None,
  +    "NoneStrBytes": None,
  +    "StrictStr": str,
  +    "ConstrainedBytes": bytes,
  +    "conbytes": bytes,
  +    "ConstrainedList": None,
  +    "conlist": None,
  +    "ConstrainedSet": None,
  +    "conset": None,
  +    "ConstrainedStr": str,
  +    "constr": str,
  +    "EmailStr": str,
  +    "PyObject": None,
  +    "ConstrainedInt": int,
  +    "conint": int,
  +    "PositiveInt": int,
  +    "NegativeInt": int,
  +    "ConstrainedFloat": float,
  +    "confloat": float,
  +    "PositiveFloat": float,
  +    "NegativeFloat": float,
  +    "ConstrainedDecimal": Decimal,
  +    "condecimal": Decimal,
  +    "UUID1": UUID,
  +    "UUID3": UUID,
  +    "UUID4": UUID,
  +    "UUID5": UUID,
  +    "FilePath": None,
  +    "DirectoryPath": None,
  +    "Json": None,
  +    "JsonWrapper": None,
  +    "SecretStr": str,
  +    "SecretBytes": bytes,
  +    "StrictBool": bool,
  +    "StrictInt": int,
  +    "StrictFloat": float,
  +    "PaymentCardNumber": None,
  +    "ByteSize": None,
  +    "AnyUrl": str,
  +    "AnyHttpUrl": str,
  +    "HttpUrl": str,
  +    "PostgresDsn": str,
  +    "RedisDsn": str,
  +}
  +
  +
   FIELDS_MAP = {
  -    pydantic.NoneStr: Optional[str],
  -    pydantic.NoneBytes: Optional[bytes],
  -    pydantic.StrBytes: None,
  -    pydantic.NoneStrBytes: None,
  -    pydantic.StrictStr: str,
  -    pydantic.ConstrainedBytes: bytes,
  -    pydantic.conbytes: bytes,
  -    pydantic.ConstrainedList: None,
  -    pydantic.conlist: None,
  -    pydantic.ConstrainedSet: None,
  -    pydantic.conset: None,
  -    pydantic.ConstrainedStr: str,
  -    pydantic.constr: str,
  -    pydantic.EmailStr: str,
  -    pydantic.PyObject: None,
  -    pydantic.ConstrainedInt: int,
  -    pydantic.conint: int,
  -    pydantic.PositiveInt: int,
  -    pydantic.NegativeInt: int,
  -    pydantic.ConstrainedFloat: float,
  -    pydantic.confloat: float,
  -    pydantic.PositiveFloat: float,
  -    pydantic.NegativeFloat: float,
  -    pydantic.ConstrainedDecimal: Decimal,
  -    pydantic.condecimal: Decimal,
  -    pydantic.UUID1: UUID,
  -    pydantic.UUID3: UUID,
  -    pydantic.UUID4: UUID,
  -    pydantic.UUID5: UUID,
  -    pydantic.FilePath: None,
  -    pydantic.DirectoryPath: None,
  -    pydantic.Json: None,
  -    pydantic.JsonWrapper: None,
  -    pydantic.SecretStr: str,
  -    pydantic.SecretBytes: bytes,
  -    pydantic.StrictBool: bool,
  -    pydantic.StrictInt: int,
  -    pydantic.StrictFloat: float,
  -    pydantic.PaymentCardNumber: None,
  -    pydantic.ByteSize: None,
  -    pydantic.AnyUrl: str,
  -    pydantic.AnyHttpUrl: str,
  -    pydantic.HttpUrl: str,
  -    pydantic.PostgresDsn: str,
  -    pydantic.RedisDsn: str,
  +    getattr(pydantic, field_name): type
  +    for field_name, type in ATTR_TO_TYPE_MAP.items()
  +    if hasattr(pydantic, field_name)
   }
  
verification_info: {"golden_diff": "diff --git a/strawberry/experimental/pydantic/fields.py b/strawberry/experimental/pydantic/fields.py\n--- a/strawberry/experimental/pydantic/fields.py\n+++ b/strawberry/experimental/pydantic/fields.py\n@@ -7,52 +7,59 @@\n from .exceptions import UnsupportedTypeError\n \n \n+ATTR_TO_TYPE_MAP = {\n+    \"NoneStr\": Optional[str],\n+    \"NoneBytes\": Optional[bytes],\n+    \"StrBytes\": None,\n+    \"NoneStrBytes\": None,\n+    \"StrictStr\": str,\n+    \"ConstrainedBytes\": bytes,\n+    \"conbytes\": bytes,\n+    \"ConstrainedList\": None,\n+    \"conlist\": None,\n+    \"ConstrainedSet\": None,\n+    \"conset\": None,\n+    \"ConstrainedStr\": str,\n+    \"constr\": str,\n+    \"EmailStr\": str,\n+    \"PyObject\": None,\n+    \"ConstrainedInt\": int,\n+    \"conint\": int,\n+    \"PositiveInt\": int,\n+    \"NegativeInt\": int,\n+    \"ConstrainedFloat\": float,\n+    \"confloat\": float,\n+    \"PositiveFloat\": float,\n+    \"NegativeFloat\": float,\n+    \"ConstrainedDecimal\": Decimal,\n+    \"condecimal\": Decimal,\n+    \"UUID1\": UUID,\n+    \"UUID3\": UUID,\n+    \"UUID4\": UUID,\n+    \"UUID5\": UUID,\n+    \"FilePath\": None,\n+    \"DirectoryPath\": None,\n+    \"Json\": None,\n+    \"JsonWrapper\": None,\n+    \"SecretStr\": str,\n+    \"SecretBytes\": bytes,\n+    \"StrictBool\": bool,\n+    \"StrictInt\": int,\n+    \"StrictFloat\": float,\n+    \"PaymentCardNumber\": None,\n+    \"ByteSize\": None,\n+    \"AnyUrl\": str,\n+    \"AnyHttpUrl\": str,\n+    \"HttpUrl\": str,\n+    \"PostgresDsn\": str,\n+    \"RedisDsn\": str,\n+}\n+\n+\n FIELDS_MAP = {\n-    pydantic.NoneStr: Optional[str],\n-    pydantic.NoneBytes: Optional[bytes],\n-    pydantic.StrBytes: None,\n-    pydantic.NoneStrBytes: None,\n-    pydantic.StrictStr: str,\n-    pydantic.ConstrainedBytes: bytes,\n-    pydantic.conbytes: bytes,\n-    pydantic.ConstrainedList: None,\n-    pydantic.conlist: None,\n-    pydantic.ConstrainedSet: None,\n-    pydantic.conset: None,\n-    pydantic.ConstrainedStr: str,\n-    pydantic.constr: str,\n-    pydantic.EmailStr: str,\n-    pydantic.PyObject: None,\n-    pydantic.ConstrainedInt: int,\n-    pydantic.conint: int,\n-    pydantic.PositiveInt: int,\n-    pydantic.NegativeInt: int,\n-    pydantic.ConstrainedFloat: float,\n-    pydantic.confloat: float,\n-    pydantic.PositiveFloat: float,\n-    pydantic.NegativeFloat: float,\n-    pydantic.ConstrainedDecimal: Decimal,\n-    pydantic.condecimal: Decimal,\n-    pydantic.UUID1: UUID,\n-    pydantic.UUID3: UUID,\n-    pydantic.UUID4: UUID,\n-    pydantic.UUID5: UUID,\n-    pydantic.FilePath: None,\n-    pydantic.DirectoryPath: None,\n-    pydantic.Json: None,\n-    pydantic.JsonWrapper: None,\n-    pydantic.SecretStr: str,\n-    pydantic.SecretBytes: bytes,\n-    pydantic.StrictBool: bool,\n-    pydantic.StrictInt: int,\n-    pydantic.StrictFloat: float,\n-    pydantic.PaymentCardNumber: None,\n-    pydantic.ByteSize: None,\n-    pydantic.AnyUrl: str,\n-    pydantic.AnyHttpUrl: str,\n-    pydantic.HttpUrl: str,\n-    pydantic.PostgresDsn: str,\n-    pydantic.RedisDsn: str,\n+    getattr(pydantic, field_name): type\n+    for field_name, type in ATTR_TO_TYPE_MAP.items()\n+    if hasattr(pydantic, field_name)\n }\n", "issue": "Compatibility with pydantic 1.4\nI'm trying to use strawberry in a project that has pydantic pinned at 1.4. I chatted with @patrick91 on discord about this, and he thought it would be reasonable to achieve compatibility with this version.\r\n\r\nPydantic appears to only be used in the [strawberry.experimental](https://github.com/strawberry-graphql/strawberry/blob/main/strawberry/experimental/__init__.py) module, which only gets loaded if pydantic is present. One way to solve this for me in particular would be to lazily load strawberry.experimental/pydantic, such that when an older version of pydantic is present, one can still import other packages in strawberry.\r\n\r\nThank you!\n", "before_files": [{"content": "from decimal import Decimal\nfrom typing import Optional\nfrom uuid import UUID\n\nimport pydantic\n\nfrom .exceptions import UnsupportedTypeError\n\n\nFIELDS_MAP = {\n    pydantic.NoneStr: Optional[str],\n    pydantic.NoneBytes: Optional[bytes],\n    pydantic.StrBytes: None,\n    pydantic.NoneStrBytes: None,\n    pydantic.StrictStr: str,\n    pydantic.ConstrainedBytes: bytes,\n    pydantic.conbytes: bytes,\n    pydantic.ConstrainedList: None,\n    pydantic.conlist: None,\n    pydantic.ConstrainedSet: None,\n    pydantic.conset: None,\n    pydantic.ConstrainedStr: str,\n    pydantic.constr: str,\n    pydantic.EmailStr: str,\n    pydantic.PyObject: None,\n    pydantic.ConstrainedInt: int,\n    pydantic.conint: int,\n    pydantic.PositiveInt: int,\n    pydantic.NegativeInt: int,\n    pydantic.ConstrainedFloat: float,\n    pydantic.confloat: float,\n    pydantic.PositiveFloat: float,\n    pydantic.NegativeFloat: float,\n    pydantic.ConstrainedDecimal: Decimal,\n    pydantic.condecimal: Decimal,\n    pydantic.UUID1: UUID,\n    pydantic.UUID3: UUID,\n    pydantic.UUID4: UUID,\n    pydantic.UUID5: UUID,\n    pydantic.FilePath: None,\n    pydantic.DirectoryPath: None,\n    pydantic.Json: None,\n    pydantic.JsonWrapper: None,\n    pydantic.SecretStr: str,\n    pydantic.SecretBytes: bytes,\n    pydantic.StrictBool: bool,\n    pydantic.StrictInt: int,\n    pydantic.StrictFloat: float,\n    pydantic.PaymentCardNumber: None,\n    pydantic.ByteSize: None,\n    pydantic.AnyUrl: str,\n    pydantic.AnyHttpUrl: str,\n    pydantic.HttpUrl: str,\n    pydantic.PostgresDsn: str,\n    pydantic.RedisDsn: str,\n}\n\n\ndef get_basic_type(type_):\n    if isinstance(type_, type):\n        if issubclass(type_, pydantic.ConstrainedInt):\n            return int\n        if issubclass(type_, pydantic.ConstrainedStr):\n            return str\n\n    if type_ in FIELDS_MAP:\n        type_ = FIELDS_MAP.get(type_)\n\n        if type_ is None:\n            raise UnsupportedTypeError()\n\n    return type_\n", "path": "strawberry/experimental/pydantic/fields.py"}], "after_files": [{"content": "from decimal import Decimal\nfrom typing import Optional\nfrom uuid import UUID\n\nimport pydantic\n\nfrom .exceptions import UnsupportedTypeError\n\n\nATTR_TO_TYPE_MAP = {\n    \"NoneStr\": Optional[str],\n    \"NoneBytes\": Optional[bytes],\n    \"StrBytes\": None,\n    \"NoneStrBytes\": None,\n    \"StrictStr\": str,\n    \"ConstrainedBytes\": bytes,\n    \"conbytes\": bytes,\n    \"ConstrainedList\": None,\n    \"conlist\": None,\n    \"ConstrainedSet\": None,\n    \"conset\": None,\n    \"ConstrainedStr\": str,\n    \"constr\": str,\n    \"EmailStr\": str,\n    \"PyObject\": None,\n    \"ConstrainedInt\": int,\n    \"conint\": int,\n    \"PositiveInt\": int,\n    \"NegativeInt\": int,\n    \"ConstrainedFloat\": float,\n    \"confloat\": float,\n    \"PositiveFloat\": float,\n    \"NegativeFloat\": float,\n    \"ConstrainedDecimal\": Decimal,\n    \"condecimal\": Decimal,\n    \"UUID1\": UUID,\n    \"UUID3\": UUID,\n    \"UUID4\": UUID,\n    \"UUID5\": UUID,\n    \"FilePath\": None,\n    \"DirectoryPath\": None,\n    \"Json\": None,\n    \"JsonWrapper\": None,\n    \"SecretStr\": str,\n    \"SecretBytes\": bytes,\n    \"StrictBool\": bool,\n    \"StrictInt\": int,\n    \"StrictFloat\": float,\n    \"PaymentCardNumber\": None,\n    \"ByteSize\": None,\n    \"AnyUrl\": str,\n    \"AnyHttpUrl\": str,\n    \"HttpUrl\": str,\n    \"PostgresDsn\": str,\n    \"RedisDsn\": str,\n}\n\n\nFIELDS_MAP = {\n    getattr(pydantic, field_name): type\n    for field_name, type in ATTR_TO_TYPE_MAP.items()\n    if hasattr(pydantic, field_name)\n}\n\n\ndef get_basic_type(type_):\n    if isinstance(type_, type):\n        if issubclass(type_, pydantic.ConstrainedInt):\n            return int\n        if issubclass(type_, pydantic.ConstrainedStr):\n            return str\n\n    if type_ in FIELDS_MAP:\n        type_ = FIELDS_MAP.get(type_)\n\n        if type_ is None:\n            raise UnsupportedTypeError()\n\n    return type_\n", "path": "strawberry/experimental/pydantic/fields.py"}]}