mainframe.models.schemas¶
Classes¶
Server metadata |
|
Error |
|
Model representing a package queried from the database. |
|
Model used to specify a package by name and version |
|
Model used to specify a package by name and version |
|
Create a collection of name/value pairs. |
|
Model for a report using the PyPI Observation Api |
|
Client payload to server containing the results of a package scan |
|
The client's reason as to why scanning a package failed |
|
Package information of a requested job. |
|
Usage docs: https://docs.pydantic.dev/2.9/concepts/models/ |
|
Returned when no available jobs were found. |
|
Returned after queueing a package. Contains the UUID |
|
Recent system statistics |
Module Contents¶
- class mainframe.models.schemas.ServerMetadata(/, **data: Any)[source]¶
Bases:
pydantic.BaseModel
Server metadata
- class mainframe.models.schemas.Package(/, **data: Any)[source]¶
Bases:
pydantic.BaseModel
Model representing a package queried from the database.
- queued_at: datetime.datetime | None[source]¶
- reported_at: datetime.datetime | None[source]¶
- pending_at: datetime.datetime | None[source]¶
- finished_at: datetime.datetime | None[source]¶
- classmethod from_db(scan: mainframe.models.orm.Scan)[source]¶
- serialize_dt(dt: datetime.datetime | None, _info)[source]¶
- class mainframe.models.schemas.PackageSpecifier(/, **data: Any)[source]¶
Bases:
pydantic.BaseModel
Model used to specify a package by name and version
name: A str of the name of the package to be scanned version: A str of the package version to scan.
- class mainframe.models.schemas.ReportPackageBody(/, **data: Any)[source]¶
Bases:
PackageSpecifier
Model used to specify a package by name and version
name: A str of the name of the package to be scanned version: A str of the package version to scan.
- class mainframe.models.schemas.ObservationKind(*args, **kwds)[source]¶
Bases:
enum.Enum
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- class mainframe.models.schemas.ObservationReport(/, **data: Any)[source]¶
Bases:
pydantic.BaseModel
Model for a report using the PyPI Observation Api
- kind: ObservationKind[source]¶
- class mainframe.models.schemas.PackageScanResult(/, **data: Any)[source]¶
Bases:
PackageSpecifier
Client payload to server containing the results of a package scan
- class mainframe.models.schemas.PackageScanResultFail(/, **data: Any)[source]¶
Bases:
PackageSpecifier
The client’s reason as to why scanning a package failed
- class mainframe.models.schemas.JobResult(/, **data: Any)[source]¶
Bases:
pydantic.BaseModel
Package information of a requested job.
- class mainframe.models.schemas.GetRules(/, **data: Any)[source]¶
Bases:
pydantic.BaseModel
Usage docs: https://docs.pydantic.dev/2.9/concepts/models/
A base class for creating Pydantic models.
- __pydantic_complete__[source]¶
Whether model building is completed, or if there are still undefined fields.
- __pydantic_decorators__[source]¶
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_generic_metadata__[source]¶
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__[source]¶
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_serializer__[source]¶
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__[source]¶
The pydantic-core SchemaValidator used to validate instances of the model.
- class mainframe.models.schemas.NoJob(/, **data: Any)[source]¶
Bases:
pydantic.BaseModel
Returned when no available jobs were found.