Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 1,247 for prepends (0.11 sec)

  1. guava-tests/test/com/google/common/base/EnumsTest.java

      // Run Enums.getIfPresent on that other TestEnum and then return a WeakReference containing the
      // new ClassLoader. If Enums.getIfPresent does caching that prevents the shadow TestEnum
      // (and therefore its ClassLoader) from being unloaded, then this WeakReference will never be
      // cleared.
      @J2ktIncompatible
      @GwtIncompatible // weak references
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed May 29 16:29:37 UTC 2024
    - 8.7K bytes
    - Viewed (0)
  2. docs_src/security/tutorial002_an_py310.py

        )
    
    
    async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]):
        user = fake_decode_token(token)
        return user
    
    
    @app.get("/users/me")
    async def read_users_me(current_user: Annotated[User, Depends(get_current_user)]):
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 761 bytes
    - Viewed (0)
  3. docs_src/dependencies/tutorial012_an_py39.py

        return x_key
    
    
    app = FastAPI(dependencies=[Depends(verify_token), Depends(verify_key)])
    
    
    @app.get("/items/")
    async def read_items():
        return [{"item": "Portal Gun"}, {"item": "Plumbus"}]
    
    
    @app.get("/users/")
    async def read_users():
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 756 bytes
    - Viewed (0)
  4. docs_src/dependencies/tutorial001_an_py310.py

    from fastapi import Depends, FastAPI
    
    app = FastAPI()
    
    
    async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
        return {"q": q, "skip": skip, "limit": limit}
    
    
    @app.get("/items/")
    async def read_items(commons: Annotated[dict, Depends(common_parameters)]):
        return commons
    
    
    @app.get("/users/")
    async def read_users(commons: Annotated[dict, Depends(common_parameters)]):
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 454 bytes
    - Viewed (0)
  5. docs_src/security/tutorial002_an.py

        )
    
    
    async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]):
        user = fake_decode_token(token)
        return user
    
    
    @app.get("/users/me")
    async def read_users_me(current_user: Annotated[User, Depends(get_current_user)]):
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 815 bytes
    - Viewed (0)
  6. docs_src/security/tutorial007_an_py39.py

    import secrets
    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import HTTPBasic, HTTPBasicCredentials
    
    app = FastAPI()
    
    security = HTTPBasic()
    
    
    def get_current_username(
        credentials: Annotated[HTTPBasicCredentials, Depends(security)],
    ):
        current_username_bytes = credentials.username.encode("utf8")
        correct_username_bytes = b"stanleyjobson"
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  7. tests/test_dependency_cache.py

    
    @app.get("/sub-counter/")
    async def get_sub_counter(
        subcount: int = Depends(super_dep), count: int = Depends(dep_counter)
    ):
        return {"counter": count, "subcounter": subcount}
    
    
    @app.get("/sub-counter-no-cache/")
    async def get_sub_counter_no_cache(
        subcount: int = Depends(super_dep),
        count: int = Depends(dep_counter, use_cache=False),
    ):
        return {"counter": count, "subcounter": subcount}
    
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Aug 23 13:30:24 UTC 2022
    - 2.7K bytes
    - Viewed (0)
  8. docs_src/dependencies/tutorial001_an.py

    from typing import Union
    
    from fastapi import Depends, FastAPI
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    async def common_parameters(
        q: Union[str, None] = None, skip: int = 0, limit: int = 100
    ):
        return {"q": q, "skip": skip, "limit": limit}
    
    
    @app.get("/items/")
    async def read_items(commons: Annotated[dict, Depends(common_parameters)]):
        return commons
    
    
    @app.get("/users/")
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 502 bytes
    - Viewed (0)
  9. docs_src/dependencies/tutorial005_an.py

    from typing import Union
    
    from fastapi import Cookie, Depends, FastAPI
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    def query_extractor(q: Union[str, None] = None):
        return q
    
    
    def query_or_cookie_extractor(
        q: Annotated[str, Depends(query_extractor)],
        last_query: Annotated[Union[str, None], Cookie()] = None,
    ):
        if not q:
            return last_query
        return q
    
    
    @app.get("/items/")
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 558 bytes
    - Viewed (0)
  10. docs/zh/docs/tutorial/dependencies/classes-as-dependencies.md

        ```
    
    **FastAPI** 调用 `CommonQueryParams` 类。这将创建该类的一个 "实例",该实例将作为参数 `commons` 被传递给你的函数。
    
    ## 类型注解 vs `Depends`
    
    注意,我们在上面的代码中编写了两次`CommonQueryParams`:
    
    ```Python
    commons: CommonQueryParams = Depends(CommonQueryParams)
    ```
    
    最后的 `CommonQueryParams`:
    
    ```Python
    ... = Depends(CommonQueryParams)
    ```
    
    ...实际上是 **Fastapi** 用来知道依赖项是什么的。
    
    FastAPI 将从依赖项中提取声明的参数,这才是 FastAPI 实际调用的。
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Oct 17 05:59:11 UTC 2023
    - 6.5K bytes
    - Viewed (0)
Back to top