




'''simple docstring'''


from transformers.models.cpm.tokenization_cpm import CpmTokenizer
from transformers.testing_utils import custom_tokenizers

from ..xlnet.test_modeling_xlnet import XLNetModelTest







@custom_tokenizers
class     SCREAMING_SNAKE_CASE						(	snake_case_							):






      def        lowercase_	(   self      :     Any	,	lowercase__      :     int	,	lowercase__      :     int	,	lowercase__      :     int	,	lowercase__      :     Optional[int]	,	lowercase__      :     Any					):


           '''simple docstring'''

           return True






      def        lowercase_	(   self      :     Optional[int]					):


           '''simple docstring'''

           a_    :       List[str]    	=     CpmTokenizer.from_pretrained("""TsinghuaAI/CPM-Generate"""					)
           a_    :       int    	=     """Hugging Face大法好，谁用谁知道。"""
           a_    :       Dict    	=     """Hugging Face大法好,谁用谁知道。<unk>"""
           a_    :       Optional[int]    	=     """▁Hu gg ing ▁ ▂ ▁F ace ▁大法 ▁好 ▁ , ▁谁 ▁用 ▁谁 ▁知 道 ▁ 。""".split()

           a_    :       Optional[Any]    	=     tokenizer.tokenize(lowercase__					)
           self.assertListEqual(lowercase__	,	lowercase__					)

           a_    :       Dict    	=     tokens + [tokenizer.unk_token]

           a_    :       Any    	=     [1_3789, 1_3283, 1421, 8, 10, 1164, 1_3608, 1_6528, 63, 8, 9, 440, 108, 440, 121, 90, 8, 12, 0]
           self.assertListEqual(tokenizer.convert_tokens_to_ids(lowercase__					)	,	lowercase__					)

           a_    :       Tuple    	=     tokenizer.decode(lowercase__					)
           self.assertEqual(lowercase__	,	lowercase__					)






'''simple docstring'''


import shutil

import requests



def    _SCREAMING_SNAKE_CASE    (			UpperCamelCase__						:				str   ,						UpperCamelCase__						:				bool = False   ,						UpperCamelCase__						:				str = "."							):




     """simple docstring"""


     a_    :       Any    	=     """https://api.nasa.gov/planetary/apod"""
     return requests.get(UpperCamelCase__   ,						params={"""api_key""": api_key}							).json()



def    _SCREAMING_SNAKE_CASE    (			UpperCamelCase__						:				str   ,						UpperCamelCase__						:				str = "."							):




     """simple docstring"""


     a_    :       Tuple    	=     get_apod_data(UpperCamelCase__							)
     a_    :       Tuple    	=     apod_data["""url"""]
     a_    :       Any    	=     img_url.split("""/"""							)[-1]
     a_    :       Tuple    	=     requests.get(UpperCamelCase__   ,						stream=UpperCamelCase__							)

     with open(F"{path}/{img_name}"   ,						"""wb+"""							) as img_file:
          shutil.copyfileobj(response.raw   ,						UpperCamelCase__							)
     del response
     return apod_data



def    _SCREAMING_SNAKE_CASE    (			UpperCamelCase__						:				str							):




     """simple docstring"""


     a_    :       str    	=     """https://images-api.nasa.gov/search"""
     return requests.get(UpperCamelCase__   ,						params={"""q""": query}							).json()


if __name__ == "__main__":
 print(save_apod('YOUR API KEY'))
 lowerCAmelCase_			:     int							    =     get_archive_data('apollo 2011')['collection']['items']
 print(apollo_aaaa_items[0]['data'][0]['description'])
