





import pytest
import requests

from datasets.utils.file_utils import http_head

from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline





@pytest.mark.integration
def        __lowercase       (				)			->       Optional[Any]:


      '''simple docstring'''


      with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT     ):
            with pytest.raises(lowerCAmelCase__     ):
                  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        __lowercase       (				)			->       Any:


      '''simple docstring'''


      with offline(OfflineSimulationMode.CONNECTION_FAILS     ):
            with pytest.raises(requests.exceptions.ConnectionError     ):
                  requests.request("""GET"""			,						"""https://huggingface.co"""     )





def        __lowercase       (				)			->       Dict:


      '''simple docstring'''


      with offline(OfflineSimulationMode.HF_DATASETS_OFFLINE_SET_TO_1     ):
            with pytest.raises(lowerCAmelCase__     ):
                  http_head("""https://huggingface.co"""     )









from PIL import Image



def        __lowercase       (				_SCREAMING_SNAKE_CASE			,						_SCREAMING_SNAKE_CASE     )			->       Image:


      '''simple docstring'''


      def brightness(_SCREAMING_SNAKE_CASE     ) -> float:
            return 1_28 + level + (c - 1_28)

      if not -255.0 <= level <= 255.0:
            raise ValueError("""level must be between -255.0 (black) and 255.0 (white)"""     )
      return img.point(_SCREAMING_SNAKE_CASE     )


if __name__ == "__main__":
      # Load image
      with Image.open("""image_data/lena.jpg""") as img:
            # Change brightness to 100
            SCREAMING_SNAKE_CASE_						       =	change_brightness(img, 1_0_0)
            brigt_img.save("""image_data/lena_brightness.png""", format="""png""")


