Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 35 for V2 (0.15 sec)

  1. fastapi/params.py

    from fastapi.openapi.models import Example
    from pydantic.fields import FieldInfo
    from typing_extensions import Annotated, deprecated
    
    from ._compat import PYDANTIC_V2, PYDANTIC_VERSION, Undefined
    
    _Unset: Any = Undefined
    
    
    class ParamTypes(Enum):
        query = "query"
        header = "header"
        path = "path"
        cookie = "cookie"
    
    
    class Param(FieldInfo):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 27.5K bytes
    - Viewed (1)
  2. fastapi/utils.py

        """
        class_validators = class_validators or {}
        if PYDANTIC_V2:
            field_info = field_info or FieldInfo(
                annotation=type_, default=default, alias=alias
            )
        else:
            field_info = field_info or FieldInfo()
        kwargs = {"name": name, "field_info": field_info}
        if PYDANTIC_V2:
            kwargs.update({"mode": mode})
        else:
            kwargs.update(
                {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  3. tests/test_additional_properties_bool.py

    from typing import Union
    
    from dirty_equals import IsDict
    from fastapi import FastAPI
    from fastapi._compat import PYDANTIC_V2
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, ConfigDict
    
    
    class FooBaseModel(BaseModel):
        if PYDANTIC_V2:
            model_config = ConfigDict(extra="forbid")
        else:
    
            class Config:
                extra = "forbid"
    
    
    class Foo(FooBaseModel):
        pass
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.2K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_wsgi/test_tutorial001.py

    
    def test_flask():
        response = client.get("/v1/")
        assert response.status_code == 200, response.text
        assert response.text == "Hello, World from Flask!"
    
    
    def test_app():
        response = client.get("/v2")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 436 bytes
    - Viewed (0)
  5. tests/test_tutorial/test_sql_databases/test_sql_databases.py

    
    # TODO: pv2 add version with Pydantic v2
    @needs_pydanticv1
    def test_get_user(client):
        response = client.get("/users/1")
        assert response.status_code == 200, response.text
        data = response.json()
        assert "email" in data
        assert "id" in data
    
    
    # TODO: pv2 add version with Pydantic v2
    @needs_pydanticv1
    def test_nonexistent_user(client):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 16.1K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_sql_databases/test_sql_databases_middleware_py310.py

    
    @needs_py310
    # TODO: pv2 add version with Pydantic v2
    @needs_pydanticv1
    def test_get_user(client):
        response = client.get("/users/1")
        assert response.status_code == 200, response.text
        data = response.json()
        assert "email" in data
        assert "id" in data
    
    
    @needs_py310
    # TODO: pv2 add version with Pydantic v2
    @needs_pydanticv1
    def test_nonexistent_user(client):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 16.5K bytes
    - Viewed (0)
  7. tensorflow/api_template.__init__.py

    if _tf_uses_legacy_keras:
      _module_dir = _module_util.get_parent_dir_for_name("tf_keras.api._v2.keras")
    else:
      _module_dir = _module_util.get_parent_dir_for_name("keras.api._v2.keras")
    _current_module.__path__ = [_module_dir] + _current_module.__path__
    
    
    # Enable TF2 behaviors
    from tensorflow.python.compat import v2_compat as _compat
    _compat.enable_v2_behavior()
    _major_api_version = 2
    
    
    Python
    - Registered: Tue Apr 23 12:39:09 GMT 2024
    - Last Modified: Tue Mar 05 06:27:59 GMT 2024
    - 6.7K bytes
    - Viewed (3)
  8. tests/test_response_by_alias.py

    from typing import List
    
    from fastapi import FastAPI
    from fastapi._compat import PYDANTIC_V2
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, ConfigDict, Field
    
    app = FastAPI()
    
    
    class Model(BaseModel):
        name: str = Field(alias="alias")
    
    
    class ModelNoAlias(BaseModel):
        name: str
    
        if PYDANTIC_V2:
            model_config = ConfigDict(
                json_schema_extra={
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 11.1K bytes
    - Viewed (0)
  9. tests/test_compat.py

            class_validators={},
            model_config=BaseConfig,
        )
        assert not is_pv1_scalar_field(field)
    
    
    @needs_pydanticv2
    def test_get_model_config():
        # For coverage in Pydantic v2
        class Foo(BaseModel):
            model_config = ConfigDict(from_attributes=True)
    
        foo = Foo()
        config = _get_model_config(foo)
        assert config == {"from_attributes": True}
    
    
    def test_complex():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  10. fastapi/param_functions.py

            Optional[str],
            Doc(
                """
                RegEx pattern for strings.
                """
            ),
            deprecated(
                "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead."
            ),
        ] = None,
        discriminator: Annotated[
            Union[str, None],
            Doc(
                """
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 62.5K bytes
    - Viewed (0)
Back to top