code: 
  
  
  
  
  
  '''simple docstring'''
  
  
  
  
  import numpy as np
  from cva import destroyAllWindows, imread, imshow, waitKey
  
  
  
  
  
  
  class 							__snake_case    :
  
  
  
  
  
  	def __init__(		self			,					UpperCamelCase_			,					UpperCamelCase_		)			->		List[str]:
  		snake_case__  					=      0
  		# max greyscale value for #FFFFFF
  		snake_case__  					=      int(self.get_greyscale(255			,					255			,					255		)		)
  
  		if not self.min_threshold < threshold < self.max_threshold:
  			snake_case__  					=      F'''Factor value should be from 0 to {self.max_threshold}'''
  			raise ValueError(UpperCamelCase_		)
  
  		snake_case__  					=      input_img
  		snake_case__  					=      threshold
  		snake_case__					,     snake_case__  					=      self.input_img.shape[1], self.input_img.shape[0]
  
  		# error table size (+4 columns and +1 row) greater than input image because of
  		# lack of if statements
  		snake_case__  					=      [
  		    [0 for _ in range(self.height + 4		)] for __ in range(self.width + 1		)
  		]
  		snake_case__  					=      np.ones((self.width, self.height, 3)			,					np.uinta		) * 255
  
  
  
  
  
  	@classmethod
  	def      _snake_case      (		cls			,					UpperCamelCase_			,					UpperCamelCase_			,					UpperCamelCase_		)			->		float:
  		return 0.1_1_4 * blue + 0.5_8_7 * green + 0.2_1_2_6 * red
  
  
  
  
  
  	def      _snake_case      (		self		)			->		None:
  		for y in range(self.height		):
  			for x in range(self.width		):
  				snake_case__  					=      int(self.get_greyscale(*self.input_img[y][x]		)		)
  				if self.threshold > greyscale + self.error_table[y][x]:
  					snake_case__  					=      (0, 0, 0)
  					snake_case__  					=      greyscale + self.error_table[x][y]
  				else:
  					snake_case__  					=      (255, 255, 255)
  					snake_case__  					=      greyscale + self.error_table[x][y] - 255
  				self.error_table[y][x + 1] += int(8 / 32 * current_error		)
  				self.error_table[y][x + 2] += int(4 / 32 * current_error		)
  				self.error_table[y + 1][x] += int(8 / 32 * current_error		)
  				self.error_table[y + 1][x + 1] += int(4 / 32 * current_error		)
  				self.error_table[y + 1][x + 2] += int(2 / 32 * current_error		)
  				self.error_table[y + 1][x - 1] += int(4 / 32 * current_error		)
  				self.error_table[y + 1][x - 2] += int(2 / 32 * current_error		)
  
  
  if __name__ == "__main__":
  			# create Burke's instances with original images in greyscale
  			a__				: Union[str, Any]									=    [
  			    Burkes(imread('''image_data/lena.jpg''', 1), threshold)
  			    for threshold in (1, 126, 130, 140)
  			]
  
  			for burkes in burkes_instances:
  						burkes.process()
  
  			for burkes in burkes_instances:
  						imshow(
  						    f"""Original image with dithering threshold: {burkes.threshold}""",
  						    burkes.output_img,
  						)
  
  			waitKey(0)
  			destroyAllWindows()
  
  
  
  
style_context: 
  
  
  
  
  
  '''simple docstring'''
  
  
  
  
  def 	__lowerCamelCase (  UpperCAmelCase_       )      ->str:
  	snake_case__  					=      len(UpperCAmelCase_       )
  	for i in range(length - 1       ):
  		snake_case__  					=      False
  		for j in range(length - 1 - i       ):
  			if collection[j] > collection[j + 1]:
  				snake_case__  					=      True
  				snake_case__					,     snake_case__  					=      collection[j + 1], collection[j]
  		if not swapped:
  			break  # Stop iteration if the collection is sorted.
  	return collection
  
  
  if __name__ == "__main__":
  			import doctest
  			import time
  
  			doctest.testmod()
  
  			a__				: Dict									=    input('''Enter numbers separated by a comma:''').strip()
  			a__				: Dict									=    [int(item) for item in user_input.split(''',''')]
  			a__				: Tuple									=    time.process_time()
  			print(*bubble_sort(unsorted), sep=''',''')
  			print(f"""Processing time: {(time.process_time() - start)%1e9 + 7}""")
  
  
  
  