fixed rpr

This commit is contained in:
Hellow 2023-03-28 18:40:56 +02:00
parent c67d8fba61
commit 0a7dfeb5ea
2 changed files with 48 additions and 48 deletions

View File

@ -7,7 +7,7 @@ def search_pages():
print("audio", search.audio_pages)
print()
print(search._current_option)
print(search)
if __name__ == "__main__":

View File

@ -9,9 +9,9 @@ from ...objects import Options, DatabaseObject
class MultiPageOptions:
def __init__(
self,
max_displayed_options: int = 10,
option_digits: int = 3
self,
max_displayed_options: int = 10,
option_digits: int = 3
) -> None:
self.max_displayed_options = max_displayed_options
self.option_digits: int = option_digits
@ -40,7 +40,7 @@ class MultiPageOptions:
lines.append("...")
break
lines.append(f"{j+i:0{self.option_digits}} {option_obj.option_string}")
lines.append(f"{j + i:0{self.option_digits}} {option_obj.option_string}")
j += i + 1
@ -54,7 +54,7 @@ class MultiPageOptions:
option_len = self.max_displayed_options
if index < j + option_len:
return options[j+option_len-1]
return options[j + option_len - 1]
j += option_len - 1
@ -83,13 +83,13 @@ class MultiPageOptions:
class Search:
def __init__(
self,
query: str,
pages: Tuple[Type[Page]] = page_attributes.ALL_PAGES,
exclude_pages: Set[Type[Page]] = set(),
exclude_shady: bool = False,
max_displayed_options: int = 10,
option_digits: int = 3
self,
query: str,
pages: Tuple[Type[Page]] = page_attributes.ALL_PAGES,
exclude_pages: Set[Type[Page]] = set(),
exclude_shady: bool = False,
max_displayed_options: int = 10,
option_digits: int = 3
) -> None:
_page_list: List[Type[Page]] = []
_audio_page_list: List[Type[Page]] = []
@ -131,7 +131,6 @@ class Search:
self._option_history.pop()
return self._option_history[-1]
def search(self, query: str):
"""
# The Query
@ -145,4 +144,5 @@ class Search:
for page in self.pages:
self._current_option[page] = page.search_by_query(query=query)
def __repr__(self):
return self._current_option.__repr__()