





'''simple docstring'''

def 						__magic_name__       (							__UpperCAmelCase      )						->					bool:

   '''simple docstring'''







   if num < 0:
      return False

   __SCREAMING_SNAKE_CASE      							=       num
   __SCREAMING_SNAKE_CASE      							=       0
   while num > 0:
      __SCREAMING_SNAKE_CASE      							=       rev_num * 10 + (num % 10)
      num //= 10

   return num_copy == rev_num


if __name__ == "__main__":
   import doctest

   doctest.testmod()












'''simple docstring'''

import time
from contextlib import contextmanager
from pathlib import Path

import pytest
import requests
from huggingface_hub.hf_api import HfApi, HfFolder


a        =						"__DUMMY_TRANSFORMERS_USER__"
a        =						"Dummy User"
a        =						"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"

a        =						"https://hub-ci.huggingface.co"
a        =						CI_HUB_ENDPOINT + "/datasets/{repo_id}/resolve/{revision}/{path}"
a        =						CI_HUB_ENDPOINT + "/{repo_id}/resolve/{revision}/{filename}"
a        =						Path("~/.huggingface/hub_ci_token").expanduser()

@pytest.fixture
def 						__magic_name__       (							__UpperCAmelCase      )						->					int:

   '''simple docstring'''







   monkeypatch.setattr(
       """huggingface_hub.file_download.HUGGINGFACE_CO_URL_TEMPLATE"""							,	__UpperCAmelCase      )

@pytest.fixture
def 						__magic_name__       (							__UpperCAmelCase      )						->					Optional[Any]:

   '''simple docstring'''







   monkeypatch.setattr("""datasets.config.HF_ENDPOINT"""							,	__UpperCAmelCase      )
   monkeypatch.setattr("""datasets.config.HUB_DATASETS_URL"""							,	__UpperCAmelCase      )

@pytest.fixture
def 						__magic_name__       (							__UpperCAmelCase      )						->					Optional[Any]:

   '''simple docstring'''







   monkeypatch.setattr("""huggingface_hub.hf_api.HfFolder.path_token"""							,	__UpperCAmelCase      )

@pytest.fixture
def 						__magic_name__       (							__UpperCAmelCase							,	__UpperCAmelCase      )						->					Dict:

   '''simple docstring'''







   HfFolder.save_token(__UpperCAmelCase      )
   yield
   HfFolder.delete_token()

@pytest.fixture(scope="""session"""      )
def 						__magic_name__       (							)						->					Optional[Any]:

   '''simple docstring'''







   return HfApi(endpoint=__UpperCAmelCase      )

@pytest.fixture(scope="""session"""      )
def 						__magic_name__       (							__UpperCAmelCase      )						->					Dict:

   '''simple docstring'''







   __SCREAMING_SNAKE_CASE      							=       HfFolder.get_token()
   HfFolder.save_token(__UpperCAmelCase      )
   yield CI_HUB_USER_TOKEN
   if previous_token is not None:
      HfFolder.save_token(__UpperCAmelCase      )

@pytest.fixture
def 						__magic_name__       (							__UpperCAmelCase      )						->					Dict:

   '''simple docstring'''







   def _cleanup_repo(__UpperCAmelCase      ):
      hf_api.delete_repo(__UpperCAmelCase							,	token=__UpperCAmelCase							,	repo_type="""dataset"""      )

   return _cleanup_repo

@pytest.fixture
def 						__magic_name__       (							__UpperCAmelCase      )						->					int:

   '''simple docstring'''







   @contextmanager
   def _temporary_repo(__UpperCAmelCase      ):
      try:
         yield repo_id
      finally:
         cleanup_repo(__UpperCAmelCase      )

   return _temporary_repo

@pytest.fixture(scope="""session"""      )
def 						__magic_name__       (							__UpperCAmelCase							,	__UpperCAmelCase							,	__UpperCAmelCase      )						->					Dict:

   '''simple docstring'''







   __SCREAMING_SNAKE_CASE      							=       f"""repo_txt_data-{int(time.time() * 1_0e3      )}"""
   __SCREAMING_SNAKE_CASE      							=       f"""{CI_HUB_USER}/{repo_name}"""
   hf_api.create_repo(__UpperCAmelCase							,	token=__UpperCAmelCase							,	repo_type="""dataset"""							,	private=__UpperCAmelCase      )
   hf_api.upload_file(
       token=__UpperCAmelCase							,	path_or_fileobj=str(__UpperCAmelCase      )							,	path_in_repo="""data/text_data.txt"""							,	repo_id=__UpperCAmelCase							,	repo_type="""dataset"""							,	)
   yield repo_id
   try:
      hf_api.delete_repo(__UpperCAmelCase							,	token=__UpperCAmelCase							,	repo_type="""dataset"""      )
   except (requests.exceptions.HTTPError, ValueError):  # catch http error and token invalid error
      pass

@pytest.fixture()
def 						__magic_name__       (							__UpperCAmelCase							,	__UpperCAmelCase							,	__UpperCAmelCase      )						->					Optional[Any]:

   '''simple docstring'''







   return hf_private_dataset_repo_txt_data_

@pytest.fixture(scope="""session"""      )
def 						__magic_name__       (							__UpperCAmelCase							,	__UpperCAmelCase							,	__UpperCAmelCase      )						->					Dict:

   '''simple docstring'''







   __SCREAMING_SNAKE_CASE      							=       f"""repo_zipped_txt_data-{int(time.time() * 1_0e3      )}"""
   __SCREAMING_SNAKE_CASE      							=       f"""{CI_HUB_USER}/{repo_name}"""
   hf_api.create_repo(__UpperCAmelCase							,	token=__UpperCAmelCase							,	repo_type="""dataset"""							,	private=__UpperCAmelCase      )
   hf_api.upload_file(
       token=__UpperCAmelCase							,	path_or_fileobj=str(__UpperCAmelCase      )							,	path_in_repo="""data.zip"""							,	repo_id=__UpperCAmelCase							,	repo_type="""dataset"""							,	)
   yield repo_id
   try:
      hf_api.delete_repo(__UpperCAmelCase							,	token=__UpperCAmelCase							,	repo_type="""dataset"""      )
   except (requests.exceptions.HTTPError, ValueError):  # catch http error and token invalid error
      pass

@pytest.fixture()
def 						__magic_name__       (							__UpperCAmelCase							,	__UpperCAmelCase							,	__UpperCAmelCase      )						->					Tuple:

   '''simple docstring'''







   return hf_private_dataset_repo_zipped_txt_data_

@pytest.fixture(scope="""session"""      )
def 						__magic_name__       (							__UpperCAmelCase							,	__UpperCAmelCase							,	__UpperCAmelCase      )						->					Union[str, Any]:

   '''simple docstring'''







   __SCREAMING_SNAKE_CASE      							=       f"""repo_zipped_img_data-{int(time.time() * 1_0e3      )}"""
   __SCREAMING_SNAKE_CASE      							=       f"""{CI_HUB_USER}/{repo_name}"""
   hf_api.create_repo(__UpperCAmelCase							,	token=__UpperCAmelCase							,	repo_type="""dataset"""							,	private=__UpperCAmelCase      )
   hf_api.upload_file(
       token=__UpperCAmelCase							,	path_or_fileobj=str(__UpperCAmelCase      )							,	path_in_repo="""data.zip"""							,	repo_id=__UpperCAmelCase							,	repo_type="""dataset"""							,	)
   yield repo_id
   try:
      hf_api.delete_repo(__UpperCAmelCase							,	token=__UpperCAmelCase							,	repo_type="""dataset"""      )
   except (requests.exceptions.HTTPError, ValueError):  # catch http error and token invalid error
      pass







@pytest.fixture()
def 						__magic_name__       (							__UpperCAmelCase							,	__UpperCAmelCase							,	__UpperCAmelCase      )						->					Dict:

   '''simple docstring'''







   return hf_private_dataset_repo_zipped_img_data_





