Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for attribute (0.18 sec)

  1. tests/test_compat.py

    
    @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():
        app = FastAPI()
    
        @app.post("/")
        def foo(foo: Union[str, List[int]]):
            return foo
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_body/test_tutorial001_py310.py

        assert response.status_code == 422, response.text
        assert response.json() == IsDict(
            {
                "detail": [
                    {
                        "type": "model_attributes_type",
                        "loc": ["body"],
                        "msg": "Input should be a valid dictionary or object to extract fields from",
                        "input": "name=Foo&price=50.5",
                    }
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 15K bytes
    - Viewed (1)
  3. tests/test_tutorial/test_body/test_tutorial001.py

        assert response.status_code == 422, response.text
        assert response.json() == IsDict(
            {
                "detail": [
                    {
                        "type": "model_attributes_type",
                        "loc": ["body"],
                        "msg": "Input should be a valid dictionary or object to extract fields from",
                        "input": "name=Foo&price=50.5",
                    }
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 14.7K bytes
    - Viewed (5)
  4. tests/test_inherited_custom_class.py

        @property
        def __dict__(self):
            """Spoof a missing __dict__ by raising TypeError, this is how
            asyncpg.pgroto.pgproto.UUID behaves"""
            raise TypeError("vars() argument must have __dict__ attribute")
    
    
    @needs_pydanticv2
    def test_pydanticv2():
        from pydantic import field_serializer
    
        app = FastAPI()
    
        @app.get("/fast_uuid")
        def return_fast_uuid():
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 3K bytes
    - Viewed (0)
  5. fastapi/datastructures.py

        """
        A file uploaded in a request.
    
        Define it as a *path operation function* (or dependency) parameter.
    
        If you are using a regular `def` function, you can use the `upload_file.file`
        attribute to access the raw standard Python file (blocking, not async), useful and
        needed for non-async code.
    
        Read more about it in the
        [FastAPI docs for Request Files](https://fastapi.tiangolo.com/tutorial/request-files/).
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 5.6K bytes
    - Viewed (0)
  6. fastapi/encoders.py

            bool,
            Doc(
                """
                Pydantic's `by_alias` parameter, passed to Pydantic models to define if
                the output should use the alias names (when provided) or the Python
                attribute names. In an API, if you set an alias, it's probably because you
                want to use it in the result, so you probably want to leave this set to
                `True`.
                """
            ),
        ] = True,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 10.8K bytes
    - Viewed (0)
  7. fastapi/applications.py

                    This is not passed as a parameter to the `FastAPI` class to avoid
                    giving the false idea that FastAPI would generate a different OpenAPI
                    schema. It is only available as an attribute.
    
                    **Example**
    
                    ```python
                    from fastapi import FastAPI
    
                    app = FastAPI()
    
                    app.openapi_version = "3.0.2"
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 172.2K bytes
    - Viewed (0)
  8. fastapi/openapi/models.py

        propertyName: str
        mapping: Optional[Dict[str, str]] = None
    
    
    class XML(BaseModelWithConfig):
        name: Optional[str] = None
        namespace: Optional[str] = None
        prefix: Optional[str] = None
        attribute: Optional[bool] = None
        wrapped: Optional[bool] = None
    
    
    class ExternalDocumentation(BaseModelWithConfig):
        description: Optional[str] = None
        url: AnyUrl
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 22:49:33 GMT 2024
    - 15K bytes
    - Viewed (1)
  9. fastapi/routing.py

            if read_with_orm_mode:
                # Let from_orm extract the data from this model instead of converting
                # it now to a dict.
                # Otherwise, there's no way to extract lazy data that requires attribute
                # access instead of dict iteration, e.g. lazy relationships.
                return res
            return _model_dump(
                res,
                by_alias=True,
                exclude_unset=exclude_unset,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 170.1K bytes
    - Viewed (0)
  10. fastapi/openapi/utils.py

                    # doing this inspection tricks, that would probably be in the future
                    # TODO: probably make status_code a default class attribute for all
                    # responses in Starlette
                    response_signature = inspect.signature(current_response_class.__init__)
                    status_code_param = response_signature.parameters.get("status_code")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 21.8K bytes
    - Viewed (0)
Back to top