From 3d88e75ea5e3ae8253bbf6e0582f8e608c7e62b4 Mon Sep 17 00:00:00 2001 From: Om Gupta Date: Wed, 5 Apr 2023 14:48:07 +0530 Subject: [PATCH] Fix documentation formatting for get_search_suggestions. --- ytmusicapi/mixins/search.py | 104 +++++++++++++++++------------------- 1 file changed, 48 insertions(+), 56 deletions(-) diff --git a/ytmusicapi/mixins/search.py b/ytmusicapi/mixins/search.py index 2d72969..c5cbb35 100644 --- a/ytmusicapi/mixins/search.py +++ b/ytmusicapi/mixins/search.py @@ -216,7 +216,9 @@ class SearchMixin: return search_results - def get_search_suggestions(self, query: str, detailed_runs=False) -> Union[List, List[Dict]]: + def get_search_suggestions(self, + query: str, + detailed_runs=False) -> Union[List[str], List[Dict]]: """ Get Search Suggestions @@ -226,71 +228,61 @@ class SearchMixin: suggestion along with the complete text (like many search services usually bold the text typed by the user). Default: False, returns the list of search suggestions in plain text. - :return: List of search suggestion results depending on detailed_runs param. - Examples: - 1. - Params: - query = 'fade' - detailed_runs = False + :return: List of search suggestion results depending on ``detailed_runs`` param. - Response: - [ - 'faded', - 'faded alan walker lyrics', - 'faded alan walker', - 'faded remix', - 'faded song', - 'faded lyrics', - 'faded instrumental' - ] + Example response when ``query`` is 'fade' and ``detailed_runs`` is set to ``False``:: - 2. - Params: - query = 'fade' - detailed_runs = True + [ + "faded", + "faded alan walker lyrics", + "faded alan walker", + "faded remix", + "faded song", + "faded lyrics", + "faded instrumental" + ] - Response: - Runs with bold: True show the text typed by user & other runs contain the remaining suggestion. + Example response when ``detailed_runs`` is set to ``True``:: - [ + [ + { + "text": "faded", + "runs": [ { - 'text': 'faded', - 'runs': [ - { - 'text': 'fade', - 'bold': True - }, - { - 'text': 'd' - } - ] + "text": "fade", + "bold": true }, { - 'text': 'faded alan walker lyrics', - 'runs': [ - { - 'text': 'fade', - 'bold': True - }, - { - 'text': 'd alan walker lyrics' - } - ] + "text": "d" + } + ] + }, + { + "text": "faded alan walker lyrics", + "runs": [ + { + "text": "fade", + "bold": true }, { - 'text': 'faded alan walker', - 'runs': [ - { - 'text': 'fade', - 'bold': True - }, - { - 'text': 'd alan walker' - } - ] + "text": "d alan walker lyrics" + } + ] + }, + { + "text": "faded alan walker", + "runs": [ + { + "text": "fade", + "bold": true }, - ... - ] + { + "text": "d alan walker" + } + ] + }, + ... + ] """ body = {'input': query}