Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for ValueError (0.36 sec)

  1. docs/sts/client_grants/sts_element.py

    from xml.etree import cElementTree
    from xml.etree.cElementTree import ParseError
    
    if hasattr(cElementTree, 'ParseError'):
        _ETREE_EXCEPTIONS = (ParseError, AttributeError, ValueError, TypeError)
    else:
        _ETREE_EXCEPTIONS = (SyntaxError, AttributeError, ValueError, TypeError)
    
    _STS_NS = {'sts': 'https://sts.amazonaws.com/doc/2011-06-15/'}
    
    
    class STSElement(object):
        """STS aware XML parsing class. Wraps a root element name and
    Python
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Fri Apr 23 18:58:53 GMT 2021
    - 2.5K bytes
    - Viewed (0)
  2. tests/test_datastructures.py

    from fastapi.testclient import TestClient
    
    
    # TODO: remove when deprecating Pydantic v1
    def test_upload_file_invalid():
        with pytest.raises(ValueError):
            UploadFile.validate("not a Starlette UploadFile")
    
    
    def test_upload_file_invalid_pydantic_v2():
        with pytest.raises(ValueError):
            UploadFile._validate("not a Starlette UploadFile", {})
    
    
    def test_default_placeholder_equals():
        placeholder_1 = Default("a")
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 2K bytes
    - Viewed (0)
  3. tests/test_additional_responses_bad.py

                "get": {
                    "responses": {
                        # this is how one would imagine the openapi schema to be
                        # but since the key is not valid, openapi.utils.get_openapi will raise ValueError
                        "hello": {"description": "Not a valid additional response"},
                        "200": {
                            "description": "Successful Response",
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.1K bytes
    - Viewed (0)
  4. tests/test_filter_pydantic_sub_model_pv2.py

            foo: ModelB
    
            @field_validator("name")
            def lower_username(cls, name: str, info: ValidationInfo):
                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")
    
        @app.get("/model/{name}", response_model=ModelA)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 6.3K bytes
    - Viewed (0)
  5. fastapi/datastructures.py

            if not isinstance(v, StarletteUploadFile):
                raise ValueError(f"Expected UploadFile, received: {type(v)}")
            return v
    
        @classmethod
        def _validate(cls, __input_value: Any, _: Any) -> "UploadFile":
            if not isinstance(__input_value, StarletteUploadFile):
                raise ValueError(f"Expected UploadFile, received: {type(__input_value)}")
            return cast(UploadFile, __input_value)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 5.6K bytes
    - Viewed (0)
  6. tests/test_filter_pydantic_sub_model/app_pv1.py

        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")
    
    
    @app.get("/model/{name}", response_model=ModelA)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 784 bytes
    - Viewed (0)
  7. fastapi/security/http.py

                detail="Invalid authentication credentials",
                headers=unauthorized_headers,
            )
            try:
                data = b64decode(param).decode("ascii")
            except (ValueError, UnicodeDecodeError, binascii.Error):
                raise invalid_user_credentials_exc  # noqa: B904
            username, separator, password = data.partition(":")
            if not separator:
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Apr 19 15:29:38 GMT 2024
    - 13.2K bytes
    - Viewed (0)
  8. tests/test_jsonable_encoder.py

        assert jsonable_encoder(item, exclude={}) == {"name": "foo", "count": 100}
    
    
    def test_encode_unsupported():
        unserializable = Unserializable()
        with pytest.raises(ValueError):
            jsonable_encoder(unserializable)
    
    
    @needs_pydanticv2
    def test_encode_custom_json_encoders_model_pydanticv2():
        from pydantic import field_serializer
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 9K bytes
    - Viewed (0)
  9. scripts/mkdocs_hooks.py

                elif isinstance(values[0], list):
                    resolve_files(items=values[0], files=files, config=config)
                else:
                    raise ValueError(f"Unexpected value: {values}")
    
    
    def on_files(files: Files, *, config: MkDocsConfig) -> Files:
        resolve_files(items=config.nav or [], files=files, config=config)
        if "logo" in config.theme:
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 5.1K bytes
    - Viewed (0)
  10. fastapi/encoders.py

        except Exception as e:
            errors: List[Exception] = []
            errors.append(e)
            try:
                data = vars(obj)
            except Exception as e:
                errors.append(e)
                raise ValueError(errors) from e
        return jsonable_encoder(
            data,
            include=include,
            exclude=exclude,
            by_alias=by_alias,
            exclude_unset=exclude_unset,
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 10.8K bytes
    - Viewed (0)
Back to top