
"""simple docstring"""


import contextlib
import csv
import json
import os
import sqlitea
import tarfile
import textwrap
import zipfile

import pyarrow as pa
import pyarrow.parquet as pq
import pytest

import datasets
import datasets.config






@pytest.fixture(scope='''session'''						)
def  lowercase						(	):
			lowerCamelCase_					=  10
			lowerCamelCase_					=  datasets.Features(
			    {
			        '''tokens''': datasets.Sequence(datasets.Value('''string'''						)						),
			        '''labels''': datasets.Sequence(datasets.ClassLabel(names=['''negative''', '''positive''']						)						),
			        '''answers''': datasets.Sequence(
			            {
			                '''text''': datasets.Value('''string'''						),
			                '''answer_start''': datasets.Value('''int32'''						),
			            }						),
			        '''id''': datasets.Value('''int64'''						),
			    }						)
			lowerCamelCase_					=  datasets.Dataset.from_dict(
			    {
			        '''tokens''': [['''foo'''] * 5] * n,
			        '''labels''': [[1] * 5] * n,
			        '''answers''': [{'''answer_start''': [97], '''text''': ['''1976''']}] * 10,
			        '''id''': list(range(lowerCAmelCase__						)						),
			    }	,features=lowerCAmelCase__	,)
			return dataset






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__						):
			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''file.arrow'''						)
			dataset.map(cache_file_name=lowerCAmelCase__						)
			return filename


# FILE_CONTENT + files


A_    							=					"\\n    Text data.\n    Second line of data."






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """file.txt"""
			lowerCamelCase_					=  FILE_CONTENT
			with open(lowerCAmelCase__	,'''w'''						) as f:
						f.write(lowerCAmelCase__						)
			return filename






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			import bza

			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """file.txt.bz2"""
			lowerCamelCase_					=  bytes(lowerCAmelCase__	,'''utf-8'''						)
			with bza.open(lowerCAmelCase__	,'''wb'''						) as f:
						f.write(lowerCAmelCase__						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			import gzip

			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''file.txt.gz'''						)
			lowerCamelCase_					=  bytes(lowerCAmelCase__	,'''utf-8'''						)
			with gzip.open(lowerCAmelCase__	,'''wb'''						) as f:
						f.write(lowerCAmelCase__						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			if datasets.config.LZ4_AVAILABLE:
						import lza.frame

						lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """file.txt.lz4"""
						lowerCamelCase_					=  bytes(lowerCAmelCase__	,'''utf-8'''						)
						with lza.frame.open(lowerCAmelCase__	,'''wb'''						) as f:
									f.write(lowerCAmelCase__						)
						return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__						):
			if datasets.config.PY7ZR_AVAILABLE:
						import pyazr

						lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """file.txt.7z"""
						with pyazr.SevenZipFile(lowerCAmelCase__	,'''w'''						) as archive:
									archive.write(lowerCAmelCase__	,arcname=os.path.basename(lowerCAmelCase__						)						)
						return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__						):
			import tarfile

			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """file.txt.tar"""
			with tarfile.TarFile(lowerCAmelCase__	,'''w'''						) as f:
						f.add(lowerCAmelCase__	,arcname=os.path.basename(lowerCAmelCase__						)						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			import lzma

			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """file.txt.xz"""
			lowerCamelCase_					=  bytes(lowerCAmelCase__	,'''utf-8'''						)
			with lzma.open(lowerCAmelCase__	,'''wb'''						) as f:
						f.write(lowerCAmelCase__						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__						):
			import zipfile

			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """file.txt.zip"""
			with zipfile.ZipFile(lowerCAmelCase__	,'''w'''						) as f:
						f.write(lowerCAmelCase__	,arcname=os.path.basename(lowerCAmelCase__						)						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			if datasets.config.ZSTANDARD_AVAILABLE:
						import zstandard as zstd

						lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """file.txt.zst"""
						lowerCamelCase_					=  bytes(lowerCAmelCase__	,'''utf-8'''						)
						with zstd.open(lowerCAmelCase__	,'''wb'''						) as f:
									f.write(lowerCAmelCase__						)
						return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """file.xml"""
			lowerCamelCase_					=  textwrap.dedent(
			    '''\
    <?xml version=\"1.0\" encoding=\"UTF-8\" ?>
    <tmx version=\"1.4\">
      <header segtype=\"sentence\" srclang=\"ca\" />
      <body>
        <tu>
          <tuv xml:lang=\"ca\"><seg>Contingut 1</seg></tuv>
          <tuv xml:lang=\"en\"><seg>Content 1</seg></tuv>
        </tu>
        <tu>
          <tuv xml:lang=\"ca\"><seg>Contingut 2</seg></tuv>
          <tuv xml:lang=\"en\"><seg>Content 2</seg></tuv>
        </tu>
        <tu>
          <tuv xml:lang=\"ca\"><seg>Contingut 3</seg></tuv>
          <tuv xml:lang=\"en\"><seg>Content 3</seg></tuv>
        </tu>
        <tu>
          <tuv xml:lang=\"ca\"><seg>Contingut 4</seg></tuv>
          <tuv xml:lang=\"en\"><seg>Content 4</seg></tuv>
        </tu>
        <tu>
          <tuv xml:lang=\"ca\"><seg>Contingut 5</seg></tuv>
          <tuv xml:lang=\"en\"><seg>Content 5</seg></tuv>
        </tu>
      </body>
    </tmx>'''						)
			with open(lowerCAmelCase__	,'''w'''						) as f:
						f.write(lowerCAmelCase__						)
			return filename


A_    							=					[
    {"col_1": "0", "col_2": 0, "col_3": 0.0},
    {"col_1": "1", "col_2": 1, "col_3": 1.0},
    {"col_1": "2", "col_2": 2, "col_3": 2.0},
    {"col_1": "3", "col_2": 3, "col_3": 3.0},
]
A_    							=					[
    {"col_1": "4", "col_2": 4, "col_3": 4.0},
    {"col_1": "5", "col_2": 5, "col_3": 5.0},
]
A_    							=					{
    "col_1": ["0", "1", "2", "3"],
    "col_2": [0, 1, 2, 3],
    "col_3": [0.0, 1.0, 2.0, 3.0],
}

A_    							=					[
    {"col_3": 0.0, "col_1": "0", "col_2": 0},
    {"col_3": 1.0, "col_1": "1", "col_2": 1},
]

A_    							=					[
    {"col_1": "s0", "col_2": 0, "col_3": 0.0},
    {"col_1": "s1", "col_2": 1, "col_3": 1.0},
    {"col_1": "s2", "col_2": 2, "col_3": 2.0},
    {"col_1": "s3", "col_2": 3, "col_3": 3.0},
]






@pytest.fixture(scope='''session'''						)
def  lowercase						(	):
			return DATA_DICT_OF_LISTS






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  datasets.Dataset.from_dict(lowerCAmelCase__						)
			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset.arrow'''						)
			dataset.map(cache_file_name=lowerCAmelCase__						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset.sqlite'''						)
			with contextlib.closing(sqlitea.connect(lowerCAmelCase__						)						) as con:
						lowerCamelCase_					=  con.cursor()
						cur.execute('''CREATE TABLE dataset(col_1 text, col_2 int, col_3 real)'''						)
						for item in DATA:
									cur.execute('''INSERT INTO dataset(col_1, col_2, col_3) VALUES (?, ?, ?)'''	,tuple(item.values()						)						)
						con.commit()
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset.csv'''						)
			with open(lowerCAmelCase__	,'''w'''	,newline=''''''						) as f:
						lowerCamelCase_					=  csv.DictWriter(lowerCAmelCase__	,fieldnames=['''col_1''', '''col_2''', '''col_3''']						)
						writer.writeheader()
						for item in DATA:
									writer.writerow(lowerCAmelCase__						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset2.csv'''						)
			with open(lowerCAmelCase__	,'''w'''	,newline=''''''						) as f:
						lowerCamelCase_					=  csv.DictWriter(lowerCAmelCase__	,fieldnames=['''col_1''', '''col_2''', '''col_3''']						)
						writer.writeheader()
						for item in DATA:
									writer.writerow(lowerCAmelCase__						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__						):
			import bza

			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """dataset.csv.bz2"""
			with open(lowerCAmelCase__	,'''rb'''						) as f:
						lowerCamelCase_					=  f.read()
			# data = bytes(FILE_CONTENT, "utf-8")
			with bza.open(lowerCAmelCase__	,'''wb'''						) as f:
						f.write(lowerCAmelCase__						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__	,lowerCAmelCase__						):
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """dataset.csv.zip"""
			with zipfile.ZipFile(lowerCAmelCase__	,'''w'''						) as f:
						f.write(lowerCAmelCase__	,arcname=os.path.basename(lowerCAmelCase__						)						)
						f.write(lowerCAmelCase__	,arcname=os.path.basename(lowerCAmelCase__						)						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__	,lowerCAmelCase__						):
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """dataset.csv.zip"""
			with zipfile.ZipFile(lowerCAmelCase__	,'''w'''						) as f:
						f.write(lowerCAmelCase__	,arcname=os.path.basename(csv_path.replace('''.csv'''	,'''.CSV'''						)						)						)
						f.write(lowerCAmelCase__	,arcname=os.path.basename(csva_path.replace('''.csv'''	,'''.CSV'''						)						)						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__	,lowerCAmelCase__						):
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """dataset_with_dir.csv.zip"""
			with zipfile.ZipFile(lowerCAmelCase__	,'''w'''						) as f:
						f.write(lowerCAmelCase__	,arcname=os.path.join('''main_dir'''	,os.path.basename(lowerCAmelCase__						)						)						)
						f.write(lowerCAmelCase__	,arcname=os.path.join('''main_dir'''	,os.path.basename(lowerCAmelCase__						)						)						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset.parquet'''						)
			lowerCamelCase_					=  pa.schema(
			    {
			        '''col_1''': pa.string(),
			        '''col_2''': pa.intaa(),
			        '''col_3''': pa.floataa(),
			    }						)
			with open(lowerCAmelCase__	,'''wb'''						) as f:
						lowerCamelCase_					=  pq.ParquetWriter(lowerCAmelCase__	,schema=lowerCAmelCase__						)
						lowerCamelCase_					=  pa.Table.from_pydict({k: [DATA[i][k] for i in range(len(lowerCAmelCase__						)						)] for k in DATA[0]}	,schema=lowerCAmelCase__						)
						writer.write_table(lowerCAmelCase__						)
						writer.close()
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset.json'''						)
			lowerCamelCase_					=  {"""data""": DATA}
			with open(lowerCAmelCase__	,'''w'''						) as f:
						json.dump(lowerCAmelCase__	,lowerCAmelCase__						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset.json'''						)
			lowerCamelCase_					=  {"""data""": DATA_DICT_OF_LISTS}
			with open(lowerCAmelCase__	,'''w'''						) as f:
						json.dump(lowerCAmelCase__	,lowerCAmelCase__						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset.jsonl'''						)
			with open(lowerCAmelCase__	,'''w'''						) as f:
						for item in DATA:
									f.write(json.dumps(lowerCAmelCase__						) + '''\n'''						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset2.jsonl'''						)
			with open(lowerCAmelCase__	,'''w'''						) as f:
						for item in DATA:
									f.write(json.dumps(lowerCAmelCase__						) + '''\n'''						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset_312.jsonl'''						)
			with open(lowerCAmelCase__	,'''w'''						) as f:
						for item in DATA_312:
									f.write(json.dumps(lowerCAmelCase__						) + '''\n'''						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset-str.jsonl'''						)
			with open(lowerCAmelCase__	,'''w'''						) as f:
						for item in DATA_STR:
									f.write(json.dumps(lowerCAmelCase__						) + '''\n'''						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__						):
			import gzip

			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset.txt.gz'''						)
			with open(lowerCAmelCase__	,'''rb'''						) as orig_file:
						with gzip.open(lowerCAmelCase__	,'''wb'''						) as zipped_file:
									zipped_file.writelines(lowerCAmelCase__						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__						):
			import gzip

			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset.jsonl.gz'''						)
			with open(lowerCAmelCase__	,'''rb'''						) as orig_file:
						with gzip.open(lowerCAmelCase__	,'''wb'''						) as zipped_file:
									zipped_file.writelines(lowerCAmelCase__						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__	,lowerCAmelCase__						):
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """dataset.jsonl.zip"""
			with zipfile.ZipFile(lowerCAmelCase__	,'''w'''						) as f:
						f.write(lowerCAmelCase__	,arcname=os.path.basename(lowerCAmelCase__						)						)
						f.write(lowerCAmelCase__	,arcname=os.path.basename(lowerCAmelCase__						)						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__	,lowerCAmelCase__	,lowerCAmelCase__						):
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """dataset_nested.jsonl.zip"""
			with zipfile.ZipFile(lowerCAmelCase__	,'''w'''						) as f:
						f.write(lowerCAmelCase__	,arcname=os.path.join('''nested'''	,os.path.basename(lowerCAmelCase__						)						)						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__	,lowerCAmelCase__						):
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """dataset_with_dir.jsonl.zip"""
			with zipfile.ZipFile(lowerCAmelCase__	,'''w'''						) as f:
						f.write(lowerCAmelCase__	,arcname=os.path.join('''main_dir'''	,os.path.basename(lowerCAmelCase__						)						)						)
						f.write(lowerCAmelCase__	,arcname=os.path.join('''main_dir'''	,os.path.basename(lowerCAmelCase__						)						)						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__	,lowerCAmelCase__						):
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """dataset.jsonl.tar"""
			with tarfile.TarFile(lowerCAmelCase__	,'''w'''						) as f:
						f.add(lowerCAmelCase__	,arcname=os.path.basename(lowerCAmelCase__						)						)
						f.add(lowerCAmelCase__	,arcname=os.path.basename(lowerCAmelCase__						)						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__	,lowerCAmelCase__	,lowerCAmelCase__						):
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """dataset_nested.jsonl.tar"""
			with tarfile.TarFile(lowerCAmelCase__	,'''w'''						) as f:
						f.add(lowerCAmelCase__	,arcname=os.path.join('''nested'''	,os.path.basename(lowerCAmelCase__						)						)						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  ["""0""", """1""", """2""", """3"""]
			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset.txt'''						)
			with open(lowerCAmelCase__	,'''w'''						) as f:
						for item in data:
									f.write(item + '''\n'''						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  ["""0""", """1""", """2""", """3"""]
			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset2.txt'''						)
			with open(lowerCAmelCase__	,'''w'''						) as f:
						for item in data:
									f.write(item + '''\n'''						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  ["""0""", """1""", """2""", """3"""]
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """dataset.abc"""
			with open(lowerCAmelCase__	,'''w'''						) as f:
						for item in data:
									f.write(item + '''\n'''						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__	,lowerCAmelCase__						):
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """dataset.text.zip"""
			with zipfile.ZipFile(lowerCAmelCase__	,'''w'''						) as f:
						f.write(lowerCAmelCase__	,arcname=os.path.basename(lowerCAmelCase__						)						)
						f.write(lowerCAmelCase__	,arcname=os.path.basename(lowerCAmelCase__						)						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__	,lowerCAmelCase__						):
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """dataset_with_dir.text.zip"""
			with zipfile.ZipFile(lowerCAmelCase__	,'''w'''						) as f:
						f.write(lowerCAmelCase__	,arcname=os.path.join('''main_dir'''	,os.path.basename(lowerCAmelCase__						)						)						)
						f.write(lowerCAmelCase__	,arcname=os.path.join('''main_dir'''	,os.path.basename(lowerCAmelCase__						)						)						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__	,lowerCAmelCase__						):
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """dataset.ext.zip"""
			with zipfile.ZipFile(lowerCAmelCase__	,'''w'''						) as f:
						f.write(lowerCAmelCase__	,arcname=os.path.basename('''unsupported.ext'''						)						)
						f.write(lowerCAmelCase__	,arcname=os.path.basename('''unsupported_2.ext'''						)						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  """\n""".join(['''First''', '''Second\u2029with Unicode new line''', '''Third''']						)
			lowerCamelCase_					=  str(tmp_path_factory.mktemp('''data'''						) / '''dataset_with_unicode_new_lines.txt'''						)
			with open(lowerCAmelCase__	,'''w'''	,encoding='''utf-8'''						) as f:
						f.write(lowerCAmelCase__						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	):
			return os.path.join('''tests'''	,'''features'''	,'''data'''	,'''test_image_rgb.jpg'''						)






@pytest.fixture(scope='''session'''						)
def  lowercase						(	):
			return os.path.join('''tests'''	,'''features'''	,'''data'''	,'''test_audio_44100.wav'''						)






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__						):
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data'''						) / """dataset.img.zip"""
			with zipfile.ZipFile(lowerCAmelCase__	,'''w'''						) as f:
						f.write(lowerCAmelCase__	,arcname=os.path.basename(lowerCAmelCase__						)						)
						f.write(lowerCAmelCase__	,arcname=os.path.basename(lowerCAmelCase__						).replace('''.jpg'''	,'''2.jpg'''						)						)
			return path






@pytest.fixture(scope='''session'''						)
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  tmp_path_factory.mktemp('''data_dir'''						)

			(data_dir / "subdir").mkdir()
			with open(data_dir / '''subdir''' / '''train.txt'''	,'''w'''						) as f:
						f.write('''foo\n''' * 10						)
			with open(data_dir / '''subdir''' / '''test.txt'''	,'''w'''						) as f:
						f.write('''bar\n''' * 10						)
			# hidden file
			with open(data_dir / '''subdir''' / '''.test.txt'''	,'''w'''						) as f:
						f.write('''bar\n''' * 10						)

			# hidden directory
			(data_dir / ".subdir").mkdir()
			with open(data_dir / '''.subdir''' / '''train.txt'''	,'''w'''						) as f:
						f.write('''foo\n''' * 10						)
			with open(data_dir / '''.subdir''' / '''test.txt'''	,'''w'''						) as f:
						f.write('''bar\n''' * 10						)

			return data_dir









UpperCAmelCase_		:					int          =  range(2, 20 + 1)
UpperCAmelCase_		:					Tuple          =  [10**k for k in range(ks[-1] + 1)]
UpperCAmelCase_		:					dict[int, dict[int, list[list[int]]]]          =  {}




def 		lowerCAmelCase_ (						lowerCamelCase						,  lowerCamelCase						,  lowerCamelCase						,  lowerCamelCase ):
				__magic_name__						:						Union[str, Any]										=sum(a_i[j] for j in range(lowerCamelCase						,  len(lowerCamelCase ) ) )
				__magic_name__						:						Any										=sum(a_i[j] * base[j] for j in range(min(len(lowerCamelCase )						,  lowerCamelCase ) ) )

				__magic_name__					,			__magic_name__						:						Tuple										=0, 0
				__magic_name__						:						Optional[Any]										=n - i

				__magic_name__						:						Union[str, Any]										=memo.get(lowerCamelCase )

				if sub_memo is not None:
								__magic_name__						:						int										=sub_memo.get(lowerCamelCase )

								if jumps is not None and len(lowerCamelCase ) > 0:
												# find and make the largest jump without going over
												__magic_name__						:						Dict										=-1
												for _k in range(len(lowerCamelCase ) - 1						,  -1						,  -1 ):
																if jumps[_k][2] <= k and jumps[_k][1] <= max_dn:
																				__magic_name__						:						Optional[Any]										=_k
																				break

												if max_jump >= 0:
																__magic_name__					,			__magic_name__					,			__magic_name__						:						Optional[int]										=jumps[max_jump]
																# since the difference between jumps is cached, add c
																__magic_name__						:						Tuple										=diff + c
																for j in range(min(lowerCamelCase						,  len(lowerCamelCase ) ) ):
																				__magic_name__					,			__magic_name__						:						Tuple										=divmod(lowerCamelCase						,  10 )
																if new_c > 0:
																				add(lowerCamelCase						,  lowerCamelCase						,  lowerCamelCase )

								else:
												__magic_name__						:						str										=[]
				else:
								__magic_name__						:						List[str]										={c: []}
								__magic_name__						:						List[str]										=sub_memo

				if dn >= max_dn or c + diff >= base[k]:
								return diff, dn

				if k > ks[0]:
								while True:
												# keep doing smaller jumps
												__magic_name__					,			__magic_name__						:						Union[str, Any]										=next_term(lowerCamelCase						,  k - 1						,  i + dn						,  lowerCamelCase )
												diff += _diff
												dn += terms_jumped

												if dn >= max_dn or c + diff >= base[k]:
																break
				else:
								# would be too small a jump, just compute sequential terms instead
								__magic_name__					,			__magic_name__						:						Optional[int]										=compute(lowerCamelCase						,  lowerCamelCase						,  i + dn						,  lowerCamelCase )
								diff += _diff
								dn += terms_jumped

				__magic_name__						:						Tuple										=sub_memo[c]

				# keep jumps sorted by # of terms skipped
				__magic_name__						:						List[Any]										=0
				while j < len(lowerCamelCase ):
								if jumps[j][1] > dn:
												break
								j += 1

				# cache the jump for this value digitsum(b) and c
				sub_memo[c].insert(lowerCamelCase						,  (diff, dn, k) )
				return (diff, dn)




def 		lowerCAmelCase_ (						lowerCamelCase						,  lowerCamelCase						,  lowerCamelCase						,  lowerCamelCase ):
				if i >= n:
								return 0, i
				if k > len(lowerCamelCase ):
								a_i.extend([0 for _ in range(k - len(lowerCamelCase ) )] )

				# note: a_i -> b * 10^k + c
				# ds_b -> digitsum(b)
				# ds_c -> digitsum(c)
				__magic_name__						:						Tuple										=i
				__magic_name__					,			__magic_name__					,			__magic_name__						:						Tuple										=0, 0, 0
				for j in range(len(lowerCamelCase ) ):
								if j >= k:
												ds_b += a_i[j]
								else:
												ds_c += a_i[j]

				while i < n:
								i += 1
								__magic_name__						:						Optional[Any]										=ds_c + ds_b
								diff += addend
								__magic_name__						:						str										=0
								for j in range(lowerCamelCase ):
												__magic_name__						:						int										=a_i[j] + addend
												__magic_name__					,			__magic_name__						:						Any										=divmod(lowerCamelCase						,  10 )

												ds_c += a_i[j]

								if addend > 0:
												break

				if addend > 0:
								add(lowerCamelCase						,  lowerCamelCase						,  lowerCamelCase )
				return diff, i - start_i




def 		lowerCAmelCase_ (						lowerCamelCase						,  lowerCamelCase						,  lowerCamelCase ):
				for j in range(lowerCamelCase						,  len(lowerCamelCase ) ):
								__magic_name__						:						Tuple										=digits[j] + addend
								if s >= 10:
												__magic_name__					,			__magic_name__						:						int										=divmod(lowerCamelCase						,  10 )
												__magic_name__						:						int										=addend // 10 + quotient
								else:
												__magic_name__						:						Dict										=s
												__magic_name__						:						Any										=addend // 10

								if addend == 0:
												break

				while addend > 0:
								__magic_name__					,			__magic_name__						:						Union[str, Any]										=divmod(lowerCamelCase						,  10 )
								digits.append(lowerCamelCase )




def 		lowerCAmelCase_ (						lowerCamelCase = 10**15 ):
				__magic_name__						:						List[str]										=[1]
				__magic_name__						:						str										=1
				__magic_name__						:						str										=0
				while True:
								__magic_name__					,			__magic_name__						:						List[str]										=next_term(lowerCamelCase						,  20						,  i + dn						,  lowerCamelCase )
								dn += terms_jumped
								if dn == n - i:
												break

				__magic_name__						:						int										=0
				for j in range(len(lowerCamelCase ) ):
								a_n += digits[j] * 10**j
				return a_n


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




