
"""simple docstring"""



import math
def 					_UpperCAmelCase      ( __lowerCamelCase   :       int		)     ->					bool:

  if 1 < number < 4:
    # 2 and 3 are primes
    return True
  elif number < 2 or number % 2 == 0 or number % 3 == 0:
    # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
    return False

  # All primes number are in format of 6k +/- 1
  for i in range(5 ,					int(math.sqrt(__lowerCamelCase		) + 1		) ,					6		):
    if number % i == 0 or number % (i + 2) == 0:
      return False
  return True
def 					_UpperCAmelCase      ( __lowerCamelCase   :       int = 1_00_01		)     ->					int:

  try:
    _snake_case					     =       int(__lowerCamelCase		)
  except (TypeError, ValueError):
    raise TypeError('''Parameter nth must be int or castable to int.'''		) from None
  if nth <= 0:
    raise ValueError('''Parameter nth must be greater than or equal to one.'''		)
  _snake_case					     =       []
  _snake_case					     =       2
  while len(__lowerCamelCase		) < nth:
    if is_prime(__lowerCamelCase		):
      primes.append(__lowerCamelCase		)
      num += 1
    else:
      num += 1
  return primes[len(__lowerCamelCase		) - 1]


if __name__ == "__main__":
 print(F"{solution() = }")





"""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


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

class       lowerCAmelCase__				:
     __a						=					200
     __a						=					{"""Content-Length""": """100"""}
     __a						=					{}







     def      lowercase	(							self			:			List[str]    ,      **_lowerCamelCase			:			List[str]			):
       return [bytes(_lowerCamelCase    ,      '''utf-8'''			)]






def 					_UpperCAmelCase      ( *__lowerCamelCase   :       List[str] ,					**__lowerCamelCase   :       Dict		)     ->					Dict:
  return MockResponse()
@pytest.mark.parametrize('''urls_type''' ,					[str, list, dict]		)
def 					_UpperCAmelCase      ( __lowerCamelCase   :       Union[str, Any] ,					__lowerCamelCase   :       List[str] ,					__lowerCamelCase   :       str		)     ->					int:
  import requests

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

  _snake_case					     =       URL
  if issubclass(__lowerCamelCase ,					__lowerCamelCase		):
    _snake_case					     =       url
  elif issubclass(__lowerCamelCase ,					__lowerCamelCase		):
    _snake_case					     =       [url]
  elif issubclass(__lowerCamelCase ,					__lowerCamelCase		):
    _snake_case					     =       {'''train''': url}
  _snake_case					     =       '''dummy'''
  _snake_case					     =       '''downloads'''
  _snake_case					     =       tmp_path
  _snake_case					     =       DownloadConfig(
      cache_dir=os.path.join(__lowerCamelCase ,					__lowerCamelCase		) ,					use_etag=__lowerCamelCase ,					)
  _snake_case					     =       DownloadManager(dataset_name=__lowerCamelCase ,					download_config=__lowerCamelCase		)
  _snake_case					     =       dl_manager.download(__lowerCamelCase		)
  _snake_case					     =       urls
  for downloaded_paths in [downloaded_paths]:
    if isinstance(__lowerCamelCase ,					__lowerCamelCase		):
      _snake_case					     =       [downloaded_paths]
      _snake_case					     =       [urls]
    elif isinstance(__lowerCamelCase ,					__lowerCamelCase		):
      assert "train" in downloaded_paths.keys()
      _snake_case					     =       downloaded_paths.values()
      _snake_case					     =       urls.values()
    assert downloaded_paths
    for downloaded_path, input_url in zip(__lowerCamelCase ,					__lowerCamelCase		):
      assert downloaded_path == dl_manager.downloaded_paths[input_url]
      _snake_case					     =       Path(__lowerCamelCase		)
      _snake_case					     =       downloaded_path.parts
      assert parts[-1] == HASH
      assert parts[-2] == cache_subdir
      assert downloaded_path.exists()
      _snake_case					     =       downloaded_path.read_text()
      assert content == CONTENT
      _snake_case					     =       downloaded_path.with_suffix('''.json'''		)
      assert metadata_downloaded_path.exists()
      _snake_case					     =       json.loads(metadata_downloaded_path.read_text()		)
      assert metadata_content == {"url": URL, "etag": None}
@pytest.mark.parametrize('''paths_type''' ,					[str, list, dict]		)
def 					_UpperCAmelCase      ( __lowerCamelCase   :       int ,					__lowerCamelCase   :       str ,					__lowerCamelCase   :       Optional[int]		)     ->					int:
  _snake_case					     =       str(__lowerCamelCase		)
  if issubclass(__lowerCamelCase ,					__lowerCamelCase		):
    _snake_case					     =       filename
  elif issubclass(__lowerCamelCase ,					__lowerCamelCase		):
    _snake_case					     =       [filename]
  elif issubclass(__lowerCamelCase ,					__lowerCamelCase		):
    _snake_case					     =       {'''train''': filename}
  _snake_case					     =       '''dummy'''
  _snake_case					     =       xz_file.parent
  _snake_case					     =       '''extracted'''
  _snake_case					     =       DownloadConfig(
      cache_dir=__lowerCamelCase ,					use_etag=__lowerCamelCase ,					)
  _snake_case					     =       DownloadManager(dataset_name=__lowerCamelCase ,					download_config=__lowerCamelCase		)
  _snake_case					     =       dl_manager.extract(__lowerCamelCase		)
  _snake_case					     =       paths
  for extracted_paths in [extracted_paths]:
    if isinstance(__lowerCamelCase ,					__lowerCamelCase		):
      _snake_case					     =       [extracted_paths]
      _snake_case					     =       [paths]
    elif isinstance(__lowerCamelCase ,					__lowerCamelCase		):
      assert "train" in extracted_paths.keys()
      _snake_case					     =       extracted_paths.values()
      _snake_case					     =       paths.values()
    assert extracted_paths
    for extracted_path, input_path in zip(__lowerCamelCase ,					__lowerCamelCase		):
      assert extracted_path == dl_manager.extracted_paths[input_path]
      _snake_case					     =       Path(__lowerCamelCase		)
      _snake_case					     =       extracted_path.parts
      assert parts[-1] == hash_url_to_filename(__lowerCamelCase ,					etag=__lowerCamelCase		)
      assert parts[-2] == extracted_subdir
      assert extracted_path.exists()
      _snake_case					     =       extracted_path.read_text()
      _snake_case					     =       text_file.read_text()
      assert extracted_file_content == expected_file_content
def 					_UpperCAmelCase      ( __lowerCamelCase   :       Tuple ,					__lowerCamelCase   :       List[Any]		)     ->					Dict:
  assert path.endswith('''.jsonl'''		)
  for num_items, line in enumerate(__lowerCamelCase ,					start=1		):
    _snake_case					     =       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      ( __lowerCamelCase   :       Dict ,					__lowerCamelCase   :       str		)     ->					Dict:
  _snake_case					     =       request.getfixturevalue(__lowerCamelCase		)
  _snake_case					     =       DownloadManager()
  for num_jsonl, (path, file) in enumerate(dl_manager.iter_archive(__lowerCamelCase		) ,					start=1		):
    _test_jsonl(__lowerCamelCase ,					__lowerCamelCase		)
  assert num_jsonl == 2
@pytest.mark.parametrize('''archive_nested_jsonl''' ,					['''tar_nested_jsonl_path''', '''zip_nested_jsonl_path''']		)
def 					_UpperCAmelCase      ( __lowerCamelCase   :       str ,					__lowerCamelCase   :       List[Any]		)     ->					Tuple:
  _snake_case					     =       request.getfixturevalue(__lowerCamelCase		)
  _snake_case					     =       DownloadManager()
  for num_tar, (path, file) in enumerate(dl_manager.iter_archive(__lowerCamelCase		) ,					start=1		):
    for num_jsonl, (subpath, subfile) in enumerate(dl_manager.iter_archive(__lowerCamelCase		) ,					start=1		):
      _test_jsonl(__lowerCamelCase ,					__lowerCamelCase		)
  assert num_tar == 1
  assert num_jsonl == 2

def 					_UpperCAmelCase      ( __lowerCamelCase   :       Tuple		)     ->					List[Any]:
  _snake_case					     =       DownloadManager()
  for num_file, file in enumerate(dl_manager.iter_files(__lowerCamelCase		) ,					start=1		):
    assert os.path.basename(__lowerCamelCase		) == ("test.txt" if num_file == 1 else "train.txt")
  assert num_file == 2



