



'''simple docstring'''

import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
				import torch

if is_vision_available():
				from PIL import Image

				from transformers import OwlViTImageProcessor

class __snake_case(      unittest.TestCase					):


						'''simple docstring'''



						def __init__(					self	,       A_	,       A_=7	,       A_=3	,       A_=18	,       A_=30	,       A_=400	,       A_=True	,       A_=None	,       A_=True	,       A_=None	,       A_=True	,       A_=[0.4_8_1_4_5_4_6_6, 0.4_5_7_8_2_7_5, 0.4_0_8_2_1_0_7_3]	,       A_=[0.2_6_8_6_2_9_5_4, 0.2_6_1_3_0_2_5_8, 0.2_7_5_7_7_7_1_1]	,       A_=True	,       )	->	Optional[Any]:
							lowerCAmelCase    =	parent
							lowerCAmelCase    =	batch_size
							lowerCAmelCase    =	num_channels
							lowerCAmelCase    =	image_size
							lowerCAmelCase    =	min_resolution
							lowerCAmelCase    =	max_resolution
							lowerCAmelCase    =	do_resize
							lowerCAmelCase    =	size if size is not None else {"""height""": 18, """width""": 18}
							lowerCAmelCase    =	do_center_crop
							lowerCAmelCase    =	crop_size if crop_size is not None else {"""height""": 18, """width""": 18}
							lowerCAmelCase    =	do_normalize
							lowerCAmelCase    =	image_mean
							lowerCAmelCase    =	image_std
							lowerCAmelCase    =	do_convert_rgb




						def 				__snake_case    (					self      )	->	List[Any]:
							return {
							    "do_resize": self.do_resize,
							    "size": self.size,
							    "do_center_crop": self.do_center_crop,
							    "crop_size": self.crop_size,
							    "do_normalize": self.do_normalize,
							    "image_mean": self.image_mean,
							    "image_std": self.image_std,
							    "do_convert_rgb": self.do_convert_rgb,
							}







@require_torch
@require_vision
class __snake_case(      _lowerCAmelCase		,							unittest.TestCase					):


						'''simple docstring'''



						UpperCAmelCase							:    str           =		OwlViTImageProcessor if is_vision_available() else None


						def 				__snake_case    (					self      )	->	int:
							lowerCAmelCase    =	OwlViTImageProcessingTester(self      )


						@property
						def 				__snake_case    (					self      )	->	Optional[int]:
							return self.image_processor_tester.prepare_image_processor_dict()


						def 				__snake_case    (					self      )	->	List[str]:
							lowerCAmelCase    =	self.image_processing_class(**self.image_processor_dict      )
							self.assertTrue(hasattr(A_	,       """do_resize"""      )      )
							self.assertTrue(hasattr(A_	,       """size"""      )      )
							self.assertTrue(hasattr(A_	,       """do_center_crop"""      )      )
							self.assertTrue(hasattr(A_	,       """center_crop"""      )      )
							self.assertTrue(hasattr(A_	,       """do_normalize"""      )      )
							self.assertTrue(hasattr(A_	,       """image_mean"""      )      )
							self.assertTrue(hasattr(A_	,       """image_std"""      )      )
							self.assertTrue(hasattr(A_	,       """do_convert_rgb"""      )      )


						def 				__snake_case    (					self      )	->	Dict:
							lowerCAmelCase    =	self.image_processing_class.from_dict(self.image_processor_dict      )
							self.assertEqual(image_processor.size	,       {"""height""": 18, """width""": 18}      )
							self.assertEqual(image_processor.crop_size	,       {"""height""": 18, """width""": 18}      )

							lowerCAmelCase    =	self.image_processing_class.from_dict(self.image_processor_dict	,       size=42	,       crop_size=84      )
							self.assertEqual(image_processor.size	,       {"""height""": 42, """width""": 42}      )
							self.assertEqual(image_processor.crop_size	,       {"""height""": 84, """width""": 84}      )


						def 				__snake_case    (					self      )	->	str:
							# Initialize image_processing
							lowerCAmelCase    =	self.image_processing_class(**self.image_processor_dict      )
							# create random PIL images
							lowerCAmelCase    =	prepare_image_inputs(self.image_processor_tester	,       equal_resolution=A_      )

							for image in image_inputs:
								self.assertIsInstance(A_	,       Image.Image      )

							# Test not batched input
							lowerCAmelCase    =	image_processing(image_inputs[0]	,       return_tensors="""pt"""      ).pixel_values
							self.assertEqual(
							    encoded_images.shape	,       (
							        1,
							        self.image_processor_tester.num_channels,
							        self.image_processor_tester.crop_size["""height"""],
							        self.image_processor_tester.crop_size["""width"""],
							    )	,       )

							# Test batched
							lowerCAmelCase    =	image_processing(A_	,       return_tensors="""pt"""      ).pixel_values
							self.assertEqual(
							    encoded_images.shape	,       (
							        self.image_processor_tester.batch_size,
							        self.image_processor_tester.num_channels,
							        self.image_processor_tester.crop_size["""height"""],
							        self.image_processor_tester.crop_size["""width"""],
							    )	,       )


						def 				__snake_case    (					self      )	->	List[Any]:
							# Initialize image_processing
							lowerCAmelCase    =	self.image_processing_class(**self.image_processor_dict      )
							# create random numpy tensors
							lowerCAmelCase    =	prepare_image_inputs(self.image_processor_tester	,       equal_resolution=A_	,       numpify=A_      )
							for image in image_inputs:
								self.assertIsInstance(A_	,       np.ndarray      )

							# Test not batched input
							lowerCAmelCase    =	image_processing(image_inputs[0]	,       return_tensors="""pt"""      ).pixel_values
							self.assertEqual(
							    encoded_images.shape	,       (
							        1,
							        self.image_processor_tester.num_channels,
							        self.image_processor_tester.crop_size["""height"""],
							        self.image_processor_tester.crop_size["""width"""],
							    )	,       )

							# Test batched
							lowerCAmelCase    =	image_processing(A_	,       return_tensors="""pt"""      ).pixel_values
							self.assertEqual(
							    encoded_images.shape	,       (
							        self.image_processor_tester.batch_size,
							        self.image_processor_tester.num_channels,
							        self.image_processor_tester.crop_size["""height"""],
							        self.image_processor_tester.crop_size["""width"""],
							    )	,       )




						def 				__snake_case    (					self      )	->	Dict:
							# Initialize image_processing
							lowerCAmelCase    =	self.image_processing_class(**self.image_processor_dict      )
							# create random PyTorch tensors
							lowerCAmelCase    =	prepare_image_inputs(self.image_processor_tester	,       equal_resolution=A_	,       torchify=A_      )
							for image in image_inputs:
								self.assertIsInstance(A_	,       torch.Tensor      )

							# Test not batched input
							lowerCAmelCase    =	image_processing(image_inputs[0]	,       return_tensors="""pt"""      ).pixel_values
							self.assertEqual(
							    encoded_images.shape	,       (
							        1,
							        self.image_processor_tester.num_channels,
							        self.image_processor_tester.crop_size["""height"""],
							        self.image_processor_tester.crop_size["""width"""],
							    )	,       )

							# Test batched
							lowerCAmelCase    =	image_processing(A_	,       return_tensors="""pt"""      ).pixel_values
							self.assertEqual(
							    encoded_images.shape	,       (
							        self.image_processor_tester.batch_size,
							        self.image_processor_tester.num_channels,
							        self.image_processor_tester.crop_size["""height"""],
							        self.image_processor_tester.crop_size["""width"""],
							    )	,       )




'''simple docstring'''

from __future__ import annotations

from pathlib import Path






def 		_snake_case		(					_SCREAMING_SNAKE_CASE     :						tuple[int, int]							,		_SCREAMING_SNAKE_CASE     :						tuple[int, int]							)			->						int:







	"""simple docstring"""
	return pointa[0] * pointa[1] - pointa[1] * pointa[0]






def 		_snake_case		(					_SCREAMING_SNAKE_CASE     :						int							,		_SCREAMING_SNAKE_CASE     :						int							,		_SCREAMING_SNAKE_CASE     :						int							,		_SCREAMING_SNAKE_CASE     :						int							,		_SCREAMING_SNAKE_CASE     :						int							,		_SCREAMING_SNAKE_CASE     :						int							)			->						bool:







	"""simple docstring"""
	lowerCAmelCase    =	(xa, ya)
	lowerCAmelCase    =	(xa - xa, ya - ya)
	lowerCAmelCase    =	(xa - xa, ya - ya)
	lowerCAmelCase    =	-vector_product(_SCREAMING_SNAKE_CASE							,		_SCREAMING_SNAKE_CASE							) / vector_product(
	    _SCREAMING_SNAKE_CASE							,		_SCREAMING_SNAKE_CASE							)
	lowerCAmelCase    =	+vector_product(_SCREAMING_SNAKE_CASE							,		_SCREAMING_SNAKE_CASE							) / vector_product(
	    _SCREAMING_SNAKE_CASE							,		_SCREAMING_SNAKE_CASE							)

	return a > 0 and b > 0 and a + b < 1






def 		_snake_case		(					_SCREAMING_SNAKE_CASE     :						str = "p102_triangles.txt"							)			->						int:







	"""simple docstring"""
	lowerCAmelCase    =	Path(_SCREAMING_SNAKE_CASE							).parent.joinpath(_SCREAMING_SNAKE_CASE							).read_text(encoding="""utf-8"""							)

	lowerCAmelCase    =	[]
	for line in data.strip().split("""\n"""							):
		triangles.append([int(_SCREAMING_SNAKE_CASE							) for number in line.split(""","""							)]							)

	lowerCAmelCase    =	0
	lowerCAmelCase    =	42

	for triangle in triangles:
		ret += contains_origin(*_SCREAMING_SNAKE_CASE							)

	return ret


if __name__ == "__main__":
				print(F'''{solution() = }''')