




'''simple docstring'''





from PIL import Image


def 					UpperCamelCase_(     snake_case							:	Tuple							,    snake_case							:	Optional[int]					):

							'''simple docstring'''






							def brightness(snake_case							:	Dict					) -> float:
														return 1_2_8 + level + (c - 1_2_8)

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


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









'''simple docstring'''





from __future__ import annotations

import numpy as np


def 					UpperCamelCase_(     snake_case							:	np.ndarray					):

							'''simple docstring'''






							snake_case_ ,				snake_case_      =				np.shape(snake_case					)
							if rows != columns:
														snake_case_      =				(
														    "'table' has to be of square shaped array but got a "
														    f'{rows}x{columns} array:\n{table}'
														)
														raise ValueError(snake_case					)

							snake_case_      =				np.zeros((rows, columns)					)
							snake_case_      =				np.zeros((rows, columns)					)
							for i in range(snake_case					):
														for j in range(snake_case					):
																					snake_case_      =				sum(lower[i][k] * upper[k][j] for k in range(snake_case					)					)
																					if upper[j][j] == 0:
																												raise ArithmeticError("No LU decomposition exists"					)
																					snake_case_      =				(table[i][j] - total) / upper[j][j]
														snake_case_      =				1
														for j in range(snake_case							,    snake_case					):
																					snake_case_      =				sum(lower[i][k] * upper[k][j] for k in range(snake_case					)					)
																					snake_case_      =				table[i][j] - total
							return lower, upper


if __name__ == "__main__":
		import doctest

		doctest.testmod()




