Lists handler

Lists Handler

Module realize lists handler.

class luna_backport3.app.handlers.lists_handler.ListsHandler(request)[source]

Handler for work with lists.

async delete()[source]

Post a list, see spec delete lists.

Return type:

HTTPResponse

async get()[source]

Get lists, see spec get lists.

Return type:

HTTPResponse

async getFacesCountsInLists(listIds)[source]

Get faces count in lists.

Parameters:

listIds – list ids to search

Returns:

list id to faces count

Return type:

mapping

Return type:

Dict[str, int]

async getPersonsCountsInLists(listIds)[source]

Get persons count in lists.

Parameters:

listIds – list ids to search

Returns:

list id to faces count

Return type:

mapping

Return type:

Dict[str, int]

async iterateLists()[source]

Iterate over list ids for the current user. List ids are ordered descending by create time.

Yields:

list – id and user data pair

Return type:

AsyncIterable[LunaList]

async loadLists(listType, page, pageSize)[source]

Load luna lists.

Returns:

descriptorListIds: descriptor lists: id and user data pairs personsListIds: persons lists: id and user data pairs

Return type:

dict

Return type:

List[Dict]

async post()[source]

Post a list, see spec post lists.

Return type:

HTTPResponse

async prepareListsAndCounts()[source]

Load descriptor and person lists for response.

Service must return two responses at once:
  1. “page” and “page_size” query result for descriptor lists.

  2. “page” and “page_size” queries for person lists.

Returns:

list ids from the page and total list counts

Return type:

LoadedListsAndCounts

class luna_backport3.app.handlers.lists_handler.LoadedListsAndCounts(descriptorLists: List[dict], personLists: List[dict], descriptorListsCount: int, personsListsCount: int)[source]

Lists and counts type.

descriptorLists: List[dict]

descriptor lists

descriptorListsCount: int

descriptor lists count

personLists: List[dict]

person lists

personsListsCount: int

person lists count

class luna_backport3.app.handlers.lists_handler.LunaList(listId: str, userData: str)[source]

Luna list type.

listId: str

list id

userData: str

list user data

List handler

List Handler

Module realize list handler.

class luna_backport3.app.handlers.list_handler.ListHandler(request)[source]

Handler for resource /storage/lists/{list_id}.

async delete(listId)[source]

Get delete a list services, see spec delete list.

Return type:

HTTPResponse

async get(listId)[source]

Get list by id, see spec get list.

Return type:

HTTPResponse

async getFaceToPersonMap(faceIds)[source]

Get face to person mapping.

Parameters:

faceIds – face ids

Returns:

dict faceId -> personId (only existent links will be returned)

Return type:

Dict[str, str]

async patch(listId)[source]

Get path list, see spec patch list.

Return type:

HTTPResponse