


from collections import Counter
from pathlib import Path
from typing import Optional, Tuple

import yaml






class 	__lowercase					(	yaml.SafeLoader	):





      def 							_lowercase					(		self    :       Tuple       ,							__lowerCamelCase    :       Optional[int]							)     -> Union[str, Any]:






         """simple docstring"""







         UpperCAmelCase      					=  [self.constructed_objects[key_node] for key_node, _ in node.value]
         UpperCAmelCase      					=  [tuple(__lowerCamelCase							) if isinstance(__lowerCamelCase       ,							__lowerCamelCase							) else key for key in keys]
         UpperCAmelCase      					=  Counter(__lowerCamelCase							)
         UpperCAmelCase      					=  [key for key in counter if counter[key] > 1]
         if duplicate_keys:
            raise TypeError(F"""Got duplicate yaml keys: {duplicate_keys}"""							)





      def 							_lowercase					(		self    :       Any       ,							__lowerCamelCase    :       Union[str, Any]       ,							__lowerCamelCase    :       Optional[int]=False							)     -> Tuple:






         """simple docstring"""







         UpperCAmelCase      					=  super().construct_mapping(__lowerCamelCase       ,							deep=__lowerCamelCase							)
         self._check_no_duplicates_on_constructed_node(__lowerCamelCase							)
         return mapping

def 	_UpperCamelCase					(    lowerCAmelCase_ )    ->Tuple[Optional[str], str]:
   UpperCAmelCase      					=  list(readme_content.splitlines() )
   if full_content and full_content[0] == "---" and "---" in full_content[1:]:
      UpperCAmelCase      					=  full_content[1:].index("""---""" ) + 1
      UpperCAmelCase      					=  """\n""".join(full_content[1:sep_idx] )
      return yamlblock, "\n".join(full_content[sep_idx + 1 :] )

   return None, "\n".join(lowerCAmelCase_ )






class 	__lowercase					(	__snake_case	):
      # class attributes
      UpperCamelCase										=							{'''train_eval_index'''}  # train-eval-index in the YAML metadata





      @classmethod
      def 							_lowercase					(		cls    :       Optional[Any]       ,							__lowerCamelCase    :       Path							)     -> "DatasetMetadata":






         """simple docstring"""







         with open(__lowerCamelCase       ,							encoding="""utf-8"""							) as readme_file:
            UpperCAmelCase					,	UpperCAmelCase      					=  _split_yaml_from_readme(readme_file.read()							)
         if yaml_string is not None:
            return cls.from_yaml_string(__lowerCamelCase							)
         else:
            return cls()





      def 							_lowercase					(		self    :       str       ,							__lowerCamelCase    :       Path							)     -> List[Any]:






         """simple docstring"""







         if path.exists():
            with open(__lowerCamelCase       ,							encoding="""utf-8"""							) as readme_file:
               UpperCAmelCase      					=  readme_file.read()
         else:
            UpperCAmelCase      					=  None
         UpperCAmelCase      					=  self._to_readme(__lowerCamelCase							)
         with open(__lowerCamelCase       ,							"""w"""       ,							encoding="""utf-8"""							) as readme_file:
            readme_file.write(__lowerCamelCase							)





      def 							_lowercase					(		self    :       Any       ,							__lowerCamelCase    :       Optional[str] = None							)     -> str:






         """simple docstring"""







         if readme_content is not None:
            UpperCAmelCase					,	UpperCAmelCase      					=  _split_yaml_from_readme(__lowerCamelCase							)
            UpperCAmelCase      					=  """---\n""" + self.to_yaml_string() + """---\n""" + content
         else:
            UpperCAmelCase      					=  """---\n""" + self.to_yaml_string() + """---\n"""
         return full_content





      @classmethod
      def 							_lowercase					(		cls    :       Tuple       ,							__lowerCamelCase    :       str							)     -> "DatasetMetadata":






         """simple docstring"""







         UpperCAmelCase      					=  yaml.load(__lowerCamelCase       ,							Loader=_NoDuplicateSafeLoader							) or {}

         # Convert the YAML keys to DatasetMetadata fields
         UpperCAmelCase      					=  {
             (key.replace("""-"""       ,							"""_"""							) if key.replace("""-"""       ,							"""_"""							) in cls._FIELDS_WITH_DASHES else key): value
             for key, value in metadata_dict.items()
         }
         return cls(**__lowerCamelCase							)





      def 							_lowercase					(		self    :       List[str]							)     -> str:






         """simple docstring"""







         return yaml.safe_dump(
             {
                 (key.replace("""_"""       ,							"""-"""							) if key in self._FIELDS_WITH_DASHES else key): value
                 for key, value in self.items()
             }       ,							sort_keys=__lowerCamelCase       ,							allow_unicode=__lowerCamelCase       ,							encoding="""utf-8"""       ,							).decode("""utf-8"""							)

__a	 =      {
    """image-classification""": [],
    """translation""": [],
    """image-segmentation""": [],
    """fill-mask""": [],
    """automatic-speech-recognition""": [],
    """token-classification""": [],
    """sentence-similarity""": [],
    """audio-classification""": [],
    """question-answering""": [],
    """summarization""": [],
    """zero-shot-classification""": [],
    """table-to-text""": [],
    """feature-extraction""": [],
    """other""": [],
    """multiple-choice""": [],
    """text-classification""": [],
    """text-to-image""": [],
    """text2text-generation""": [],
    """zero-shot-image-classification""": [],
    """tabular-classification""": [],
    """tabular-regression""": [],
    """image-to-image""": [],
    """tabular-to-text""": [],
    """unconditional-image-generation""": [],
    """text-retrieval""": [],
    """text-to-speech""": [],
    """object-detection""": [],
    """audio-to-audio""": [],
    """text-generation""": [],
    """conversational""": [],
    """table-question-answering""": [],
    """visual-question-answering""": [],
    """image-to-text""": [],
    """reinforcement-learning""": [],
    """voice-activity-detection""": [],
    """time-series-forecasting""": [],
    """document-question-answering""": [],
}


if __name__ == "__main__":
 from argparse import ArgumentParser

 __a	 =      ArgumentParser(usage="""Validate the yaml metadata block of a README.md file.""")
 ap.add_argument("""readme_filepath""")
 __a	 =      ap.parse_args()

 __a	 =      Path(args.readme_filepath)
 __a	 =      DatasetMetadata.from_readme(readme_filepath)
 print(dataset_metadata)
 dataset_metadata.to_readme(readme_filepath)







from __future__ import annotations
def 	_UpperCamelCase					(    lowerCAmelCase_	,    lowerCAmelCase_ )    ->Optional[int]:
   # Checks if the entire collection has been sorted
   if len(lowerCAmelCase_ ) <= 1 or n <= 1:
      return

   insert_next(lowerCAmelCase_	,    n - 1 )
   rec_insertion_sort(lowerCAmelCase_	,    n - 1 )
def 	_UpperCamelCase					(    lowerCAmelCase_	,    lowerCAmelCase_ )    ->Dict:
   # Checks order between adjacent elements
   if index >= len(lowerCAmelCase_ ) or collection[index - 1] <= collection[index]:
      return

   # Swaps adjacent elements since they are not in ascending order
   UpperCAmelCase					,	UpperCAmelCase      					=  (
       collection[index],
       collection[index - 1],
   )

   insert_next(lowerCAmelCase_	,    index + 1 )


if __name__ == "__main__":
 __a	 =      input("""Enter integers separated by spaces: """)
 __a	 =      [int(num) for num in numbers.split()]
 rec_insertion_sort(number_list, len(number_list))
 print(number_list)



