import operator







def      _a					(   lowercase__	:      list  ,	lowercase__	:      bool = False  ,	lowercase__	:      list | None = None			):







     '''simple docstring'''


     SCREAMING_SNAKE_CASE__					:					Optional[Any]      =		operator.lt if reverse else operator.gt
     SCREAMING_SNAKE_CASE__					:					Dict      =		solution or []

     if not arr:
          return solution

     SCREAMING_SNAKE_CASE__					:					Dict      =		[arr.pop(0			)]
     for i, item in enumerate(_SCREAMING_SNAKE_CASE			):
          if _operator(_SCREAMING_SNAKE_CASE  ,	sublist[-1]			):
               sublist.append(_SCREAMING_SNAKE_CASE			)
               arr.pop(_SCREAMING_SNAKE_CASE			)

    #  merging sublist into solution list
     if not solution:
          solution.extend(_SCREAMING_SNAKE_CASE			)
     else:
          while sublist:
               SCREAMING_SNAKE_CASE__					:					int      =		sublist.pop(0			)
               for i, xx in enumerate(_SCREAMING_SNAKE_CASE			):
                    if not _operator(_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE			):
                         solution.insert(_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE			)
                         break
               else:
                    solution.append(_SCREAMING_SNAKE_CASE			)

     strand_sort(_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE  ,	_SCREAMING_SNAKE_CASE			)
     return solution


if __name__ == "__main__":
      assert strand_sort([4, 3, 5, 1, 2]) == [1, 2, 3, 4, 5]
      assert strand_sort([4, 3, 5, 1, 2], reverse=True) == [5, 4, 3, 2, 1]







'''simple docstring'''





import numpy as np

from transformers import Pipeline






def 						UpperCAmelCase__(				_SCREAMING_SNAKE_CASE					: Any ):






			"""simple docstring"""




			__A=	np.max(_SCREAMING_SNAKE_CASE,axis=-1,keepdims=_SCREAMING_SNAKE_CASE )
			__A=	np.exp(outputs - maxes )
			return shifted_exp / shifted_exp.sum(axis=-1,keepdims=_SCREAMING_SNAKE_CASE )






class 						a__					(					a_   ):





			'''simple docstring'''

			def 					lowerCAmelCase     (  self							:			Optional[Any]			,    **lowerCAmelCase_							:			List[str]	)      ->		List[str]:
						__A=	{}
						if "second_text" in kwargs:
									__A=	kwargs['second_text']
						return preprocess_kwargs, {}, {}
			def 					lowerCAmelCase     (  self							:			str			,    lowerCAmelCase_							:			Union[str, Any]			,    lowerCAmelCase_							:			Optional[int]=None	)      ->		int:
						return self.tokenizer(lowerCAmelCase_			,    text_pair=lowerCAmelCase_			,    return_tensors=self.framework	)
			def 					lowerCAmelCase     (  self							:			Dict			,    lowerCAmelCase_							:			List[str]	)      ->		Tuple:
						return self.model(**lowerCAmelCase_	)

			def 					lowerCAmelCase     (  self							:			str			,    lowerCAmelCase_							:			Dict	)      ->		Optional[int]:
						__A=	model_outputs.logits[0].numpy()
						__A=	softmax(lowerCAmelCase_	)

						__A=	np.argmax(lowerCAmelCase_	)
						__A=	self.model.config.idalabel[best_class]
						__A=	probabilities[best_class].item()
						__A=	logits.tolist()
						return {"label": label, "score": score, "logits": logits}



