Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 49 of 49 for valueOf (0.17 sec)

  1. tests/test_tutorial/test_query_params_str_validations/test_tutorial012_an.py

    from docs_src.query_params_str_validations.tutorial012_an import app
    
    client = TestClient(app)
    
    
    def test_default_query_values():
        url = "/items/"
        response = client.get(url)
        assert response.status_code == 200, response.text
        assert response.json() == {"q": ["foo", "bar"]}
    
    
    def test_multi_query_values():
        url = "/items/?q=baz&q=foobar"
        response = client.get(url)
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.4K bytes
    - Viewed (0)
  2. docs_src/header_params/tutorial003_py39.py

    from typing import Union
    
    from fastapi import FastAPI, Header
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(x_token: Union[list[str], None] = Header(default=None)):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 218 bytes
    - Viewed (0)
  3. tests/test_filter_pydantic_sub_model/app_pv1.py

    class ModelC(ModelB):
        password: str
    
    
    class ModelA(BaseModel):
        name: str
        description: Optional[str] = None
        model_b: ModelB
    
        @validator("name")
        def lower_username(cls, name: str, values):
            if not name.endswith("A"):
                raise ValueError("name must end in A")
            return name
    
    
    async def get_model_c() -> ModelC:
        return ModelC(username="test-user", password="test-password")
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 784 bytes
    - Viewed (0)
  4. docs/en/docs/tutorial/body.md

    !!! note
        FastAPI will know that the value of `q` is not required because of the default value `= None`.
    
        The `Union` in `Union[str, None]` is not used by FastAPI, but will allow your editor to give you better support and detect errors.
    
    ## Without Pydantic
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 7.3K bytes
    - Viewed (0)
  5. docs/en/docs/advanced/additional-status-codes.md

    !!! warning
        When you return a `Response` directly, like in the example above, it will be returned directly.
    
        It won't be serialized with a model, etc.
    
        Make sure it has the data you want it to have, and that the values are valid JSON (if you are using `JSONResponse`).
    
    !!! note "Technical Details"
        You could also use `from starlette.responses import JSONResponse`.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 2.6K bytes
    - Viewed (0)
  6. .github/workflows/build-docs.yml

      pull_request:
        types:
          - opened
          - synchronize
    jobs:
      changes:
        runs-on: ubuntu-latest
        # Required permissions
        permissions:
          pull-requests: read
        # Set job outputs to values from filter step
        outputs:
          docs: ${{ steps.filter.outputs.docs }}
        steps:
        - uses: actions/checkout@v4
        # For pull requests it's not necessary to checkout the code but for master it is
    Others
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 03:12:00 GMT 2024
    - 4.8K bytes
    - Viewed (0)
  7. fastapi/encoders.py

        >>> decimal_encoder(Decimal("1.0"))
        1.0
    
        >>> decimal_encoder(Decimal("1"))
        1
        """
        if dec_value.as_tuple().exponent >= 0:  # type: ignore[operator]
            return int(dec_value)
        else:
            return float(dec_value)
    
    
    ENCODERS_BY_TYPE: Dict[Type[Any], Callable[[Any], Any]] = {
        bytes: lambda o: o.decode(),
        Color: str,
        datetime.date: isoformat,
    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)
  8. docs/ko/docs/tutorial/response-model.md

    {
        "name": "Bar",
        "description": "The bartenders",
        "price": 62,
        "tax": 20.2
    }
    ```
    
    응답에 해당 값들이 포함됩니다.
    
    #### 기본값과 동일한 값을 갖는 데이터
    
    If the data has the same values as the default ones, like the item with ID `baz`:
    ID가 `baz`인 항목(items)처럼 기본값과 동일한 값을 갖는다면:
    
    ```Python hl_lines="3  5-6"
    {
        "name": "Baz",
        "description": None,
        "price": 50.2,
        "tax": 10.5,
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 8.2K bytes
    - Viewed (0)
  9. fastapi/_compat.py

        return _annotation_is_sequence(annotation) or _annotation_is_sequence(
            get_origin(annotation)
        )
    
    
    def value_is_sequence(value: Any) -> bool:
        return isinstance(value, sequence_types) and not isinstance(value, (str, bytes))  # type: ignore[arg-type]
    
    
    def _annotation_is_complex(annotation: Union[Type[Any], None]) -> bool:
        return (
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 22.6K bytes
    - Viewed (0)
Back to top