pyantz.api.endpoints.get_parameters package#

Submodules#

pyantz.api.endpoints.get_parameters.endpoints module#

Get parameters to help the user setup their function.

get_job_schema(fn_name: str)[source]#

Get the schema of the parameters for the provided job.

Parameters:

fn_name (str) – the job’s full import path, or its trailing parts (such as simple.copy) if they name one job.

Returns:

the job’s full name and the json schema of its parameters.

Return type:

GetJsonSchemaResponse

Raises:

HTTPException – 404 if no job (or no parameters model) matches, 409 if several jobs match.

Example

from fastapi import HTTPException

from pyantz.api.endpoints.get_parameters.endpoints import get_job_schema

print(get_job_schema("simple.copy").fn_path)
try:
    get_job_schema("copy")
except HTTPException as exc:
    print(exc.status_code)
pyantz.jobs.files.simple.copy
409
router = <fastapi.routing.APIRouter object>#

Routes giving the parameters’ schemas of the jobs.

Parameters:
  • scope (Scope)

  • receive (Receive)

  • send (Send)

Return type:

None

strip_format[T](s: T)[source]#

Strip format from string fields.

The web ui’s forms reject formats they don’t know, such as path.

Parameters:

s (T) – a json schema, or part of one.

Returns:

a copy without the format of string fields, at any depth.

Return type:

T

Raises:

None. –

Example

from pyantz.api.endpoints.get_parameters.endpoints import strip_format

schema = {"anyOf": [{"type": "string", "format": "path"}, {"type": "null"}]}
print(strip_format(schema))
{'anyOf': [{'type': 'string'}, {'type': 'null'}]}

pyantz.api.endpoints.get_parameters.models module#

Data models used by the get_parameters endpoints.

class GetJsonSchemaResponse(*, fn_path: str, json_schema: JsonValue)[source]#

Bases: BaseModel

Response with the json schema for the function.

Parameters:
  • fn_path (str)

  • json_schema (JsonValue)

_abc_impl = <_abc._abc_data object>#
fn_path: str#

Full import path of the job.

json_schema: JsonValue#

Json schema of the job’s parameters.

Module contents#

Get parameters for a job for better type checking.