
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


_UpperCAmelCase      :				Optional[Any]          = {
    "configuration_efficientformer": [
        "EFFICIENTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "EfficientFormerConfig",
    ]
}

try:
					if not is_vision_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					_UpperCAmelCase      :				Optional[Any]          = ["EfficientFormerImageProcessor"]

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					_UpperCAmelCase      :				List[str]          = [
					    "EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
					    "EfficientFormerForImageClassification",
					    "EfficientFormerForImageClassificationWithTeacher",
					    "EfficientFormerModel",
					    "EfficientFormerPreTrainedModel",
					]

try:
					if not is_tf_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					_UpperCAmelCase      :				int          = [
					    "TF_EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
					    "TFEfficientFormerForImageClassification",
					    "TFEfficientFormerForImageClassificationWithTeacher",
					    "TFEfficientFormerModel",
					    "TFEfficientFormerPreTrainedModel",
					]

if TYPE_CHECKING:
					from .configuration_efficientformer import EFFICIENTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, EfficientFormerConfig

					try:
										if not is_vision_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .image_processing_efficientformer import EfficientFormerImageProcessor

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_efficientformer import (
										    EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
										    EfficientFormerForImageClassification,
										    EfficientFormerForImageClassificationWithTeacher,
										    EfficientFormerModel,
										    EfficientFormerPreTrainedModel,
										)
					try:
										if not is_tf_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_tf_efficientformer import (
										    TF_EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
										    TFEfficientFormerForImageClassification,
										    TFEfficientFormerForImageClassificationWithTeacher,
										    TFEfficientFormerModel,
										    TFEfficientFormerPreTrainedModel,
										)

else:
					import sys

					_UpperCAmelCase      :				Union[str, Any]          = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)


from collections.abc import Callable


def    A (      lowercase					, lowercase					, lowercase				)     ->						float:
		'''simple docstring'''

		UpperCamelCase						=  a
		UpperCamelCase						=  b
		if function(lowercase				) == 0:  # one of the a or b is a root for the function
				return a
		elif function(lowercase				) == 0:
				return b
		elif (
		    function(lowercase				) * function(lowercase				) > 0
		):  # if none of these are root and they are both positive or negative,
				# then this algorithm can't find the root
				raise ValueError('could not find root in given interval.'				)
		else:
				UpperCamelCase						=  start + (end - start) / 2.0
				while abs(start - mid				) > 10**-7:  # until precisely equals to 10^-7
						if function(lowercase				) == 0:
								return mid
						elif function(lowercase				) * function(lowercase				) < 0:
								UpperCamelCase						=  mid
						else:
								UpperCamelCase						=  mid
						UpperCamelCase						=  start + (end - start) / 2.0
				return mid


def    A (      lowercase				)     ->						float:
		'''simple docstring'''

		return x**3 - 2 * x - 5


if __name__ == "__main__":
					print(bisection(f, 1, 1_000))

					import doctest

					doctest.testmod()
