Server Test Python

Server Test Python

rev. 399187927edd9a1e762efeae060e3a56d671920a

Files changed:

tmp-codegen-diff/codegen-server-test-python/constraints_without_public_constrained_types/rust-server-codegen-python/python/constraints_without_public_constrained_types/logging/__init__.pyi

@@ -1,0 +26,0 @@
    1         -
import pathlib
    2         -
import typing
    3         -
    4         -
class TracingHandler:
    5         -
    """
    6         -
    Modifies the Python `logging` module to deliver its log messages using [tracing::Subscriber] events.
    7         -
    8         -
    To achieve this goal, the following changes are made to the module:
    9         -
    - A new builtin function `logging.py_tracing_event` transcodes `logging.LogRecord`s to `tracing::Event`s. This function
   10         -
      is not exported in `logging.__all__`, as it is not intended to be called directly.
   11         -
    - A new class `logging.TracingHandler` provides a `logging.Handler` that delivers all records to `python_tracing`.
   12         -
    """
   13         -
   14         -
    def handler(self) -> typing.Any:
   15         -
        ...
   16         -
   17         -
   18         -
    def __init__(self, level: typing.Optional[int] = ..., logfile: typing.Optional[pathlib.Path] = ..., format: typing.Optional[typing.Literal['compact', 'pretty', 'json']] = ...) -> None:
   19         -
        ...
   20         -
   21         -
   22         -
def py_tracing_event() -> None:
   23         -
    """
   24         -
    Consumes a Python `logging.LogRecord` and emits a Rust [tracing::Event] instead.
   25         -
    """
   26         -
    ...

tmp-codegen-diff/codegen-server-test-python/constraints_without_public_constrained_types/rust-server-codegen-python/python/constraints_without_public_constrained_types/middleware/__init__.pyi

@@ -1,0 +78,0 @@
    1         -
import typing
    2         -
    3         -
class MiddlewareException(Exception):
    4         -
    """
    5         -
    Exception that can be thrown from a Python middleware.
    6         -
    7         -
    It allows to specify a message and HTTP status code and implementing protocol specific capabilities
    8         -
    to build a [aws_smithy_http_server::response::Response] from it.
    9         -
    """
   10         -
   11         -
    message: str
   12         -
   13         -
    status_code: int
   14         -
   15         -
    def __init__(self, message: str, status_code: typing.Optional[int] = ...) -> None:
   16         -
        ...
   17         -
   18         -
   19         -
class Request:
   20         -
    """
   21         -
    Python-compatible [Request] object.
   22         -
    """
   23         -
   24         -
    body: typing.Awaitable[bytes]
   25         -
    """
   26         -
    Return the HTTP body of this request.
   27         -
    Note that this is a costly operation because the whole request body is cloned.
   28         -
    """
   29         -
   30         -
    headers: typing.MutableMapping[str, str]
   31         -
    """
   32         -
    Return the HTTP headers of this request.
   33         -
    """
   34         -
   35         -
    method: str
   36         -
    """
   37         -
    Return the HTTP method of this request.
   38         -
    """
   39         -
   40         -
    uri: str
   41         -
    """
   42         -
    Return the URI of this request.
   43         -
    """
   44         -
   45         -
    version: str
   46         -
    """
   47         -
    Return the HTTP version of this request.
   48         -
    """
   49         -
   50         -
class Response:
   51         -
    """
   52         -
    Python-compatible [Response] object.
   53         -
    """
   54         -
   55         -
    body: typing.Awaitable[bytes]
   56         -
    """
   57         -
    Return the HTTP body of this response.
   58         -
    Note that this is a costly operation because the whole response body is cloned.
   59         -
    """
   60         -
   61         -
    headers: typing.MutableMapping[str, str]
   62         -
    """
   63         -
    Return the HTTP headers of this response.
   64         -
    """
   65         -
   66         -
    status: int
   67         -
    """
   68         -
    Return the HTTP status of this response.
   69         -
    """
   70         -
   71         -
    version: str
   72         -
    """
   73         -
    Return the HTTP version of this response.
   74         -
    """
   75         -
   76         -
    def __init__(self, status: int, headers: typing.Optional[typing.Dict[str, str]] = ..., body: typing.Optional[bytes] = ...) -> None:
   77         -
        ...
   78         -

tmp-codegen-diff/codegen-server-test-python/constraints_without_public_constrained_types/rust-server-codegen-python/python/constraints_without_public_constrained_types/model/__init__.pyi

@@ -1,0 +400,0 @@
    1         -
import constraints_without_public_constrained_types.model
    2         -
import constraints_without_public_constrained_types.types
    3         -
import typing
    4         -
    5         -
class ConA:
    6         -
    con_b: constraints_without_public_constrained_types.model.ConB
    7         -
    8         -
    con_b_list: typing.Optional[typing.List[typing.List[constraints_without_public_constrained_types.model.ConB]]]
    9         -
   10         -
    con_b_map: typing.Optional[typing.Dict[str, str]]
   11         -
   12         -
    con_b_set: typing.Optional[typing.List[typing.Set[str]]]
   13         -
   14         -
    constrained_union: typing.Optional[constraints_without_public_constrained_types.model.ConstrainedUnion]
   15         -
    """
   16         -
    A union with constrained members.
   17         -
    """
   18         -
   19         -
    enum_string: typing.Optional[constraints_without_public_constrained_types.model.EnumString]
   20         -
   21         -
    fixed_length_blob: typing.Optional[constraints_without_public_constrained_types.types.Blob]
   22         -
   23         -
    fixed_length_string: typing.Optional[str]
   24         -
   25         -
    fixed_value_byte: int
   26         -
   27         -
    fixed_value_integer: int
   28         -
   29         -
    fixed_value_long: int
   30         -
   31         -
    fixed_value_short: int
   32         -
   33         -
    length_blob: typing.Optional[constraints_without_public_constrained_types.types.Blob]
   34         -
   35         -
    length_length_pattern_string: typing.Optional[str]
   36         -
   37         -
    length_list: typing.Optional[typing.List[str]]
   38         -
   39         -
    length_list_of_pattern_string: typing.Optional[typing.List[str]]
   40         -
   41         -
    length_map: typing.Optional[typing.Dict[str, str]]
   42         -
   43         -
    length_set_of_pattern_string: typing.Optional[typing.Set[str]]
   44         -
   45         -
    length_string: typing.Optional[str]
   46         -
   47         -
    list_of_length_blob: typing.Optional[typing.List[constraints_without_public_constrained_types.types.Blob]]
   48         -
   49         -
    list_of_length_pattern_string: typing.Optional[typing.List[str]]
   50         -
   51         -
    list_of_length_string: typing.Optional[typing.List[str]]
   52         -
   53         -
    list_of_pattern_string: typing.Optional[typing.List[str]]
   54         -
   55         -
    list_of_range_byte: typing.Optional[typing.List[int]]
   56         -
   57         -
    list_of_range_integer: typing.Optional[typing.List[int]]
   58         -
   59         -
    list_of_range_long: typing.Optional[typing.List[int]]
   60         -
   61         -
    list_of_range_short: typing.Optional[typing.List[int]]
   62         -
   63         -
    map_of_length_blob: typing.Optional[typing.Dict[str, constraints_without_public_constrained_types.types.Blob]]
   64         -
   65         -
    map_of_length_pattern_string: typing.Optional[typing.Dict[str, str]]
   66         -
   67         -
    map_of_length_string: typing.Optional[typing.Dict[str, str]]
   68         -
   69         -
    map_of_map_of_list_of_list_of_con_b: typing.Optional[typing.Dict[str, typing.Dict[str, typing.List[typing.List[constraints_without_public_constrained_types.model.ConB]]]]]
   70         -
   71         -
    map_of_pattern_string: typing.Optional[typing.Dict[str, str]]
   72         -
   73         -
    map_of_range_byte: typing.Optional[typing.Dict[str, int]]
   74         -
   75         -
    map_of_range_integer: typing.Optional[typing.Dict[str, int]]
   76         -
   77         -
    map_of_range_long: typing.Optional[typing.Dict[str, int]]
   78         -
   79         -
    map_of_range_short: typing.Optional[typing.Dict[str, int]]
   80         -
   81         -
    max_length_blob: typing.Optional[constraints_without_public_constrained_types.types.Blob]
   82         -
   83         -
    max_length_string: typing.Optional[str]
   84         -
   85         -
    max_range_byte: int
   86         -
   87         -
    max_range_integer: int
   88         -
   89         -
    max_range_long: int
   90         -
   91         -
    max_range_short: int
   92         -
   93         -
    min_length_blob: typing.Optional[constraints_without_public_constrained_types.types.Blob]
   94         -
   95         -
    min_length_string: typing.Optional[str]
   96         -
   97         -
    min_range_byte: int
   98         -
   99         -
    min_range_integer: int
  100         -
  101         -
    min_range_long: int
  102         -
  103         -
    min_range_short: int
  104         -
  105         -
    non_streaming_blob: typing.Optional[constraints_without_public_constrained_types.types.Blob]
  106         -
  107         -
    opt_con_b: typing.Optional[constraints_without_public_constrained_types.model.ConB]
  108         -
  109         -
    pattern_string: typing.Optional[str]
  110         -
  111         -
    range_byte: int
  112         -
  113         -
    range_integer: int
  114         -
  115         -
    range_long: int
  116         -
  117         -
    range_short: int
  118         -
  119         -
    sensitive_length_list: typing.Optional[typing.List[constraints_without_public_constrained_types.model.SensitiveStructure]]
  120         -
  121         -
    set_of_length_pattern_string: typing.Optional[typing.Set[str]]
  122         -
  123         -
    set_of_length_string: typing.Optional[typing.Set[str]]
  124         -
  125         -
    set_of_pattern_string: typing.Optional[typing.Set[str]]
  126         -
  127         -
    set_of_range_byte: typing.Optional[typing.List[int]]
  128         -
  129         -
    set_of_range_integer: typing.Optional[typing.List[int]]
  130         -
  131         -
    set_of_range_long: typing.Optional[typing.List[int]]
  132         -
  133         -
    set_of_range_short: typing.Optional[typing.List[int]]
  134         -
  135         -
    sparse_length_list: typing.Optional[typing.List[typing.Optional[str]]]
  136         -
  137         -
    sparse_length_map: typing.Optional[typing.Dict[str, typing.Optional[str]]]
  138         -
  139         -
    sparse_list: typing.Optional[typing.List[typing.Optional[str]]]
  140         -
  141         -
    sparse_map: typing.Optional[typing.Dict[str, typing.Optional[typing.List[str]]]]
  142         -
  143         -
    def __init__(self, con_b: constraints_without_public_constrained_types.model.ConB, opt_con_b: typing.Optional[constraints_without_public_constrained_types.model.ConB] = ..., length_string: typing.Optional[str] = ..., min_length_string: typing.Optional[str] = ..., max_length_string: typing.Optional[str] = ..., fixed_length_string: typing.Optional[str] = ..., length_blob: typing.Optional[constraints_without_public_constrained_types.types.Blob] = ..., min_length_blob: typing.Optional[constraints_without_public_constrained_types.types.Blob] = ..., max_length_blob: typing.Optional[constraints_without_public_constrained_types.types.Blob] = ..., fixed_length_blob: typing.Optional[constraints_without_public_constrained_types.types.Blob] = ..., range_integer: int, min_range_integer: int, max_range_integer: int, fixed_value_integer: int, range_short: int, min_range_short: int, max_range_short: int, fixed_value_short: int, range_long: int, min_range_long: int, max_range_long: int, fixed_value_long: int, range_byte: int, min_range_byte: int, max_range_byte: int, fixed_value_byte: int, con_b_list: typing.Optional[typing.List[typing.List[constraints_without_public_constrained_types.model.ConB]]] = ..., length_list: typing.Optional[typing.List[str]] = ..., sensitive_length_list: typing.Optional[typing.List[constraints_without_public_constrained_types.model.SensitiveStructure]] = ..., con_b_set: typing.Optional[typing.List[typing.Set[str]]] = ..., con_b_map: typing.Optional[typing.Dict[str, str]] = ..., length_map: typing.Optional[typing.Dict[str, str]] = ..., map_of_map_of_list_of_list_of_con_b: typing.Optional[typing.Dict[str, typing.Dict[str, typing.List[typing.List[constraints_without_public_constrained_types.model.ConB]]]]] = ..., sparse_map: typing.Optional[typing.Dict[str, typing.Optional[typing.List[str]]]] = ..., sparse_list: typing.Optional[typing.List[typing.Optional[str]]] = ..., sparse_length_map: typing.Optional[typing.Dict[str, typing.Optional[str]]] = ..., sparse_length_list: typing.Optional[typing.List[typing.Optional[str]]] = ..., constrained_union: typing.Optional[constraints_without_public_constrained_types.model.ConstrainedUnion] = ..., enum_string: typing.Optional[constraints_without_public_constrained_types.model.EnumString] = ..., list_of_length_string: typing.Optional[typing.List[str]] = ..., set_of_length_string: typing.Optional[typing.Set[str]] = ..., map_of_length_string: typing.Optional[typing.Dict[str, str]] = ..., list_of_length_blob: typing.Optional[typing.List[constraints_without_public_constrained_types.types.Blob]] = ..., map_of_length_blob: typing.Optional[typing.Dict[str, constraints_without_public_constrained_types.types.Blob]] = ..., list_of_range_integer: typing.Optional[typing.List[int]] = ..., set_of_range_integer: typing.Optional[typing.List[int]] = ..., map_of_range_integer: typing.Optional[typing.Dict[str, int]] = ..., list_of_range_short: typing.Optional[typing.List[int]] = ..., set_of_range_short: typing.Optional[typing.List[int]] = ..., map_of_range_short: typing.Optional[typing.Dict[str, int]] = ..., list_of_range_long: typing.Optional[typing.List[int]] = ..., set_of_range_long: typing.Optional[typing.List[int]] = ..., map_of_range_long: typing.Optional[typing.Dict[str, int]] = ..., list_of_range_byte: typing.Optional[typing.List[int]] = ..., set_of_range_byte: typing.Optional[typing.List[int]] = ..., map_of_range_byte: typing.Optional[typing.Dict[str, int]] = ..., non_streaming_blob: typing.Optional[constraints_without_public_constrained_types.types.Blob] = ..., pattern_string: typing.Optional[str] = ..., map_of_pattern_string: typing.Optional[typing.Dict[str, str]] = ..., list_of_pattern_string: typing.Optional[typing.List[str]] = ..., set_of_pattern_string: typing.Optional[typing.Set[str]] = ..., length_length_pattern_string: typing.Optional[str] = ..., map_of_length_pattern_string: typing.Optional[typing.Dict[str, str]] = ..., list_of_length_pattern_string: typing.Optional[typing.List[str]] = ..., set_of_length_pattern_string: typing.Optional[typing.Set[str]] = ..., length_list_of_pattern_string: typing.Optional[typing.List[str]] = ..., length_set_of_pattern_string: typing.Optional[typing.Set[str]] = ...) -> None:
  144         -
        ...
  145         -
  146         -
  147         -
class ConB:
  148         -
    int: int
  149         -
  150         -
    nice: str
  151         -
  152         -
    opt_int: typing.Optional[int]
  153         -
  154         -
    opt_nice: typing.Optional[str]
  155         -
  156         -
    def __init__(self, nice: str, int: int, opt_nice: typing.Optional[str] = ..., opt_int: typing.Optional[int] = ...) -> None:
  157         -
        ...
  158         -
  159         -
  160         -
class ConstrainedUnion:
  161         -
    def as_con_b_list(self) -> typing.List[typing.List[constraints_without_public_constrained_types.model.ConB]]:
  162         -
        """
  163         -
        Tries to convert the enum instance into [`ConBList`](crate::model::ConstrainedUnion::ConBList), extracting the inner [`Vec`](::std::vec::Vec).
  164         -
        """
  165         -
        ...
  166         -
  167         -
  168         -
    def as_con_b_map(self) -> typing.Dict[str, str]:
  169         -
        """
  170         -
        Tries to convert the enum instance into [`ConBMap`](crate::model::ConstrainedUnion::ConBMap), extracting the inner [`HashMap`](::std::collections::HashMap).
  171         -
        """
  172         -
        ...
  173         -
  174         -
  175         -
    def as_con_b_set(self) -> typing.List[typing.Set[str]]:
  176         -
        """
  177         -
        Tries to convert the enum instance into [`ConBSet`](crate::model::ConstrainedUnion::ConBSet), extracting the inner [`Vec`](::std::vec::Vec).
  178         -
        """
  179         -
        ...
  180         -
  181         -
  182         -
    def as_constrained_structure(self) -> constraints_without_public_constrained_types.model.ConB:
  183         -
        """
  184         -
        Tries to convert the enum instance into [`ConstrainedStructure`](crate::model::ConstrainedUnion::ConstrainedStructure), extracting the inner [`ConB`](crate::model::ConB).
  185         -
        """
  186         -
        ...
  187         -
  188         -
  189         -
    def as_enum_string(self) -> constraints_without_public_constrained_types.model.EnumString:
  190         -
        """
  191         -
        Tries to convert the enum instance into [`EnumString`](crate::model::ConstrainedUnion::EnumString), extracting the inner [`EnumString`](crate::model::EnumString).
  192         -
        """
  193         -
        ...
  194         -
  195         -
  196         -
    def as_length_string(self) -> str:
  197         -
        """
  198         -
        Tries to convert the enum instance into [`LengthString`](crate::model::ConstrainedUnion::LengthString), extracting the inner [`String`](::std::string::String).
  199         -
        """
  200         -
        ...
  201         -
  202         -
  203         -
    @staticmethod
  204         -
    def con_b_list(data: typing.List[typing.List[constraints_without_public_constrained_types.model.ConB]]) -> ConstrainedUnion:
  205         -
        """
  206         -
        Creates a new union instance of [`ConBList`](crate::model::ConstrainedUnion::ConBList)
  207         -
        """
  208         -
        ...
  209         -
  210         -
  211         -
    @staticmethod
  212         -
    def con_b_map(data: typing.Dict[str, str]) -> ConstrainedUnion:
  213         -
        """
  214         -
        Creates a new union instance of [`ConBMap`](crate::model::ConstrainedUnion::ConBMap)
  215         -
        """
  216         -
        ...
  217         -
  218         -
  219         -
    @staticmethod
  220         -
    def con_b_set(data: typing.List[typing.Set[str]]) -> ConstrainedUnion:
  221         -
        """
  222         -
        Creates a new union instance of [`ConBSet`](crate::model::ConstrainedUnion::ConBSet)
  223         -
        """
  224         -
        ...
  225         -
  226         -
  227         -
    @staticmethod
  228         -
    def constrained_structure(data: constraints_without_public_constrained_types.model.ConB) -> ConstrainedUnion:
  229         -
        """
  230         -
        Creates a new union instance of [`ConstrainedStructure`](crate::model::ConstrainedUnion::ConstrainedStructure)
  231         -
        """
  232         -
        ...
  233         -
  234         -
  235         -
    @staticmethod
  236         -
    def enum_string(data: constraints_without_public_constrained_types.model.EnumString) -> ConstrainedUnion:
  237         -
        """
  238         -
        Creates a new union instance of [`EnumString`](crate::model::ConstrainedUnion::EnumString)
  239         -
        """
  240         -
        ...
  241         -
  242         -
  243         -
    def is_con_b_list(self) -> bool:
  244         -
        """
  245         -
        Returns true if this is a [`ConBList`](crate::model::ConstrainedUnion::ConBList).
  246         -
        """
  247         -
        ...
  248         -
  249         -
  250         -
    def is_con_b_map(self) -> bool:
  251         -
        """
  252         -
        Returns true if this is a [`ConBMap`](crate::model::ConstrainedUnion::ConBMap).
  253         -
        """
  254         -
        ...
  255         -
  256         -
  257         -
    def is_con_b_set(self) -> bool:
  258         -
        """
  259         -
        Returns true if this is a [`ConBSet`](crate::model::ConstrainedUnion::ConBSet).
  260         -
        """
  261         -
        ...
  262         -
  263         -
  264         -
    def is_constrained_structure(self) -> bool:
  265         -
        """
  266         -
        Returns true if this is a [`ConstrainedStructure`](crate::model::ConstrainedUnion::ConstrainedStructure).
  267         -
        """
  268         -
        ...
  269         -
  270         -
  271         -
    def is_enum_string(self) -> bool:
  272         -
        """
  273         -
        Returns true if this is a [`EnumString`](crate::model::ConstrainedUnion::EnumString).
  274         -
        """
  275         -
        ...
  276         -
  277         -
  278         -
    def is_length_string(self) -> bool:
  279         -
        """
  280         -
        Returns true if this is a [`LengthString`](crate::model::ConstrainedUnion::LengthString).
  281         -
        """
  282         -
        ...
  283         -
  284         -
  285         -
    @staticmethod
  286         -
    def length_string(data: str) -> ConstrainedUnion:
  287         -
        """
  288         -
        Creates a new union instance of [`LengthString`](crate::model::ConstrainedUnion::LengthString)
  289         -
        """
  290         -
        ...
  291         -
  292         -
  293         -
class ConstrainedUnionInOutput:
  294         -
    def as_structure(self) -> constraints_without_public_constrained_types.model.TransitivelyConstrainedStructureInOutput:
  295         -
        """
  296         -
        Tries to convert the enum instance into [`Structure`](crate::model::ConstrainedUnionInOutput::Structure), extracting the inner [`TransitivelyConstrainedStructureInOutput`](crate::model::TransitivelyConstrainedStructureInOutput).
  297         -
        """
  298         -
        ...
  299         -
  300         -
  301         -
    def is_structure(self) -> bool:
  302         -
        """
  303         -
        Returns true if this is a [`Structure`](crate::model::ConstrainedUnionInOutput::Structure).
  304         -
        """
  305         -
        ...
  306         -
  307         -
  308         -
    @staticmethod
  309         -
    def structure(data: constraints_without_public_constrained_types.model.TransitivelyConstrainedStructureInOutput) -> ConstrainedUnionInOutput:
  310         -
        """
  311         -
        Creates a new union instance of [`Structure`](crate::model::ConstrainedUnionInOutput::Structure)
  312         -
        """
  313         -
        ...
  314         -
  315         -
  316         -
class EnumString:
  317         -
    M256Mega: EnumString
  318         -
  319         -
    T2Micro: EnumString
  320         -
  321         -
    T2Nano: EnumString
  322         -
  323         -
    name: typing.Any
  324         -
  325         -
    value: typing.Any
  326         -
  327         -
class Event:
  328         -
    def as_regular_message(self) -> constraints_without_public_constrained_types.model.EventStreamRegularMessage:
  329         -
        """
  330         -
        Tries to convert the enum instance into [`RegularMessage`](crate::model::Event::RegularMessage), extracting the inner [`EventStreamRegularMessage`](crate::model::EventStreamRegularMessage).
  331         -
        """
  332         -
        ...
  333         -
  334         -
  335         -
    def is_regular_message(self) -> bool:
  336         -
        """
  337         -
        Returns true if this is a [`RegularMessage`](crate::model::Event::RegularMessage).
  338         -
        """
  339         -
        ...
  340         -
  341         -
  342         -
    @staticmethod
  343         -
    def regular_message(data: constraints_without_public_constrained_types.model.EventStreamRegularMessage) -> Event:
  344         -
        """
  345         -
        Creates a new union instance of [`RegularMessage`](crate::model::Event::RegularMessage)
  346         -
        """
  347         -
        ...
  348         -
  349         -
  350         -
class EventStreamRegularMessage:
  351         -
    message_content: typing.Optional[str]
  352         -
  353         -
    def __init__(self, message_content: typing.Optional[str] = ...) -> None:
  354         -
        ...
  355         -
  356         -
  357         -
class RecursiveShapesInputOutputNested1:
  358         -
    recursive_member: constraints_without_public_constrained_types.model.RecursiveShapesInputOutputNested2
  359         -
  360         -
    def __init__(self, recursive_member: constraints_without_public_constrained_types.model.RecursiveShapesInputOutputNested2) -> None:
  361         -
        ...
  362         -
  363         -
  364         -
class RecursiveShapesInputOutputNested2:
  365         -
    recursive_member: typing.Optional[constraints_without_public_constrained_types.model.RecursiveShapesInputOutputNested1]
  366         -
  367         -
    def __init__(self, recursive_member: typing.Optional[constraints_without_public_constrained_types.model.RecursiveShapesInputOutputNested1] = ...) -> None:
  368         -
        ...
  369         -
  370         -
  371         -
class SensitiveStructure:
  372         -
    def __init__(self) -> None:
  373         -
        ...
  374         -
  375         -
  376         -
class TransitivelyConstrainedStructureInOutput:
  377         -
    length_string: typing.Optional[str]
  378         -
  379         -
    def __init__(self, length_string: typing.Optional[str] = ...) -> None:
  380         -
        ...
  381         -
  382         -
  383         -
class ValidationExceptionField:
  384         -
    """
  385         -
    Describes one specific validation failure for an input member.
  386         -
    """
  387         -
  388         -
    message: str
  389         -
    """
  390         -
    A detailed description of the validation failure.
  391         -
    """
  392         -
  393         -
    path: str
  394         -
    """
  395         -
    A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
  396         -
    """
  397         -
  398         -
    def __init__(self, path: str, message: str) -> None:
  399         -
        ...
  400         -

tmp-codegen-diff/codegen-server-test-python/constraints_without_public_constrained_types/rust-server-codegen-python/python/constraints_without_public_constrained_types/output/__init__.pyi

@@ -1,0 +231,0 @@
    1         -
import constraints_without_public_constrained_types.model
    2         -
import constraints_without_public_constrained_types.types
    3         -
import typing
    4         -
    5         -
class ConstrainedHttpBoundShapesOperationOutput:
    6         -
    enum_string_label: constraints_without_public_constrained_types.model.EnumString
    7         -
    8         -
    enum_string_list_query: typing.Optional[typing.List[constraints_without_public_constrained_types.model.EnumString]]
    9         -
   10         -
    enum_string_query: typing.Optional[constraints_without_public_constrained_types.model.EnumString]
   11         -
   12         -
    length_list_pattern_string_header: typing.Optional[typing.List[str]]
   13         -
   14         -
    length_list_pattern_string_query: typing.Optional[typing.List[str]]
   15         -
   16         -
    length_set_pattern_string_header: typing.Optional[typing.Set[str]]
   17         -
   18         -
    length_string_header: typing.Optional[str]
   19         -
   20         -
    length_string_header_map: typing.Dict[str, str]
   21         -
   22         -
    length_string_label: str
   23         -
   24         -
    length_string_list_query: typing.Optional[typing.List[str]]
   25         -
   26         -
    length_string_query: typing.Optional[str]
   27         -
   28         -
    length_string_set_header: typing.Optional[typing.Set[str]]
   29         -
   30         -
    length_string_set_query: typing.Optional[typing.Set[str]]
   31         -
   32         -
    list_length_string_header: typing.Optional[typing.List[str]]
   33         -
   34         -
    range_byte_header: int
   35         -
   36         -
    range_byte_label: int
   37         -
   38         -
    range_byte_list_header: typing.Optional[typing.List[int]]
   39         -
   40         -
    range_byte_list_query: typing.Optional[typing.List[int]]
   41         -
   42         -
    range_byte_query: int
   43         -
   44         -
    range_byte_set_header: typing.Optional[typing.List[int]]
   45         -
   46         -
    range_byte_set_query: typing.Optional[typing.List[int]]
   47         -
   48         -
    range_integer_header: int
   49         -
   50         -
    range_integer_label: int
   51         -
   52         -
    range_integer_list_header: typing.Optional[typing.List[int]]
   53         -
   54         -
    range_integer_list_query: typing.Optional[typing.List[int]]
   55         -
   56         -
    range_integer_query: int
   57         -
   58         -
    range_integer_set_header: typing.Optional[typing.List[int]]
   59         -
   60         -
    range_integer_set_query: typing.Optional[typing.List[int]]
   61         -
   62         -
    range_long_header: int
   63         -
   64         -
    range_long_label: int
   65         -
   66         -
    range_long_list_header: typing.Optional[typing.List[int]]
   67         -
   68         -
    range_long_list_query: typing.Optional[typing.List[int]]
   69         -
   70         -
    range_long_query: int
   71         -
   72         -
    range_long_set_header: typing.Optional[typing.List[int]]
   73         -
   74         -
    range_long_set_query: typing.Optional[typing.List[int]]
   75         -
   76         -
    range_short_header: int
   77         -
   78         -
    range_short_label: int
   79         -
   80         -
    range_short_list_header: typing.Optional[typing.List[int]]
   81         -
   82         -
    range_short_list_query: typing.Optional[typing.List[int]]
   83         -
   84         -
    range_short_query: int
   85         -
   86         -
    range_short_set_header: typing.Optional[typing.List[int]]
   87         -
   88         -
    range_short_set_query: typing.Optional[typing.List[int]]
   89         -
   90         -
    def __init__(self, length_string_label: str, range_integer_label: int, range_short_label: int, range_long_label: int, range_byte_label: int, enum_string_label: constraints_without_public_constrained_types.model.EnumString, length_string_header_map: typing.Dict[str, str], length_string_header: typing.Optional[str] = ..., range_integer_header: int, range_short_header: int, range_long_header: int, range_byte_header: int, length_string_set_header: typing.Optional[typing.Set[str]] = ..., list_length_string_header: typing.Optional[typing.List[str]] = ..., length_list_pattern_string_header: typing.Optional[typing.List[str]] = ..., length_set_pattern_string_header: typing.Optional[typing.Set[str]] = ..., range_byte_set_header: typing.Optional[typing.List[int]] = ..., range_short_set_header: typing.Optional[typing.List[int]] = ..., range_integer_set_header: typing.Optional[typing.List[int]] = ..., range_long_set_header: typing.Optional[typing.List[int]] = ..., range_byte_list_header: typing.Optional[typing.List[int]] = ..., range_short_list_header: typing.Optional[typing.List[int]] = ..., range_integer_list_header: typing.Optional[typing.List[int]] = ..., range_long_list_header: typing.Optional[typing.List[int]] = ..., length_string_query: typing.Optional[str] = ..., range_byte_query: int, range_short_query: int, range_integer_query: int, range_long_query: int, enum_string_query: typing.Optional[constraints_without_public_constrained_types.model.EnumString] = ..., length_string_list_query: typing.Optional[typing.List[str]] = ..., length_list_pattern_string_query: typing.Optional[typing.List[str]] = ..., length_string_set_query: typing.Optional[typing.Set[str]] = ..., range_byte_list_query: typing.Optional[typing.List[int]] = ..., range_short_list_query: typing.Optional[typing.List[int]] = ..., range_integer_list_query: typing.Optional[typing.List[int]] = ..., range_long_list_query: typing.Optional[typing.List[int]] = ..., range_byte_set_query: typing.Optional[typing.List[int]] = ..., range_short_set_query: typing.Optional[typing.List[int]] = ..., range_integer_set_query: typing.Optional[typing.List[int]] = ..., range_long_set_query: typing.Optional[typing.List[int]] = ..., enum_string_list_query: typing.Optional[typing.List[constraints_without_public_constrained_types.model.EnumString]] = ...) -> None:
   91         -
        ...
   92         -
   93         -
   94         -
class ConstrainedHttpPayloadBoundShapeOperationOutput:
   95         -
    http_payload_bound_constrained_shape: constraints_without_public_constrained_types.model.ConA
   96         -
   97         -
    def __init__(self, http_payload_bound_constrained_shape: constraints_without_public_constrained_types.model.ConA) -> None:
   98         -
        ...
   99         -
  100         -
  101         -
class ConstrainedRecursiveShapesOperationOutput:
  102         -
    nested: typing.Optional[constraints_without_public_constrained_types.model.RecursiveShapesInputOutputNested1]
  103         -
  104         -
    recursive_list: typing.List[constraints_without_public_constrained_types.model.RecursiveShapesInputOutputNested1]
  105         -
  106         -
    def __init__(self, nested: typing.Optional[constraints_without_public_constrained_types.model.RecursiveShapesInputOutputNested1] = ..., recursive_list: typing.List[constraints_without_public_constrained_types.model.RecursiveShapesInputOutputNested1]) -> None:
  107         -
        ...
  108         -
  109         -
  110         -
class ConstrainedShapesOnlyInOutputOperationOutput:
  111         -
    list: typing.Optional[typing.List[constraints_without_public_constrained_types.model.ConstrainedUnionInOutput]]
  112         -
  113         -
    map: typing.Optional[typing.Dict[str, constraints_without_public_constrained_types.model.TransitivelyConstrainedStructureInOutput]]
  114         -
  115         -
    union: typing.Optional[constraints_without_public_constrained_types.model.ConstrainedUnionInOutput]
  116         -
  117         -
    def __init__(self, list: typing.Optional[typing.List[constraints_without_public_constrained_types.model.ConstrainedUnionInOutput]] = ..., map: typing.Optional[typing.Dict[str, constraints_without_public_constrained_types.model.TransitivelyConstrainedStructureInOutput]] = ..., union: typing.Optional[constraints_without_public_constrained_types.model.ConstrainedUnionInOutput] = ...) -> None:
  118         -
        ...
  119         -
  120         -
  121         -
class ConstrainedShapesOperationOutput:
  122         -
    con_a: constraints_without_public_constrained_types.model.ConA
  123         -
  124         -
    def __init__(self, con_a: constraints_without_public_constrained_types.model.ConA) -> None:
  125         -
        ...
  126         -
  127         -
  128         -
class EventStreamsOperationOutput:
  129         -
    events: typing.AsyncIterator[constraints_without_public_constrained_types.model.Event]
  130         -
  131         -
    def __init__(self, events: typing.AsyncIterator[constraints_without_public_constrained_types.model.Event]) -> None:
  132         -
        ...
  133         -
  134         -
  135         -
class HttpPrefixHeadersTargetingLengthMapOperationOutput:
  136         -
    length_map: typing.Optional[typing.Dict[str, str]]
  137         -
  138         -
    def __init__(self, length_map: typing.Optional[typing.Dict[str, str]] = ...) -> None:
  139         -
        ...
  140         -
  141         -
  142         -
class NonStreamingBlobOperationOutput:
  143         -
    non_streaming_blob: typing.Optional[constraints_without_public_constrained_types.types.Blob]
  144         -
  145         -
    def __init__(self, non_streaming_blob: typing.Optional[constraints_without_public_constrained_types.types.Blob] = ...) -> None:
  146         -
        ...
  147         -
  148         -
  149         -
class QueryParamsTargetingLengthMapOperationOutput:
  150         -
    length_map: typing.Optional[typing.Dict[str, str]]
  151         -
  152         -
    def __init__(self, length_map: typing.Optional[typing.Dict[str, str]] = ...) -> None:
  153         -
        ...
  154         -
  155         -
  156         -
class QueryParamsTargetingMapOfEnumStringOperationOutput:
  157         -
    map_of_enum_string: typing.Optional[typing.Dict[constraints_without_public_constrained_types.model.EnumString, constraints_without_public_constrained_types.model.EnumString]]
  158         -
  159         -
    def __init__(self, map_of_enum_string: typing.Optional[typing.Dict[constraints_without_public_constrained_types.model.EnumString, constraints_without_public_constrained_types.model.EnumString]] = ...) -> None:
  160         -
        ...
  161         -
  162         -
  163         -
class QueryParamsTargetingMapOfLengthListOfPatternStringOperationOutput:
  164         -
    map_of_length_list_of_pattern_string: typing.Optional[typing.Dict[str, typing.List[str]]]
  165         -
  166         -
    def __init__(self, map_of_length_list_of_pattern_string: typing.Optional[typing.Dict[str, typing.List[str]]] = ...) -> None:
  167         -
        ...
  168         -
  169         -
  170         -
class QueryParamsTargetingMapOfLengthPatternStringOperationOutput:
  171         -
    map_of_length_pattern_string: typing.Optional[typing.Dict[str, str]]
  172         -
  173         -
    def __init__(self, map_of_length_pattern_string: typing.Optional[typing.Dict[str, str]] = ...) -> None:
  174         -
        ...
  175         -
  176         -
  177         -
class QueryParamsTargetingMapOfLengthStringOperationOutput:
  178         -
    map_of_length_string: typing.Optional[typing.Dict[str, str]]
  179         -
  180         -
    def __init__(self, map_of_length_string: typing.Optional[typing.Dict[str, str]] = ...) -> None:
  181         -
        ...
  182         -
  183         -
  184         -
class QueryParamsTargetingMapOfListOfEnumStringOperationOutput:
  185         -
    map_of_list_of_enum_string: typing.Optional[typing.Dict[constraints_without_public_constrained_types.model.EnumString, typing.List[constraints_without_public_constrained_types.model.EnumString]]]
  186         -
  187         -
    def __init__(self, map_of_list_of_enum_string: typing.Optional[typing.Dict[constraints_without_public_constrained_types.model.EnumString, typing.List[constraints_without_public_constrained_types.model.EnumString]]] = ...) -> None:
  188         -
        ...
  189         -
  190         -
  191         -
class QueryParamsTargetingMapOfListOfLengthPatternStringOperationOutput:
  192         -
    map_of_length_pattern_string: typing.Optional[typing.Dict[str, typing.List[str]]]
  193         -
  194         -
    def __init__(self, map_of_length_pattern_string: typing.Optional[typing.Dict[str, typing.List[str]]] = ...) -> None:
  195         -
        ...
  196         -
  197         -
  198         -
class QueryParamsTargetingMapOfListOfLengthStringOperationOutput:
  199         -
    map_of_list_of_length_string: typing.Optional[typing.Dict[str, typing.List[str]]]
  200         -
  201         -
    def __init__(self, map_of_list_of_length_string: typing.Optional[typing.Dict[str, typing.List[str]]] = ...) -> None:
  202         -
        ...
  203         -
  204         -
  205         -
class QueryParamsTargetingMapOfListOfPatternStringOperationOutput:
  206         -
    map_of_list_of_pattern_string: typing.Optional[typing.Dict[str, typing.List[str]]]
  207         -
  208         -
    def __init__(self, map_of_list_of_pattern_string: typing.Optional[typing.Dict[str, typing.List[str]]] = ...) -> None:
  209         -
        ...
  210         -
  211         -
  212         -
class QueryParamsTargetingMapOfPatternStringOperationOutput:
  213         -
    map_of_pattern_string: typing.Optional[typing.Dict[str, str]]
  214         -
  215         -
    def __init__(self, map_of_pattern_string: typing.Optional[typing.Dict[str, str]] = ...) -> None:
  216         -
        ...
  217         -
  218         -
  219         -
class QueryParamsTargetingMapOfSetOfLengthStringOperationOutput:
  220         -
    map_of_set_of_length_string: typing.Optional[typing.Dict[str, typing.Set[str]]]
  221         -
  222         -
    def __init__(self, map_of_set_of_length_string: typing.Optional[typing.Dict[str, typing.Set[str]]] = ...) -> None:
  223         -
        ...
  224         -
  225         -
  226         -
class StreamingBlobOperationOutput:
  227         -
    streaming_blob: constraints_without_public_constrained_types.types.ByteStream
  228         -
  229         -
    def __init__(self, streaming_blob: constraints_without_public_constrained_types.types.ByteStream) -> None:
  230         -
        ...
  231         -

tmp-codegen-diff/codegen-server-test-python/constraints_without_public_constrained_types/rust-server-codegen-python/python/constraints_without_public_constrained_types/socket/__init__.pyi

@@ -1,0 +27,0 @@
    1         -
import typing
    2         -
    3         -
class PySocket:
    4         -
    """
    5         -
    Socket implementation that can be shared between multiple Python processes.
    6         -
    7         -
    Python cannot handle true multi-threaded applications due to the [GIL],
    8         -
    often resulting in reduced performance and only one core used by the application.
    9         -
    To work around this, Python web applications usually create a socket with
   10         -
    SO_REUSEADDR and SO_REUSEPORT enabled that can be shared between multiple
   11         -
    Python processes, allowing you to maximize performance and use all available
   12         -
    computing capacity of the host.
   13         -
   14         -
    [GIL]: https://wiki.python.org/moin/GlobalInterpreterLock
   15         -
    """
   16         -
   17         -
    def try_clone(self) -> PySocket:
   18         -
        """
   19         -
        Clone the inner socket allowing it to be shared between multiple
   20         -
        Python processes.
   21         -
        """
   22         -
        ...
   23         -
   24         -
   25         -
    def __init__(self, address: str, port: int, backlog: typing.Optional[int] = ...) -> None:
   26         -
        ...
   27         -

tmp-codegen-diff/codegen-server-test-python/constraints_without_public_constrained_types/rust-server-codegen-python/python/constraints_without_public_constrained_types/tls/__init__.pyi

@@ -1,0 +10,0 @@
    1         -
import pathlib
    2         -
    3         -
class TlsConfig:
    4         -
    """
    5         -
    PyTlsConfig represents TLS configuration created from Python.
    6         -
    """
    7         -
    8         -
    def __init__(self, key_path: pathlib.Path, cert_path: pathlib.Path, reload_secs: int = ...) -> None:
    9         -
        ...
   10         -

tmp-codegen-diff/codegen-server-test-python/constraints_without_public_constrained_types/rust-server-codegen-python/python/constraints_without_public_constrained_types/types/__init__.pyi

@@ -1,0 +209,0 @@
    1         -
import typing
    2         -
    3         -
class Blob:
    4         -
    """
    5         -
    Python Wrapper for [aws_smithy_types::Blob].
    6         -
    """
    7         -
    8         -
    data: bytes
    9         -
    """
   10         -
    Python getter for the `Blob` byte array.
   11         -
    """
   12         -
   13         -
    def __init__(self, input: bytes) -> None:
   14         -
        ...
   15         -
   16         -
   17         -
class ByteStream:
   18         -
    """
   19         -
    Python Wrapper for [aws_smithy_types::byte_stream::ByteStream].
   20         -
   21         -
    ByteStream provides misuse-resistant primitives to make it easier to handle common patterns with streaming data.
   22         -
   23         -
    On the Rust side, The Python implementation wraps the original [ByteStream](aws_smithy_types::byte_stream::ByteStream)
   24         -
    in a clonable structure and implements the [Stream](futures::stream::Stream) trait for it to
   25         -
    allow Rust to handle the type transparently.
   26         -
   27         -
    On the Python side both sync and async iterators are exposed by implementing `__iter__()` and `__aiter__()` magic methods,
   28         -
    which allows to just loop over the stream chunks.
   29         -
   30         -
    ### Example of async streaming:
   31         -
   32         -
    ```python
   33         -
        stream = await ByteStream.from_path("/tmp/music.mp3")
   34         -
        async for chunk in stream:
   35         -
            print(chunk)
   36         -
    ```
   37         -
   38         -
    ### Example of sync streaming:
   39         -
   40         -
    ```python
   41         -
        stream = ByteStream.from_stream_blocking("/tmp/music.mp3")
   42         -
        for chunk in stream:
   43         -
            print(chunk)
   44         -
    ```
   45         -
   46         -
    The main difference between the two implementations is that the async one is scheduling the Python coroutines as Rust futures,
   47         -
    effectively maintaining the asyncronous behavior that Rust exposes, while the sync one is blocking the Tokio runtime to be able
   48         -
    to await one chunk at a time.
   49         -
   50         -
    The original Rust [ByteStream](aws_smithy_types::byte_stream::ByteStream) is wrapped inside a `Arc<Mutex>` to allow the type to be
   51         -
    [Clone] (required by PyO3) and to allow internal mutability, required to fetch the next chunk of data.
   52         -
    """
   53         -
   54         -
    @staticmethod
   55         -
    def from_path(path: str) -> typing.Awaitable[ByteStream]:
   56         -
        """
   57         -
        Create a new [ByteStream](aws_smithy_types::byte_stream::ByteStream) from a path, forcing
   58         -
        Python to await this coroutine.
   59         -
        """
   60         -
        ...
   61         -
   62         -
   63         -
    @staticmethod
   64         -
    def from_path_blocking(path: str) -> ByteStream:
   65         -
        """
   66         -
        Create a new [ByteStream](aws_smithy_types::byte_stream::ByteStream) from a path, without
   67         -
        requiring Python to await this method.
   68         -
   69         -
        **NOTE:** This method will block the Rust event loop when it is running.
   70         -
        """
   71         -
        ...
   72         -
   73         -
   74         -
    def __init__(self, input: bytes) -> None:
   75         -
        ...
   76         -
   77         -
   78         -
class DateTime:
   79         -
    """
   80         -
    Python Wrapper for [aws_smithy_types::date_time::DateTime].
   81         -
    """
   82         -
   83         -
    def as_nanos(self) -> int:
   84         -
        """
   85         -
        Returns the number of nanoseconds since the Unix epoch that this `DateTime` represents.
   86         -
        """
   87         -
        ...
   88         -
   89         -
   90         -
    def as_secs_f64(self) -> float:
   91         -
        """
   92         -
        Returns the `DateTime` value as an `f64` representing the seconds since the Unix epoch.
   93         -
        """
   94         -
        ...
   95         -
   96         -
   97         -
    @staticmethod
   98         -
    def from_fractional_secs(epoch_seconds: int, fraction: float) -> DateTime:
   99         -
        """
  100         -
        Creates a `DateTime` from a number of seconds and a fractional second since the Unix epoch.
  101         -
        """
  102         -
        ...
  103         -
  104         -
  105         -
    @staticmethod
  106         -
    def from_millis(epoch_millis: int) -> DateTime:
  107         -
        """
  108         -
        Creates a `DateTime` from a number of milliseconds since the Unix epoch.
  109         -
        """
  110         -
        ...
  111         -
  112         -
  113         -
    @staticmethod
  114         -
    def from_nanos(epoch_nanos: int) -> DateTime:
  115         -
        """
  116         -
        Creates a `DateTime` from a number of nanoseconds since the Unix epoch.
  117         -
        """
  118         -
        ...
  119         -
  120         -
  121         -
    @staticmethod
  122         -
    def from_secs(epoch_seconds: int) -> DateTime:
  123         -
        """
  124         -
        Creates a `DateTime` from a number of seconds since the Unix epoch.
  125         -
        """
  126         -
        ...
  127         -
  128         -
  129         -
    @staticmethod
  130         -
    def from_secs_and_nanos(seconds: int, subsecond_nanos: int) -> DateTime:
  131         -
        """
  132         -
        Creates a `DateTime` from a number of seconds and sub-second nanos since the Unix epoch.
  133         -
        """
  134         -
        ...
  135         -
  136         -
  137         -
    @staticmethod
  138         -
    def from_secs_f64(epoch_seconds: float) -> DateTime:
  139         -
        """
  140         -
        Creates a `DateTime` from an `f64` representing the number of seconds since the Unix epoch.
  141         -
        """
  142         -
        ...
  143         -
  144         -
  145         -
    @staticmethod
  146         -
    def from_str(s: str, format: Format) -> DateTime:
  147         -
        """
  148         -
        Parses a `DateTime` from a string using the given `format`.
  149         -
        """
  150         -
        ...
  151         -
  152         -
  153         -
    def has_subsec_nanos(self) -> bool:
  154         -
        """
  155         -
        Returns true if sub-second nanos is greater than zero.
  156         -
        """
  157         -
        ...
  158         -
  159         -
  160         -
    @staticmethod
  161         -
    def read(format: Format, delim: str) -> typing.Tuple[DateTime, str]:
  162         -
        """
  163         -
        Read 1 date of `format` from `s`, expecting either `delim` or EOF.
  164         -
  165         -
        TODO(PythonTyping): How do we represent `char` in Python?
  166         -
        """
  167         -
        ...
  168         -
  169         -
  170         -
    def secs(self) -> int:
  171         -
        """
  172         -
        Returns the epoch seconds component of the `DateTime`.
  173         -
        """
  174         -
        ...
  175         -
  176         -
  177         -
    def subsec_nanos(self) -> int:
  178         -
        """
  179         -
        Returns the sub-second nanos component of the `DateTime`.
  180         -
        """
  181         -
        ...
  182         -
  183         -
  184         -
    def to_millis(self) -> int:
  185         -
        """
  186         -
        Converts the `DateTime` to the number of milliseconds since the Unix epoch.
  187         -
        """
  188         -
        ...
  189         -
  190         -
  191         -
class Format:
  192         -
    """
  193         -
    Formats for representing a `DateTime` in the Smithy protocols.
  194         -
    """
  195         -
  196         -
    DateTime: Format
  197         -
    """
  198         -
    Formats for representing a `DateTime` in the Smithy protocols.
  199         -
    """
  200         -
  201         -
    EpochSeconds: Format
  202         -
    """
  203         -
    Formats for representing a `DateTime` in the Smithy protocols.
  204         -
    """
  205         -
  206         -
    HttpDate: Format
  207         -
    """
  208         -
    Formats for representing a `DateTime` in the Smithy protocols.
  209         -
    """

tmp-codegen-diff/codegen-server-test-python/ebs/rust-server-codegen-python/Cargo.toml

@@ -14,14 +68,68 @@
   34     34   
version = "7"
   35     35   
[dependencies.once_cell]
   36     36   
version = "1.13"
   37     37   
[dependencies.parking_lot]
   38     38   
version = "0.12"
   39     39   
[dependencies.percent-encoding]
   40     40   
version = "2.0.0"
   41     41   
[dependencies.pin-project-lite]
   42     42   
version = "0.2"
   43     43   
[dependencies.pyo3]
   44         -
version = "0.18"
          44  +
version = "0.20"
   45     45   
[dependencies.pyo3-asyncio]
   46         -
version = "0.18"
          46  +
version = "0.20"
   47     47   
features = ["attributes", "tokio-runtime"]
   48     48   
[dependencies.regex]
   49     49   
version = "1.5.5"
   50     50   
[dependencies.tower]
   51     51   
version = "0.4"
   52     52   
[dependencies.tracing]
   53     53   
version = "0.1"
   54     54   
[dev-dependencies.hyper]
   55     55   
version = "0.14.12"
   56     56   
[dev-dependencies.tokio]

tmp-codegen-diff/codegen-server-test-python/ebs/rust-server-codegen-python/python/ebs/__init__.pyi

@@ -1,0 +170,0 @@
    1         -
import ebs.input
    2         -
import ebs.middleware
    3         -
import ebs.output
    4         -
import ebs.tls
    5         -
import typing
    6         -
    7         -
Ctx = typing.TypeVar('Ctx')
    8         -
    9         -
class App(typing.Generic[Ctx]):
   10         -
    """
   11         -
    Main Python application, used to register operations and context and start multiple
   12         -
    workers on the same shared socket.
   13         -
   14         -
    Operations can be registered using the application object as a decorator (`@app.operation_name`).
   15         -
   16         -
    Here's a full example to get you started:
   17         -
   18         -
    ```python
   19         -
    from ebs import input
   20         -
    from ebs import output
   21         -
    from ebs import error
   22         -
    from ebs import middleware
   23         -
    from ebs import App
   24         -
   25         -
    @dataclass
   26         -
    class Context:
   27         -
        counter: int = 0
   28         -
   29         -
    app = App()
   30         -
    app.context(Context())
   31         -
   32         -
    @app.request_middleware
   33         -
    def request_middleware(request: middleware::Request):
   34         -
        if request.get_header("x-amzn-id") != "secret":
   35         -
            raise middleware.MiddlewareException("Unsupported `x-amz-id` header", 401)
   36         -
   37         -
    # <p>Seals and completes the snapshot after all of the required blocks of data have been
   38         -
    #             written to it. Completing the snapshot changes the status to <code>completed</code>. You
   39         -
    #             cannot write new blocks to a snapshot after it has been completed.</p>
   40         -
    @app.complete_snapshot
   41         -
    def complete_snapshot(input: input::CompleteSnapshotInput, ctx: Context) -> output::CompleteSnapshotOutput:
   42         -
        raise NotImplementedError
   43         -
   44         -
    # <p>Returns the data in a block in an Amazon Elastic Block Store snapshot.</p>
   45         -
    @app.get_snapshot_block
   46         -
    def get_snapshot_block(input: input::GetSnapshotBlockInput, ctx: Context) -> output::GetSnapshotBlockOutput:
   47         -
        raise NotImplementedError
   48         -
   49         -
    # <p>Returns information about the blocks that are different between two
   50         -
    #             Amazon Elastic Block Store snapshots of the same volume/snapshot lineage.</p>
   51         -
    @app.list_changed_blocks
   52         -
    def list_changed_blocks(input: input::ListChangedBlocksInput, ctx: Context) -> output::ListChangedBlocksOutput:
   53         -
        raise NotImplementedError
   54         -
   55         -
    # <p>Returns information about the blocks in an Amazon Elastic Block Store snapshot.</p>
   56         -
    @app.list_snapshot_blocks
   57         -
    def list_snapshot_blocks(input: input::ListSnapshotBlocksInput, ctx: Context) -> output::ListSnapshotBlocksOutput:
   58         -
        raise NotImplementedError
   59         -
   60         -
    # <p>Writes a block of data to a snapshot. If the specified block contains
   61         -
    #             data, the existing data is overwritten. The target snapshot must be in the
   62         -
    #                 <code>pending</code> state.</p>
   63         -
    #           <p>Data written to a snapshot must be aligned with 512-byte sectors.</p>
   64         -
    @app.put_snapshot_block
   65         -
    def put_snapshot_block(input: input::PutSnapshotBlockInput, ctx: Context) -> output::PutSnapshotBlockOutput:
   66         -
        raise NotImplementedError
   67         -
   68         -
    # <p>Creates a new Amazon EBS snapshot. The new snapshot enters the <code>pending</code> state
   69         -
    #             after the request completes. </p>
   70         -
    #         <p>After creating the snapshot, use <a href="https://docs.aws.amazon.com/ebs/latest/APIReference/API_PutSnapshotBlock.html"> PutSnapshotBlock</a> to
   71         -
    #             write blocks of data to the snapshot.</p>
   72         -
    @app.start_snapshot
   73         -
    def start_snapshot(input: input::StartSnapshotInput, ctx: Context) -> output::StartSnapshotOutput:
   74         -
        raise NotImplementedError
   75         -
   76         -
    app.run()
   77         -
    ```
   78         -
   79         -
    Any of operations above can be written as well prepending the `async` keyword and
   80         -
    the Python application will automatically handle it and schedule it on the event loop for you.
   81         -
    """
   82         -
   83         -
    def complete_snapshot(self, func: typing.Union[typing.Callable[[ebs.input.CompleteSnapshotInput, Ctx], typing.Union[ebs.output.CompleteSnapshotOutput, typing.Awaitable[ebs.output.CompleteSnapshotOutput]]], typing.Callable[[ebs.input.CompleteSnapshotInput], typing.Union[ebs.output.CompleteSnapshotOutput, typing.Awaitable[ebs.output.CompleteSnapshotOutput]]]]) -> None:
   84         -
        """
   85         -
        Method to register `complete_snapshot` Python implementation inside the handlers map.
   86         -
        It can be used as a function decorator in Python.
   87         -
        """
   88         -
        ...
   89         -
   90         -
   91         -
    def context(self, context: Ctx) -> None:
   92         -
        """
   93         -
        Register a context object that will be shared between handlers.
   94         -
        """
   95         -
        ...
   96         -
   97         -
   98         -
    def get_snapshot_block(self, func: typing.Union[typing.Callable[[ebs.input.GetSnapshotBlockInput, Ctx], typing.Union[ebs.output.GetSnapshotBlockOutput, typing.Awaitable[ebs.output.GetSnapshotBlockOutput]]], typing.Callable[[ebs.input.GetSnapshotBlockInput], typing.Union[ebs.output.GetSnapshotBlockOutput, typing.Awaitable[ebs.output.GetSnapshotBlockOutput]]]]) -> None:
   99         -
        """
  100         -
        Method to register `get_snapshot_block` Python implementation inside the handlers map.
  101         -
        It can be used as a function decorator in Python.
  102         -
        """
  103         -
        ...
  104         -
  105         -
  106         -
    def list_changed_blocks(self, func: typing.Union[typing.Callable[[ebs.input.ListChangedBlocksInput, Ctx], typing.Union[ebs.output.ListChangedBlocksOutput, typing.Awaitable[ebs.output.ListChangedBlocksOutput]]], typing.Callable[[ebs.input.ListChangedBlocksInput], typing.Union[ebs.output.ListChangedBlocksOutput, typing.Awaitable[ebs.output.ListChangedBlocksOutput]]]]) -> None:
  107         -
        """
  108         -
        Method to register `list_changed_blocks` Python implementation inside the handlers map.
  109         -
        It can be used as a function decorator in Python.
  110         -
        """
  111         -
        ...
  112         -
  113         -
  114         -
    def list_snapshot_blocks(self, func: typing.Union[typing.Callable[[ebs.input.ListSnapshotBlocksInput, Ctx], typing.Union[ebs.output.ListSnapshotBlocksOutput, typing.Awaitable[ebs.output.ListSnapshotBlocksOutput]]], typing.Callable[[ebs.input.ListSnapshotBlocksInput], typing.Union[ebs.output.ListSnapshotBlocksOutput, typing.Awaitable[ebs.output.ListSnapshotBlocksOutput]]]]) -> None:
  115         -
        """
  116         -
        Method to register `list_snapshot_blocks` Python implementation inside the handlers map.
  117         -
        It can be used as a function decorator in Python.
  118         -
        """
  119         -
        ...
  120         -
  121         -
  122         -
    def middleware(self, func: typing.Callable[[ebs.middleware.Request, typing.Callable[[ebs.middleware.Request], typing.Awaitable[ebs.middleware.Response]]], typing.Awaitable[ebs.middleware.Response]]) -> None:
  123         -
        """
  124         -
        Register a Python function to be executed inside a Tower middleware layer.
  125         -
        """
  126         -
        ...
  127         -
  128         -
  129         -
    def put_snapshot_block(self, func: typing.Union[typing.Callable[[ebs.input.PutSnapshotBlockInput, Ctx], typing.Union[ebs.output.PutSnapshotBlockOutput, typing.Awaitable[ebs.output.PutSnapshotBlockOutput]]], typing.Callable[[ebs.input.PutSnapshotBlockInput], typing.Union[ebs.output.PutSnapshotBlockOutput, typing.Awaitable[ebs.output.PutSnapshotBlockOutput]]]]) -> None:
  130         -
        """
  131         -
        Method to register `put_snapshot_block` Python implementation inside the handlers map.
  132         -
        It can be used as a function decorator in Python.
  133         -
        """
  134         -
        ...
  135         -
  136         -
  137         -
    def run(self, address: typing.Optional[str] = ..., port: typing.Optional[int] = ..., backlog: typing.Optional[int] = ..., workers: typing.Optional[int] = ..., tls: typing.Optional[ebs.tls.TlsConfig] = ...) -> None:
  138         -
        """
  139         -
        Main entrypoint: start the server on multiple workers.
  140         -
        """
  141         -
        ...
  142         -
  143         -
  144         -
    def run_lambda(self) -> None:
  145         -
        """
  146         -
        Lambda entrypoint: start the server on Lambda.
  147         -
        """
  148         -
        ...
  149         -
  150         -
  151         -
    def start_snapshot(self, func: typing.Union[typing.Callable[[ebs.input.StartSnapshotInput, Ctx], typing.Union[ebs.output.StartSnapshotOutput, typing.Awaitable[ebs.output.StartSnapshotOutput]]], typing.Callable[[ebs.input.StartSnapshotInput], typing.Union[ebs.output.StartSnapshotOutput, typing.Awaitable[ebs.output.StartSnapshotOutput]]]]) -> None:
  152         -
        """
  153         -
        Method to register `start_snapshot` Python implementation inside the handlers map.
  154         -
        It can be used as a function decorator in Python.
  155         -
        """
  156         -
        ...
  157         -
  158         -
  159         -
    def start_worker(self) -> None:
  160         -
        """
  161         -
        Build the service and start a single worker.
  162         -
        """
  163         -
        ...
  164         -
  165         -
  166         -
    def __init__(self) -> None:
  167         -
        ...
  168         -
  169         -
  170         -
CODEGEN_VERSION: str = ...