Home / File/ datastructures.py — fastapi Source File

datastructures.py — fastapi Source File

Architecture documentation for datastructures.py, a python file in the fastapi codebase. 6 imports, 6 dependents.

File python FastAPI Applications 6 imports 6 dependents 1 functions 2 classes

Entity Profile

Dependency Diagram

graph LR
  dc4a1804_f7b4_848b_3280_30523680d7b9["datastructures.py"]
  71f6cea2_cd61_98e3_7f82_73f865da6226["_compat.v2"]
  dc4a1804_f7b4_848b_3280_30523680d7b9 --> 71f6cea2_cd61_98e3_7f82_73f865da6226
  07d79a2e_d4e9_0bbb_be90_936274444c8c["collections.abc"]
  dc4a1804_f7b4_848b_3280_30523680d7b9 --> 07d79a2e_d4e9_0bbb_be90_936274444c8c
  0dda2280_3359_8460_301c_e98c77e78185["typing"]
  dc4a1804_f7b4_848b_3280_30523680d7b9 --> 0dda2280_3359_8460_301c_e98c77e78185
  5efacb44_5373_ceb9_9579_6e6603820488["annotated_doc"]
  dc4a1804_f7b4_848b_3280_30523680d7b9 --> 5efacb44_5373_ceb9_9579_6e6603820488
  6913fbd4_39df_d14b_44bb_522e99b65b90["pydantic"]
  dc4a1804_f7b4_848b_3280_30523680d7b9 --> 6913fbd4_39df_d14b_44bb_522e99b65b90
  92a32603_fcc6_3319_3df3_78c953234d9f["starlette.datastructures"]
  dc4a1804_f7b4_848b_3280_30523680d7b9 --> 92a32603_fcc6_3319_3df3_78c953234d9f
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  534f6e44_61b8_3c38_8b89_6934a6df9802 --> dc4a1804_f7b4_848b_3280_30523680d7b9
  6c1867f2_34c4_b2ed_5639_41766e6fd7ce["applications.py"]
  6c1867f2_34c4_b2ed_5639_41766e6fd7ce --> dc4a1804_f7b4_848b_3280_30523680d7b9
  0dcb823f_ea0d_bd04_752b_a3a3f875bba1["utils.py"]
  0dcb823f_ea0d_bd04_752b_a3a3f875bba1 --> dc4a1804_f7b4_848b_3280_30523680d7b9
  de395a51_26f8_3424_1af0_2f5bef39c893["routing.py"]
  de395a51_26f8_3424_1af0_2f5bef39c893 --> dc4a1804_f7b4_848b_3280_30523680d7b9
  1c2c0e68_6ed1_7632_8c35_00818f97b599["utils.py"]
  1c2c0e68_6ed1_7632_8c35_00818f97b599 --> dc4a1804_f7b4_848b_3280_30523680d7b9
  03dbbf97_8dc4_0b91_12c2_0804fcc355cf["test_datastructures.py"]
  03dbbf97_8dc4_0b91_12c2_0804fcc355cf --> dc4a1804_f7b4_848b_3280_30523680d7b9
  style dc4a1804_f7b4_848b_3280_30523680d7b9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from collections.abc import Mapping
from typing import (
    Annotated,
    Any,
    BinaryIO,
    Callable,
    Optional,
    TypeVar,
    cast,
)

from annotated_doc import Doc
from pydantic import GetJsonSchemaHandler
from starlette.datastructures import URL as URL  # noqa: F401
from starlette.datastructures import Address as Address  # noqa: F401
from starlette.datastructures import FormData as FormData  # noqa: F401
from starlette.datastructures import Headers as Headers  # noqa: F401
from starlette.datastructures import QueryParams as QueryParams  # noqa: F401
from starlette.datastructures import State as State  # noqa: F401
from starlette.datastructures import UploadFile as StarletteUploadFile


class UploadFile(StarletteUploadFile):
    """
    A file uploaded in a request.

    Define it as a *path operation function* (or dependency) parameter.

    If you are using a regular `def` function, you can use the `upload_file.file`
    attribute to access the raw standard Python file (blocking, not async), useful and
    needed for non-async code.

    Read more about it in the
    [FastAPI docs for Request Files](https://fastapi.tiangolo.com/tutorial/request-files/).

    ## Example

    ```python
    from typing import Annotated

    from fastapi import FastAPI, File, UploadFile

    app = FastAPI()


    @app.post("/files/")
    async def create_file(file: Annotated[bytes, File()]):
        return {"file_size": len(file)}


    @app.post("/uploadfile/")
    async def create_upload_file(file: UploadFile):
        return {"filename": file.filename}
    ```
    """

    file: Annotated[
        BinaryIO,
        Doc("The standard Python file object (non-async)."),
    ]
// ... (124 more lines)

Domain

Subdomains

Functions

Dependencies

  • _compat.v2
  • annotated_doc
  • collections.abc
  • pydantic
  • starlette.datastructures
  • typing

Frequently Asked Questions

What does datastructures.py do?
datastructures.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Applications subdomain.
What functions are defined in datastructures.py?
datastructures.py defines 1 function(s): Default.
What does datastructures.py depend on?
datastructures.py imports 6 module(s): _compat.v2, annotated_doc, collections.abc, pydantic, starlette.datastructures, typing.
What files import datastructures.py?
datastructures.py is imported by 6 file(s): __init__.py, applications.py, routing.py, test_datastructures.py, utils.py, utils.py.
Where is datastructures.py in the architecture?
datastructures.py is located at fastapi/datastructures.py (domain: FastAPI, subdomain: Applications, directory: fastapi).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free