Search Options

Results per page
Sort
Preferred Languages
Advance

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

  1. tests/test_read_with_orm_mode.py

            def full_name(self) -> str:
                return f"{self.name} {self.lastname}"
    
            model_config = ConfigDict(from_attributes=True)
    
        class PersonCreate(PersonBase):
            pass
    
        class PersonRead(PersonBase):
            full_name: str
    
            model_config = {"from_attributes": True}
    
        app = FastAPI()
    
        @app.post("/people/", response_model=PersonRead)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 2.4K bytes
    - Viewed (0)
  2. 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 Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  3. 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)
  4. 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)
  5. ci/official/wheel_test/test_import_api_packages.py

            return set(file.read().splitlines())
    
        super().setUp()
        self.api_packages_v2 = _get_api_packages_v2()
        # Some paths in the api_packages_path file cannot be directly imported.
        # These paths may point to attributes or sub-modules within a module's
        # namespace, but they don't correspond to an actual file
        # or directory on the filesystem.
        self.packages_for_skip = [
            "tensorflow.distribute.cluster_resolver",
    Python
    - Registered: Tue Apr 30 12:39:09 GMT 2024
    - Last Modified: Wed Sep 13 15:52:07 GMT 2023
    - 3.3K bytes
    - Viewed (0)
  6. fastapi/encoders.py

                Exclude from the output any fields that start with the name `_sa`.
    
                This is mainly a hack for compatibility with SQLAlchemy objects, they
                store internal SQLAlchemy-specific state in attributes named with `_sa`,
                and those objects can't (and shouldn't be) serialized to JSON.
                """
            ),
        ] = True,
    ) -> Any:
        """
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 10.8K bytes
    - Viewed (0)
  7. 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 Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 21.8K bytes
    - Viewed (0)
  8. fastapi/_compat.py

                loc: Tuple[Union[int, str], ...] = (),
            ) -> Tuple[Any, Union[List[Dict[str, Any]], None]]:
                try:
                    return (
                        self._type_adapter.validate_python(value, from_attributes=True),
                        None,
                    )
                except ValidationError as exc:
                    return None, _regenerate_error_with_loc(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 22.6K bytes
    - Viewed (0)
  9. 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 Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 172.2K bytes
    - Viewed (0)
  10. 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 Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 22:49:33 GMT 2024
    - 15K bytes
    - Viewed (1)
Back to top