




'''simple docstring'''






import pytest

from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs

@pytest.mark.parametrize(
    "kwargs, expected"					,      [
        ({"num_shards": 0, "max_num_jobs": 1}, []),
        ({"num_shards": 10, "max_num_jobs": 1}, [range(10						)]),
        ({"num_shards": 10, "max_num_jobs": 10}, [range(UpperCamelCase__					,      i + 1						) for i in range(10						)]),
        ({"num_shards": 1, "max_num_jobs": 10}, [range(1						)]),
        ({"num_shards": 10, "max_num_jobs": 3}, [range(0					,      4						), range(4					,      7						), range(7					,      10						)]),
        ({"num_shards": 3, "max_num_jobs": 10}, [range(0					,      1						), range(1					,      2						), range(2					,      3						)]),
    ]					,      )
def 			__lowerCAmelCase					(    snake_case__					,      snake_case__						):
			__UpperCamelCase      :			List[str]									=   _distribute_shards(**UpperCamelCase__						)
			assert out == expected

@pytest.mark.parametrize(
    "gen_kwargs, max_num_jobs, expected"					,      [
        ({"foo": 0}, 10, [{"foo": 0}]),
        ({"shards": [0, 1, 2, 3]}, 1, [{"shards": [0, 1, 2, 3]}]),
        ({"shards": [0, 1, 2, 3]}, 4, [{"shards": [0]}, {"shards": [1]}, {"shards": [2]}, {"shards": [3]}]),
        ({"shards": [0, 1]}, 4, [{"shards": [0]}, {"shards": [1]}]),
        ({"shards": [0, 1, 2, 3]}, 2, [{"shards": [0, 1]}, {"shards": [2, 3]}]),
    ]					,      )
def 			__lowerCAmelCase					(    snake_case__					,      snake_case__					,      snake_case__						):
			__UpperCamelCase      :			Union[str, Any]									=   _split_gen_kwargs(UpperCamelCase__					,      UpperCamelCase__						)
			assert out == expected




@pytest.mark.parametrize(
    "gen_kwargs, expected"					,      [
        ({"foo": 0}, 1),
        ({"shards": [0]}, 1),
        ({"shards": [0, 1, 2, 3]}, 4),
        ({"shards": [0, 1, 2, 3], "foo": 0}, 4),
        ({"shards": [0, 1, 2, 3], "other": (0, 1)}, 4),
        ({"shards": [0, 1, 2, 3], "shards2": [0, 1]}, RuntimeError),
    ]					,      )
def 			__lowerCAmelCase					(    snake_case__					,      snake_case__						):

			if expected is RuntimeError:
						with pytest.raises(UpperCamelCase__						):
									_number_of_shards_in_gen_kwargs(UpperCamelCase__						)
			else:
						__UpperCamelCase      :			Dict									=   _number_of_shards_in_gen_kwargs(UpperCamelCase__						)
						assert out == expected










from datetime import datetime

import requests





def 						__SCREAMING_SNAKE_CASE  (				UpperCamelCase__ )  ->				bytes:







			'''simple docstring'''

			UpperCAmelCase   		=				'''https://downloadgram.net/wp-json/wppress/video-downloader/video?url='''
			UpperCAmelCase   		=				requests.get(base_url + url ).json()[0]['''urls'''][0]['''src''']
			return requests.get(UpperCamelCase__ ).content


if __name__ == "__main__":
				__A				:    Union[str, Any]       =   input("Enter Video/IGTV url: ").strip()
				__A				:    Tuple       =   F'{datetime.now():%Y-%m-%d_%H:%M:%S}.mp4'
				with open(file_name, "wb") as fp:
								fp.write(download_video(url))
				print(F'Done. Video saved to disk as {file_name}.')



