"""simple docstring"""







from typing import TYPE_CHECKING

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


SCREAMING_SNAKE_CASE									=						{
    'configuration_funnel': ['FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FunnelConfig'],
    'convert_funnel_original_tf_checkpoint_to_pytorch': [],
    'tokenization_funnel': ['FunnelTokenizer'],
}

try:
						if not is_tokenizers_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						SCREAMING_SNAKE_CASE									=						['FunnelTokenizerFast']

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						SCREAMING_SNAKE_CASE									=						[
						    'FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST',
						    'FunnelBaseModel',
						    'FunnelForMaskedLM',
						    'FunnelForMultipleChoice',
						    'FunnelForPreTraining',
						    'FunnelForQuestionAnswering',
						    'FunnelForSequenceClassification',
						    'FunnelForTokenClassification',
						    'FunnelModel',
						    'FunnelPreTrainedModel',
						    'load_tf_weights_in_funnel',
						]

try:
						if not is_tf_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						SCREAMING_SNAKE_CASE									=						[
						    'TF_FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST',
						    'TFFunnelBaseModel',
						    'TFFunnelForMaskedLM',
						    'TFFunnelForMultipleChoice',
						    'TFFunnelForPreTraining',
						    'TFFunnelForQuestionAnswering',
						    'TFFunnelForSequenceClassification',
						    'TFFunnelForTokenClassification',
						    'TFFunnelModel',
						    'TFFunnelPreTrainedModel',
						]


if TYPE_CHECKING:
						from .configuration_funnel import FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP, FunnelConfig
						from .tokenization_funnel import FunnelTokenizer

						try:
												if not is_tokenizers_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .tokenization_funnel_fast import FunnelTokenizerFast

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_funnel import (
												    FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST,
												    FunnelBaseModel,
												    FunnelForMaskedLM,
												    FunnelForMultipleChoice,
												    FunnelForPreTraining,
												    FunnelForQuestionAnswering,
												    FunnelForSequenceClassification,
												    FunnelForTokenClassification,
												    FunnelModel,
												    FunnelPreTrainedModel,
												    load_tf_weights_in_funnel,
												)

						try:
												if not is_tf_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_tf_funnel import (
												    TF_FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST,
												    TFFunnelBaseModel,
												    TFFunnelForMaskedLM,
												    TFFunnelForMultipleChoice,
												    TFFunnelForPreTraining,
												    TFFunnelForQuestionAnswering,
												    TFFunnelForSequenceClassification,
												    TFFunnelForTokenClassification,
												    TFFunnelModel,
												    TFFunnelPreTrainedModel,
												)

else:
						import sys

						SCREAMING_SNAKE_CASE									=						_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)




"""simple docstring"""







def      __lowerCAmelCase(		__UpperCAmelCase			):






	"""simple docstring"""





	_lowercase :    str							=							[0 for i in range(len(__UpperCAmelCase			)			)]

	# initialize interval's left pointer and right pointer
	_lowercase				,      _lowercase :    str							=							0, 0

	for i in range(1     ,len(__UpperCAmelCase			)			):
		# case when current index is inside the interval
		if i <= right_pointer:
			_lowercase :    Union[str, Any]							=							min(right_pointer - i + 1     ,z_result[i - left_pointer]			)
			_lowercase :    Any							=							min_edge

		while go_next(__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase			):
			z_result[i] += 1

		# if new index's result gives us more right interval,
		# we've to update left_pointer and right_pointer
		if i + z_result[i] - 1 > right_pointer:
			_lowercase				,      _lowercase :    Optional[int]							=							i, i + z_result[i] - 1

	return z_result


def      __lowerCAmelCase(		__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase			):






	"""simple docstring"""





	return i + z_result[i] < len(__UpperCAmelCase			) and s[z_result[i]] == s[i + z_result[i]]


def      __lowerCAmelCase(		__UpperCAmelCase     ,__UpperCAmelCase			):






	"""simple docstring"""





	_lowercase :    Union[str, Any]							=							0
	# concatenate 'pattern' and 'input_str' and call z_function
	# with concatenated string
	_lowercase :    List[str]							=							z_function(pattern + input_str			)

	for val in z_result:
		# if value is greater then length of the pattern string
		# that means this index is starting position of substring
		# which is equal to pattern string
		if val >= len(__UpperCAmelCase			):
			answer += 1

	return answer


if __name__ == "__main__":
						import doctest

						doctest.testmod()



