


from __future__ import annotations





def __UpperCAmelCase       (		__A ,						__A			)						->					list[str]:



       '''simple docstring'''





       if partitions <= 0:
              raise ValueError("partitions must be a positive number!"			)
       if partitions > number_of_bytes:
              raise ValueError("partitions can not > number_of_bytes!"			)
       UpperCAmelCase__										=     number_of_bytes // partitions
       UpperCAmelCase__										=     []
       for i in range(__A			):
              UpperCAmelCase__										=     i * bytes_per_partition + 1
              UpperCAmelCase__										=     (
                  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()









from .imports import is_tqdm_available


if is_tqdm_available():
    from tqdm.auto import tqdm as _tqdm

from ..state import PartialState





def __UpperCAmelCase       (		__A = True ,						*__A ,						**__A			)						->					Any:



       '''simple docstring'''





       if not is_tqdm_available():
              raise ImportError("Accelerate's `tqdm` module requires `tqdm` to be installed. Please run `pip install tqdm`."			)
       UpperCAmelCase__										=     False
       if main_process_only:
              UpperCAmelCase__										=     PartialState().local_process_index == 0
       return _tqdm(*__A ,						**__A ,						disable=__A			)





