


'''simple docstring'''



import os

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

__UpperCAmelCase     :Union[str, Any]												=  {"UserAgent": UserAgent().random}
__UpperCAmelCase     :str												=  "https://www.mywaifulist.moe/random"




def       _a      (		_lowercase   :      str     ,   _lowercase   :      str    ):





     '''simple docstring'''






     __UpperCAmelCase      :					Any    				=     requests.get(_lowercase     ,   headers=_lowercase    )
     with open(_lowercase     ,   '''wb'''    ) as file:
          file.write(image.content    )




def       _a      (		):





     '''simple docstring'''






     __UpperCAmelCase      :					int    				=     BeautifulSoup(requests.get(_lowercase     ,   headers=_lowercase    ).text     ,   '''html.parser'''    )
     __UpperCAmelCase      :					Optional[int]    				=     soup.find('''meta'''     ,   attrs={'''property''': '''og:title'''}    ).attrs['''content''']
     __UpperCAmelCase      :					Union[str, Any]    				=     soup.find('''meta'''     ,   attrs={'''property''': '''og:image'''}    ).attrs['''content''']
     __UpperCAmelCase      :					List[Any]    				=     soup.find('''p'''     ,   id='''description'''    ).get_text()
     __UpperCAmelCase				,  __UpperCAmelCase      :					int    				=     os.path.splitext(os.path.basename(_lowercase    )    )
     __UpperCAmelCase      :					int    				=     title.strip().replace(''' '''     ,   '''_'''    )
     __UpperCAmelCase      :					int    				=     F'{image_title}{image_extension}'
     save_image(_lowercase     ,   _lowercase    )
     return (title, description, image_title)


if __name__ == "__main__":
      __UpperCAmelCase							,       __UpperCAmelCase							,       __UpperCAmelCase     :Union[str, Any]												=  random_anime_character()
      print(f"""{title}\n\n{desc}\n\nImage saved : {image_title}""")



'''simple docstring'''



def       _a      (		_lowercase   :      list    ):





     '''simple docstring'''






     if len(_lowercase    ) <= 1:
          return data
     else:
          return [
              *quick_sort([e for e in data[1:] if e <= data[0]]    ),
              data[0],
              *quick_sort([e for e in data[1:] if e > data[0]]    ),
          ]


if __name__ == "__main__":
      import doctest

      doctest.testmod()