


import operator
def      snake_case_						( __lowercase			,       __lowercase = False			,       __lowercase = None       ):
   UpperCAmelCase_							:      Any						=   operator.lt if reverse else operator.gt
   UpperCAmelCase_							:      Optional[int]						=   solution or []

   if not arr:
      return solution

   UpperCAmelCase_							:      Union[str, Any]						=   [arr.pop(0       )]
   for i, item in enumerate(__lowercase       ):
      if _operator(__lowercase			,       sublist[-1]       ):
         sublist.append(__lowercase       )
         arr.pop(__lowercase       )

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

   strand_sort(__lowercase			,       __lowercase			,       __lowercase       )
   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]



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__UpperCamelCase				:  str      					=							{
    'configuration_x_clip': [
        'XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'XCLIPConfig',
        'XCLIPTextConfig',
        'XCLIPVisionConfig',
    ],
    'processing_x_clip': ['XCLIPProcessor'],
}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __UpperCamelCase				:  Any      					=							[
           'XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST',
           'XCLIPModel',
           'XCLIPPreTrainedModel',
           'XCLIPTextModel',
           'XCLIPVisionModel',
       ]

if TYPE_CHECKING:
       from .configuration_x_clip import (
           XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
           XCLIPConfig,
           XCLIPTextConfig,
           XCLIPVisionConfig,
       )
       from .processing_x_clip import XCLIPProcessor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_x_clip import (
                  XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
                  XCLIPModel,
                  XCLIPPreTrainedModel,
                  XCLIPTextModel,
                  XCLIPVisionModel,
              )

else:
       import sys

       __UpperCamelCase				:  List[str]      					=							_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)