Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for property (0.4 sec)

  1. tests/test_computed_fields.py

    def get_client():
        app = FastAPI()
    
        from pydantic import BaseModel, computed_field
    
        class Rectangle(BaseModel):
            width: int
            length: int
    
            @computed_field
            @property
            def area(self) -> int:
                return self.width * self.length
    
        @app.get("/")
        def read_root() -> Rectangle:
            return Rectangle(width=3, length=4)
    
        client = TestClient(app)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Aug 04 20:47:07 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_body/test_tutorial001_py310.py

                            "error": "Expecting property name enclosed in double quotes"
                        },
                    }
                ]
            }
        ) | IsDict(
            # TODO: remove when deprecating Pydantic v1
            {
                "detail": [
                    {
                        "loc": ["body", 1],
                        "msg": "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)",
    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

                            "error": "Expecting property name enclosed in double quotes"
                        },
                    }
                ]
            }
        ) | IsDict(
            # TODO: remove when deprecating Pydantic v1
            {
                "detail": [
                    {
                        "loc": ["body", 1],
                        "msg": "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)",
    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. ci/official/utilities/extract_resultstore_links.py

          success_msg = 'Build completed successfully.\n' f'See {url} for details.'
          ElemTree.SubElement(properties, 'property',
                              name='description',
                              value=success_msg)
          if command:
            ElemTree.SubElement(properties, 'property',
                                name='bazel_command',
                                value=command)
    
    Python
    - Registered: Tue Apr 30 12:39:09 GMT 2024
    - Last Modified: Wed Nov 08 17:50:27 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  5. tests/test_read_with_orm_mode.py

    
    @needs_pydanticv2
    def test_read_with_orm_mode() -> None:
        class PersonBase(BaseModel):
            name: str
            lastname: str
    
        class Person(PersonBase):
            @property
            def full_name(self) -> str:
                return f"{self.name} {self.lastname}"
    
            model_config = ConfigDict(from_attributes=True)
    
        class PersonCreate(PersonBase):
            pass
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 2.4K bytes
    - Viewed (0)
  6. tests/test_inherited_custom_class.py

    
    class MyUuid:
        def __init__(self, uuid_string: str):
            self.uuid = uuid_string
    
        def __str__(self):
            return self.uuid
    
        @property  # type: ignore
        def __class__(self):
            return uuid.UUID
    
        @property
        def __dict__(self):
            """Spoof a missing __dict__ by raising TypeError, this is how
            asyncpg.pgroto.pgproto.UUID behaves"""
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 3K bytes
    - Viewed (0)
  7. tests/test_response_by_alias.py

                        "proper OpenAPI use another model with the correct field names"
                    )
                }
            )
        else:
    
            class Config:
                schema_extra = {
                    "description": (
                        "response_model_by_alias=False is basically a quick hack, to support "
                        "proper OpenAPI use another model with the correct field names"
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 11.1K bytes
    - Viewed (0)
  8. fastapi/_compat.py

            mode: Literal["validation", "serialization"] = "validation"
    
            @property
            def alias(self) -> str:
                a = self.field_info.alias
                return a if a is not None else self.name
    
            @property
            def required(self) -> bool:
                return self.field_info.is_required()
    
            @property
            def default(self) -> Any:
                return self.get_default()
    
    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)
  9. tests/test_jsonable_encoder.py

    
    class DictablePet(Pet):
        def __iter__(self):
            return ((k, v) for k, v in self.__dict__.items())
    
    
    class Unserializable:
        def __iter__(self):
            raise NotImplementedError()
    
        @property
        def __dict__(self):
            raise NotImplementedError()
    
    
    class RoleEnum(Enum):
        admin = "admin"
        normal = "normal"
    
    
    class ModelWithConfig(BaseModel):
        role: Optional[RoleEnum] = None
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 9K bytes
    - Viewed (0)
  10. configure.py

      if curr_version.startswith('bazel '):
        curr_version = curr_version.split('bazel ')[1]
    
      curr_version_int = convert_version_to_int(curr_version)
    
      # Check if current bazel version can be detected properly.
      if not curr_version_int:
        print('WARNING: current bazel installation is not a release version.')
        return curr_version
    
      print('You have bazel %s installed.' % curr_version)
      return curr_version
    
    Python
    - Registered: Tue Apr 30 12:39:09 GMT 2024
    - Last Modified: Mon Apr 15 18:25:36 GMT 2024
    - 53.8K bytes
    - Viewed (0)
Back to top