:py:mod:`httpstan.schemas` ========================== .. py:module:: httpstan.schemas Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: httpstan.schemas.Operation httpstan.schemas.Status httpstan.schemas.CreateModelRequest httpstan.schemas.Model httpstan.schemas.Data httpstan.schemas.CreateFitRequest httpstan.schemas.Fit httpstan.schemas.ShowParamsRequest httpstan.schemas.Parameter httpstan.schemas.WriterMessage httpstan.schemas.ShowLogProbRequest httpstan.schemas.ShowLogProbGradRequest httpstan.schemas.ShowWriteArrayRequest httpstan.schemas.ShowTransformInitsRequest .. py:class:: Operation(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None) Bases: :py:obj:`marshmallow.Schema` Long-running operation. Modeled on `operations.proto`, linked in https://cloud.google.com/apis/design/standard_methods .. py:attribute:: name .. py:attribute:: metadata .. py:attribute:: done .. py:attribute:: result .. py:method:: validate_result(self, data: dict, many: bool, partial: bool) -> None .. py:class:: Status(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None) Bases: :py:obj:`marshmallow.Schema` Error. Modeled on ``google.rpc.Status``. See https://cloud.google.com/apis/design/errors .. py:attribute:: code .. py:attribute:: status .. py:attribute:: message .. py:attribute:: details .. py:class:: CreateModelRequest(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None) Bases: :py:obj:`marshmallow.Schema` Schema for request to build a Stan program. .. py:attribute:: program_code .. py:class:: Model(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None) Bases: :py:obj:`marshmallow.Schema` Base schema class with which to define custom schemas. Example usage: .. code-block:: python import datetime as dt from dataclasses import dataclass from marshmallow import Schema, fields @dataclass class Album: title: str release_date: dt.date class AlbumSchema(Schema): title = fields.Str() release_date = fields.Date() album = Album("Beggars Banquet", dt.date(1968, 12, 6)) schema = AlbumSchema() data = schema.dump(album) data # {'release_date': '1968-12-06', 'title': 'Beggars Banquet'} :param only: Whitelist of the declared fields to select when instantiating the Schema. If None, all fields are used. Nested fields can be represented with dot delimiters. :param exclude: Blacklist of the declared fields to exclude when instantiating the Schema. If a field appears in both `only` and `exclude`, it is not used. Nested fields can be represented with dot delimiters. :param many: Should be set to `True` if ``obj`` is a collection so that the object will be serialized to a list. :param context: Optional context passed to :class:`fields.Method` and :class:`fields.Function` fields. :param load_only: Fields to skip during serialization (write-only fields) :param dump_only: Fields to skip during deserialization (read-only fields) :param partial: Whether to ignore missing fields and not require any fields declared. Propagates down to ``Nested`` fields as well. If its value is an iterable, only missing fields listed in that iterable will be ignored. Use dot delimiters to specify nested fields. :param unknown: Whether to exclude, include, or raise an error for unknown fields in the data. Use `EXCLUDE`, `INCLUDE` or `RAISE`. .. versionchanged:: 3.0.0 `prefix` parameter removed. .. versionchanged:: 2.0.0 `__validators__`, `__preprocessors__`, and `__data_handlers__` are removed in favor of `marshmallow.decorators.validates_schema`, `marshmallow.decorators.pre_load` and `marshmallow.decorators.post_dump`. `__accessor__` and `__error_handler__` are deprecated. Implement the `handle_error` and `get_attribute` methods instead. .. py:attribute:: name .. py:attribute:: compiler_output .. py:attribute:: stanc_warnings .. py:class:: Data(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None) Bases: :py:obj:`marshmallow.Schema` Data for a Stan model. .. py:class:: Meta .. py:attribute:: unknown .. py:method:: validate_stan_values(self, data: dict, many: bool, partial: bool) -> None Verify ``data`` dictionary will work for Stan. Keys should be strings, values must be numbers or (nested) lists of numbers. .. py:class:: CreateFitRequest(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None) Bases: :py:obj:`marshmallow.Schema` Schema for request to start sampling. Only two algorithms are supported: ``hmc_nuts_diag_e_adapt`` and ``fixed_param``. Sampler parameters can be found in ``httpstan/stan_services.cpp``. .. py:attribute:: function .. py:attribute:: data .. py:attribute:: init .. py:attribute:: random_seed .. py:attribute:: chain .. py:attribute:: init_radius .. py:attribute:: num_warmup .. py:attribute:: num_samples .. py:attribute:: num_thin .. py:attribute:: save_warmup .. py:attribute:: refresh .. py:attribute:: stepsize .. py:attribute:: stepsize_jitter .. py:attribute:: max_depth .. py:attribute:: delta .. py:attribute:: gamma .. py:attribute:: kappa .. py:attribute:: t0 .. py:attribute:: init_buffer .. py:attribute:: term_buffer .. py:attribute:: window .. py:class:: Fit(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None) Bases: :py:obj:`marshmallow.Schema` Base schema class with which to define custom schemas. Example usage: .. code-block:: python import datetime as dt from dataclasses import dataclass from marshmallow import Schema, fields @dataclass class Album: title: str release_date: dt.date class AlbumSchema(Schema): title = fields.Str() release_date = fields.Date() album = Album("Beggars Banquet", dt.date(1968, 12, 6)) schema = AlbumSchema() data = schema.dump(album) data # {'release_date': '1968-12-06', 'title': 'Beggars Banquet'} :param only: Whitelist of the declared fields to select when instantiating the Schema. If None, all fields are used. Nested fields can be represented with dot delimiters. :param exclude: Blacklist of the declared fields to exclude when instantiating the Schema. If a field appears in both `only` and `exclude`, it is not used. Nested fields can be represented with dot delimiters. :param many: Should be set to `True` if ``obj`` is a collection so that the object will be serialized to a list. :param context: Optional context passed to :class:`fields.Method` and :class:`fields.Function` fields. :param load_only: Fields to skip during serialization (write-only fields) :param dump_only: Fields to skip during deserialization (read-only fields) :param partial: Whether to ignore missing fields and not require any fields declared. Propagates down to ``Nested`` fields as well. If its value is an iterable, only missing fields listed in that iterable will be ignored. Use dot delimiters to specify nested fields. :param unknown: Whether to exclude, include, or raise an error for unknown fields in the data. Use `EXCLUDE`, `INCLUDE` or `RAISE`. .. versionchanged:: 3.0.0 `prefix` parameter removed. .. versionchanged:: 2.0.0 `__validators__`, `__preprocessors__`, and `__data_handlers__` are removed in favor of `marshmallow.decorators.validates_schema`, `marshmallow.decorators.pre_load` and `marshmallow.decorators.post_dump`. `__accessor__` and `__error_handler__` are deprecated. Implement the `handle_error` and `get_attribute` methods instead. .. py:attribute:: name .. py:class:: ShowParamsRequest(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None) Bases: :py:obj:`marshmallow.Schema` Base schema class with which to define custom schemas. Example usage: .. code-block:: python import datetime as dt from dataclasses import dataclass from marshmallow import Schema, fields @dataclass class Album: title: str release_date: dt.date class AlbumSchema(Schema): title = fields.Str() release_date = fields.Date() album = Album("Beggars Banquet", dt.date(1968, 12, 6)) schema = AlbumSchema() data = schema.dump(album) data # {'release_date': '1968-12-06', 'title': 'Beggars Banquet'} :param only: Whitelist of the declared fields to select when instantiating the Schema. If None, all fields are used. Nested fields can be represented with dot delimiters. :param exclude: Blacklist of the declared fields to exclude when instantiating the Schema. If a field appears in both `only` and `exclude`, it is not used. Nested fields can be represented with dot delimiters. :param many: Should be set to `True` if ``obj`` is a collection so that the object will be serialized to a list. :param context: Optional context passed to :class:`fields.Method` and :class:`fields.Function` fields. :param load_only: Fields to skip during serialization (write-only fields) :param dump_only: Fields to skip during deserialization (read-only fields) :param partial: Whether to ignore missing fields and not require any fields declared. Propagates down to ``Nested`` fields as well. If its value is an iterable, only missing fields listed in that iterable will be ignored. Use dot delimiters to specify nested fields. :param unknown: Whether to exclude, include, or raise an error for unknown fields in the data. Use `EXCLUDE`, `INCLUDE` or `RAISE`. .. versionchanged:: 3.0.0 `prefix` parameter removed. .. versionchanged:: 2.0.0 `__validators__`, `__preprocessors__`, and `__data_handlers__` are removed in favor of `marshmallow.decorators.validates_schema`, `marshmallow.decorators.pre_load` and `marshmallow.decorators.post_dump`. `__accessor__` and `__error_handler__` are deprecated. Implement the `handle_error` and `get_attribute` methods instead. .. py:attribute:: data .. py:class:: Parameter(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None) Bases: :py:obj:`marshmallow.Schema` Schema for single parameter. .. py:attribute:: name .. py:attribute:: dims .. py:attribute:: constrained_names .. py:class:: WriterMessage(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None) Bases: :py:obj:`marshmallow.Schema` Messages from callback writers and loggers in ``stan::callbacks``. NOTE: You SHOULD NOT use this schema. This schema exists for testing and for documentation. It SHOULD NOT be used to process a large number of JSON messages. Doing so will slow down any program. This schema is intended for messages emitted by C++ classes which inherit from - ``stan/callbacks/writer.hpp``, and - ``stan/callbacks/logger.hpp``. In particular, the schema matches a JSON-based "version" of the CSV-focused ``stan/callbacks/stream_writer.hpp`` and ``stan/callbacks/stream_logger.hpp``. This version is found "inside" the httpstan-specific ``httpstan/socket_writer.hpp`` and ``httpstan/socket_logger.hpp``. `WriterMessage` is a data format for all messages written by the callback writers defined in ``stan::callbacks``. These writers are used by the functions defined in ``stan::services``. For example, ``stan::services::sample::hmc_nuts_diag_e`` uses one logger and three writers: - ``logger`` Logger for informational and error messages - ``init_writer`` Writer callback for unconstrained inits - ``sample_writer`` Writer for draws - ``diagnostic_writer`` Writer for diagnostic information WriterMessage is a format which is flexible enough to accommodate these different uses while still providing a predictable structure. A WriterMessage has a field ``topic`` which provides information about what the WriterMessage concerns or what produced it. For example, the `topic` associated with a WriterMessage written by `sample_writer` in the function is ``sample``. The "content" of a message is stored in the field ``values``. This is either a list or a mapping. .. py:attribute:: version .. py:attribute:: topic .. py:attribute:: values .. py:class:: ShowLogProbRequest(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None) Bases: :py:obj:`marshmallow.Schema` Schema for log_prob request. .. py:attribute:: data .. py:attribute:: unconstrained_parameters .. py:attribute:: adjust_transform .. py:class:: ShowLogProbGradRequest(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None) Bases: :py:obj:`marshmallow.Schema` Schema for log_prob_grad request. .. py:attribute:: data .. py:attribute:: unconstrained_parameters .. py:attribute:: adjust_transform .. py:class:: ShowWriteArrayRequest(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None) Bases: :py:obj:`marshmallow.Schema` Schema for write_array request. .. py:attribute:: data .. py:attribute:: unconstrained_parameters .. py:attribute:: include_tparams .. py:attribute:: include_gqs .. py:class:: ShowTransformInitsRequest(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None) Bases: :py:obj:`marshmallow.Schema` Schema for transform_inits request. .. py:attribute:: data .. py:attribute:: constrained_parameters