
"""simple docstring"""

import json
import os
from pathlib import Path

import pytest

from datasets.download.download_config import DownloadConfig
from datasets.download.download_manager import DownloadManager
from datasets.utils.file_utils import hash_url_to_filename


_A						=			'http://www.mocksite.com/file1.txt'
_A						=			'"text": ["foo", "foo"]'
_A						=			'6d8ce9aa78a471c7477201efbeabd3bb01ac2e7d100a6dc024ba1608361f90a8'






class 	_lowercase       :
	lowercase_				=     2_0_0
	lowercase_				=     {'Content-Length': '100'}
	lowercase_				=     {}




	def       _UpperCamelCase   (			self		,			**UpperCAmelCase_ )		->							Optional[int]:
			return [bytes(UpperCAmelCase_		,			'utf-8' )]


def 		UpperCAmelCase (		*a_,						**a_      ):





		'''simple docstring'''


		return MockResponse()
@pytest.mark.parametrize('urls_type',						[str, list, dict]      )
def 		UpperCAmelCase (		a_,						a_,						a_      ):





		'''simple docstring'''


		import requests

		monkeypatch.setattr(a_,						'request',						a_      )

		lowerCamelCase					:      Tuple          =   URL
		if issubclass(a_,						a_      ):
				lowerCamelCase					:      List[str]          =   url
		elif issubclass(a_,						a_      ):
				lowerCamelCase					:      int          =   [url]
		elif issubclass(a_,						a_      ):
				lowerCamelCase					:      str          =   {'train': url}
		lowerCamelCase					:      List[Any]          =   'dummy'
		lowerCamelCase					:      int          =   'downloads'
		lowerCamelCase					:      int          =   tmp_path
		lowerCamelCase					:      List[Any]          =   DownloadConfig(
		    cache_dir=os.path.join(a_,						a_      ),						use_etag=a_,						)
		lowerCamelCase					:      Any          =   DownloadManager(dataset_name=a_,						download_config=a_      )
		lowerCamelCase					:      Tuple          =   dl_manager.download(a_      )
		lowerCamelCase					:      Optional[Any]          =   urls
		for downloaded_paths in [downloaded_paths]:
				if isinstance(a_,						a_      ):
						lowerCamelCase					:      List[str]          =   [downloaded_paths]
						lowerCamelCase					:      str          =   [urls]
				elif isinstance(a_,						a_      ):
						assert "train" in downloaded_paths.keys()
						lowerCamelCase					:      Any          =   downloaded_paths.values()
						lowerCamelCase					:      List[str]          =   urls.values()
				assert downloaded_paths
				for downloaded_path, input_url in zip(a_,						a_      ):
						assert downloaded_path == dl_manager.downloaded_paths[input_url]
						lowerCamelCase					:      Dict          =   Path(a_      )
						lowerCamelCase					:      Optional[Any]          =   downloaded_path.parts
						assert parts[-1] == HASH
						assert parts[-2] == cache_subdir
						assert downloaded_path.exists()
						lowerCamelCase					:      Tuple          =   downloaded_path.read_text()
						assert content == CONTENT
						lowerCamelCase					:      Any          =   downloaded_path.with_suffix('.json'      )
						assert metadata_downloaded_path.exists()
						lowerCamelCase					:      Optional[int]          =   json.loads(metadata_downloaded_path.read_text()      )
						assert metadata_content == {"url": URL, "etag": None}
@pytest.mark.parametrize('paths_type',						[str, list, dict]      )
def 		UpperCAmelCase (		a_,						a_,						a_      ):





		'''simple docstring'''


		lowerCamelCase					:      Optional[Any]          =   str(a_      )
		if issubclass(a_,						a_      ):
				lowerCamelCase					:      Tuple          =   filename
		elif issubclass(a_,						a_      ):
				lowerCamelCase					:      List[Any]          =   [filename]
		elif issubclass(a_,						a_      ):
				lowerCamelCase					:      int          =   {'train': filename}
		lowerCamelCase					:      str          =   'dummy'
		lowerCamelCase					:      Union[str, Any]          =   xz_file.parent
		lowerCamelCase					:      Any          =   'extracted'
		lowerCamelCase					:      int          =   DownloadConfig(
		    cache_dir=a_,						use_etag=a_,						)
		lowerCamelCase					:      Any          =   DownloadManager(dataset_name=a_,						download_config=a_      )
		lowerCamelCase					:      Dict          =   dl_manager.extract(a_      )
		lowerCamelCase					:      Optional[Any]          =   paths
		for extracted_paths in [extracted_paths]:
				if isinstance(a_,						a_      ):
						lowerCamelCase					:      Dict          =   [extracted_paths]
						lowerCamelCase					:      Optional[int]          =   [paths]
				elif isinstance(a_,						a_      ):
						assert "train" in extracted_paths.keys()
						lowerCamelCase					:      str          =   extracted_paths.values()
						lowerCamelCase					:      Any          =   paths.values()
				assert extracted_paths
				for extracted_path, input_path in zip(a_,						a_      ):
						assert extracted_path == dl_manager.extracted_paths[input_path]
						lowerCamelCase					:      Tuple          =   Path(a_      )
						lowerCamelCase					:      Union[str, Any]          =   extracted_path.parts
						assert parts[-1] == hash_url_to_filename(a_,						etag=a_      )
						assert parts[-2] == extracted_subdir
						assert extracted_path.exists()
						lowerCamelCase					:      Optional[Any]          =   extracted_path.read_text()
						lowerCamelCase					:      Optional[int]          =   text_file.read_text()
						assert extracted_file_content == expected_file_content
def 		UpperCAmelCase (		a_,						a_      ):





		'''simple docstring'''


		assert path.endswith('.jsonl'      )
		for num_items, line in enumerate(a_,						start=1      ):
				lowerCamelCase					:      Union[str, Any]          =   json.loads(line.decode('utf-8'      )      )
				assert item.keys() == {"col_1", "col_2", "col_3"}
		assert num_items == 4
@pytest.mark.parametrize('archive_jsonl',						['tar_jsonl_path', 'zip_jsonl_path']      )
def 		UpperCAmelCase (		a_,						a_      ):





		'''simple docstring'''


		lowerCamelCase					:      Dict          =   request.getfixturevalue(a_      )
		lowerCamelCase					:      int          =   DownloadManager()
		for num_jsonl, (path, file) in enumerate(dl_manager.iter_archive(a_      ),						start=1      ):
				_test_jsonl(a_,						a_      )
		assert num_jsonl == 2
@pytest.mark.parametrize('archive_nested_jsonl',						['tar_nested_jsonl_path', 'zip_nested_jsonl_path']      )
def 		UpperCAmelCase (		a_,						a_      ):





		'''simple docstring'''


		lowerCamelCase					:      Optional[Any]          =   request.getfixturevalue(a_      )
		lowerCamelCase					:      Union[str, Any]          =   DownloadManager()
		for num_tar, (path, file) in enumerate(dl_manager.iter_archive(a_      ),						start=1      ):
				for num_jsonl, (subpath, subfile) in enumerate(dl_manager.iter_archive(a_      ),						start=1      ):
						_test_jsonl(a_,						a_      )
		assert num_tar == 1
		assert num_jsonl == 2





def 		UpperCAmelCase (		a_      ):





		'''simple docstring'''


		lowerCamelCase					:      List[Any]          =   DownloadManager()
		for num_file, file in enumerate(dl_manager.iter_files(a_      ),						start=1      ):
				assert os.path.basename(a_      ) == ("test.txt" if num_file == 1 else "train.txt")
		assert num_file == 2








"""simple docstring"""

def 		UpperCAmelCase (		a_      ):





		'''simple docstring'''


		lowerCamelCase					:      List[Any]          =   1
		for i in range(1,						num + 1      ):
				fact *= i
		return fact
def 		UpperCAmelCase (		a_      ):





		'''simple docstring'''


		lowerCamelCase					:      Optional[Any]          =   0
		while number > 0:
				lowerCamelCase					:      str          =   number % 10
				sum_of_digits += last_digit
				lowerCamelCase					:      Tuple          =   number // 10  # Removing the last_digit from the given number
		return sum_of_digits
def 		UpperCAmelCase (		a_ = 100      ):





		'''simple docstring'''


		lowerCamelCase					:      Optional[Any]          =   factorial(a_      )
		lowerCamelCase					:      int          =   split_and_add(a_      )
		return result


if __name__ == "__main__":
					print(solution(int(input('Enter the Number: ').strip())))






