




from __future__ import annotations




def 						SCREAMING_SNAKE_CASE__ (   lowercase						,lowercase					)  ->       list[str]:





   if partitions <= 0:
      raise ValueError("""partitions must be a positive number!"""					)
   if partitions > number_of_bytes:
      raise ValueError("""partitions can not > number_of_bytes!"""					)
   snake_case				:    Optional[int]           =	number_of_bytes // partitions
   snake_case				:    Any           =	[]
   for i in range(lowercase__					):
      snake_case				:    List[str]           =	i * bytes_per_partition + 1
      snake_case				:    Optional[int]           =	(
          number_of_bytes if i == partitions - 1 else (i + 1) * bytes_per_partition
      )
      allocation_list.append(f"""{start_bytes}-{end_bytes}"""					)
   return allocation_list


if __name__ == "__main__":
       import doctest

       doctest.testmod()











import pytest
import requests

from datasets.utils.file_utils import http_head

from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline




@pytest.mark.integration
def 						SCREAMING_SNAKE_CASE__ (   )  ->       List[Any]:
   with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT					):
      with pytest.raises(lowercase					):
         requests.request("""GET"""						,"""https://huggingface.co"""					)
      with pytest.raises(requests.exceptions.ConnectTimeout					):
         requests.request("""GET"""						,"""https://huggingface.co"""						,timeout=1.0					)




@pytest.mark.integration
def 						SCREAMING_SNAKE_CASE__ (   )  ->       Any:
   with offline(OfflineSimulationMode.CONNECTION_FAILS					):
      with pytest.raises(requests.exceptions.ConnectionError					):
         requests.request("""GET"""						,"""https://huggingface.co"""					)




def 						SCREAMING_SNAKE_CASE__ (   )  ->       int:
   with offline(OfflineSimulationMode.HF_DATASETS_OFFLINE_SET_TO_1					):
      with pytest.raises(lowercase					):
         http_head("""https://huggingface.co"""					)





