




from PIL import Image




def 						SCREAMING_SNAKE_CASE__ (   lowercase						,lowercase					)  ->       Image:
   snake_case				:    List[str]           =	(259 * (level + 255)) / (255 * (259 - level))

   def contrast(lowercase					) -> int:
      return int(128 + factor * (c - 128)					)

   return img.point(lowercase					)


if __name__ == "__main__":
       # Load image
       with Image.open('image_data/lena.jpg') as img:
              # Change contrast to 170
              lowerCamelCase	:	Dict				=   change_contrast(img, 1_7_0)
              cont_img.save('image_data/lena_high_contrast.png', format='png')











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"""					)





