Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for __bool__ (0.04 sec)

  1. fastapi/datastructures.py

        if the overridden default value was truthy.
        """
    
        def __init__(self, value: Any):
            self.value = value
    
        def __bool__(self) -> bool:
            return bool(self.value)
    
        def __eq__(self, o: object) -> bool:
            return isinstance(o, DefaultPlaceholder) and o.value == self.value
    
    
    DefaultType = TypeVar("DefaultType")
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Apr 02 02:48:51 UTC 2024
    - 5.6K bytes
    - Viewed (0)
  2. tests/test_jsonable_encoder.py

        assert jsonable_encoder(obj) == {"path": "\\foo\\bar"}
    
    
    @needs_pydanticv1
    def test_encode_root():
        class ModelWithRoot(BaseModel):
            __root__: str
    
        model = ModelWithRoot(__root__="Foo")
        assert jsonable_encoder(model) == "Foo"
    
    
    @needs_pydanticv2
    def test_decimal_encoder_float():
        data = {"value": Decimal(1.23)}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 21:56:59 UTC 2024
    - 9K bytes
    - Viewed (0)
  3. fastapi/encoders.py

                by_alias=by_alias,
                exclude_unset=exclude_unset,
                exclude_none=exclude_none,
                exclude_defaults=exclude_defaults,
            )
            if "__root__" in obj_dict:
                obj_dict = obj_dict["__root__"]
            return jsonable_encoder(
                obj_dict,
                exclude_none=exclude_none,
                exclude_defaults=exclude_defaults,
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 21:56:59 UTC 2024
    - 10.8K bytes
    - Viewed (0)
  4. docs/en/docs/release-notes.md

    * Add support for Python's `http.HTTPStatus` in `status_code` parameters. PR [#1534](https://github.com/tiangolo/fastapi/pull/1534) by [@retnikt](https://github.com/retnikt).
    * When using Pydantic models with `__root__`, use the internal value in `jsonable_encoder`. PR [#1524](https://github.com/tiangolo/fastapi/pull/1524) by [@patrickkwang](https://github.com/patrickkwang).
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Nov 01 11:25:57 UTC 2024
    - 460.3K bytes
    - Viewed (0)
Back to top