code: 
  
  
  
  
  """simple docstring"""
  
  
  
  
  import os
  import pickle
  import tempfile
  import unittest
  from typing import Callable, Optional
  
  import numpy as np
  
  from transformers import (
      BatchEncoding,
      BertTokenizer,
      BertTokenizerFast,
      PreTrainedTokenizer,
      PreTrainedTokenizerFast,
      TensorType,
      TokenSpan,
      is_tokenizers_available,
  )
  from transformers.models.gpta.tokenization_gpta import GPTaTokenizer
  from transformers.testing_utils import CaptureStderr, require_flax, require_tf, require_tokenizers, require_torch, slow
  
  
  if is_tokenizers_available():
    from tokenizers import Tokenizer
    from tokenizers.models import WordPiece
  class 							lowerCamelCase		( unittest.TestCase				):
  
  
  
  
  
  
  
     def       a_							(							self    ,      SCREAMING_SNAKE_CASE_ ):
         UpperCamelCase				:   str          =							list(tokenizer_class.max_model_input_sizes.keys() )
         for model_name in sa_models[:1]:
             UpperCamelCase				:   Optional[int]          =							tokenizer_class.from_pretrained(_lowerCamelCase )
             self.assertIsNotNone(_lowerCamelCase )
             self.assertIsInstance(_lowerCamelCase    ,      _lowerCamelCase )
             self.assertIsInstance(_lowerCamelCase    ,      _lowerCamelCase )
  
             for special_tok in tokenizer.all_special_tokens:
                 self.assertIsInstance(_lowerCamelCase    ,      _lowerCamelCase )
                 UpperCamelCase				:   Any          =							tokenizer.convert_tokens_to_ids(_lowerCamelCase )
                 self.assertIsInstance(_lowerCamelCase    ,      _lowerCamelCase )
  
  
  
  
  
  
  
     def       a_							(							self    ,      SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_ = None ):
         UpperCamelCase				:   Optional[Any]          =							pickle.dumps(_lowerCamelCase )
         self.assertIsNotNone(_lowerCamelCase )
  
         UpperCamelCase				:   str          =							pickle.loads(_lowerCamelCase )
  
         # Ensure is_fast is correctly restored
         self.assertEqual(be_restored.is_fast    ,      be_original.is_fast )
  
         # Ensure encodings are potentially correctly restored
         if be_original.is_fast:
             self.assertIsNotNone(be_restored.encodings )
         else:
             self.assertIsNone(be_restored.encodings )
  
         # Ensure the keys are the same
         for original_v, restored_v in zip(be_original.values()    ,      be_restored.values() ):
             if equal_op:
                 self.assertTrue(equal_op(_lowerCamelCase    ,      _lowerCamelCase ) )
             else:
                 self.assertEqual(_lowerCamelCase    ,      _lowerCamelCase )
  
  
  
  
  
  
  
     @slow
     def       a_							(							self ):
         self.check_tokenizer_from_pretrained(_lowerCamelCase )
  
  
  
  
  
  
  
     def       a_							(							self ):
         self.assertEqual(TensorType("""tf""" )    ,      TensorType.TENSORFLOW )
         self.assertEqual(TensorType("""pt""" )    ,      TensorType.PYTORCH )
         self.assertEqual(TensorType("""np""" )    ,      TensorType.NUMPY )
  
  
  
  
  
  
  
     @require_tokenizers
     def       a_							(							self ):
         import numpy as np
  
         UpperCamelCase				:   List[str]          =							BertTokenizer.from_pretrained("""bert-base-cased""" )
         UpperCamelCase				:   List[str]          =							BertTokenizerFast.from_pretrained("""bert-base-cased""" )
  
         # Python no tensor
         with self.subTest("""BatchEncoding (Python, return_tensors=None)""" ):
             self.assert_dump_and_restore(tokenizer_p("""Small example to encode""" ) )
  
         with self.subTest("""BatchEncoding (Python, return_tensors=NUMPY)""" ):
             self.assert_dump_and_restore(
                 tokenizer_p("""Small example to encode"""    ,      return_tensors=TensorType.NUMPY )    ,      np.array_equal )
  
         with self.subTest("""BatchEncoding (Rust, return_tensors=None)""" ):
             self.assert_dump_and_restore(tokenizer_r("""Small example to encode""" ) )
  
         with self.subTest("""BatchEncoding (Rust, return_tensors=NUMPY)""" ):
             self.assert_dump_and_restore(
                 tokenizer_r("""Small example to encode"""    ,      return_tensors=TensorType.NUMPY )    ,      np.array_equal )
  
  
  
  
  
  
  
     @require_tf
     @require_tokenizers
     def       a_							(							self ):
         import tensorflow as tf
  
         def tf_array_equals(SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_ ):
             return tf.reduce_all(tf.equal(_lowerCamelCase    ,      _lowerCamelCase ) )
  
         UpperCamelCase				:   Union[str, Any]          =							BertTokenizer.from_pretrained("""bert-base-cased""" )
         UpperCamelCase				:   str          =							BertTokenizerFast.from_pretrained("""bert-base-cased""" )
  
         with self.subTest("""BatchEncoding (Python, return_tensors=TENSORFLOW)""" ):
             self.assert_dump_and_restore(
                 tokenizer_p("""Small example to encode"""    ,      return_tensors=TensorType.TENSORFLOW )    ,      _lowerCamelCase )
  
         with self.subTest("""BatchEncoding (Rust, return_tensors=TENSORFLOW)""" ):
             self.assert_dump_and_restore(
                 tokenizer_r("""Small example to encode"""    ,      return_tensors=TensorType.TENSORFLOW )    ,      _lowerCamelCase )
  
  
  
  
  
  
  
     @require_torch
     @require_tokenizers
     def       a_							(							self ):
         import torch
  
         UpperCamelCase				:   Any          =							BertTokenizer.from_pretrained("""bert-base-cased""" )
         UpperCamelCase				:   Optional[int]          =							BertTokenizerFast.from_pretrained("""bert-base-cased""" )
  
         with self.subTest("""BatchEncoding (Python, return_tensors=PYTORCH)""" ):
             self.assert_dump_and_restore(
                 tokenizer_p("""Small example to encode"""    ,      return_tensors=TensorType.PYTORCH )    ,      torch.equal )
  
         with self.subTest("""BatchEncoding (Rust, return_tensors=PYTORCH)""" ):
             self.assert_dump_and_restore(
                 tokenizer_r("""Small example to encode"""    ,      return_tensors=TensorType.PYTORCH )    ,      torch.equal )
  
  
  
  
  
  
  
     @require_tokenizers
     def       a_							(							self ):
         UpperCamelCase				:   List[str]          =							BertTokenizer.from_pretrained("""bert-base-cased""" )
         UpperCamelCase				:   str          =							BertTokenizerFast.from_pretrained("""bert-base-cased""" )
  
         with self.subTest("""Python Tokenizer""" ):
             self.assertFalse(tokenizer_p("""Small example to_encode""" ).is_fast )
  
         with self.subTest("""Rust Tokenizer""" ):
             self.assertTrue(tokenizer_r("""Small example to_encode""" ).is_fast )
  
  
  
  
  
  
  
     @require_tokenizers
     def       a_							(							self ):
         UpperCamelCase				:   Optional[int]          =							BertTokenizerFast.from_pretrained("""bert-base-cased""" )
         UpperCamelCase				:   Union[str, Any]          =							tokenizer_r(["""Test""", """\xad""", """test"""]    ,      is_split_into_words=_lowerCamelCase )
  
         self.assertEqual(encoded.word_to_tokens(0 )    ,      TokenSpan(start=1    ,      end=2 ) )
         self.assertEqual(encoded.word_to_tokens(1 )    ,      _lowerCamelCase )
         self.assertEqual(encoded.word_to_tokens(2 )    ,      TokenSpan(start=2    ,      end=3 ) )
  
  
  
  
  
  
  
     def       a_							(							self ):
         UpperCamelCase				:   Tuple          =							BatchEncoding({"""inputs""": [[1, 2, 3], [4, 5, 6]], """labels""": [0, 1]} )
         UpperCamelCase				:   Any          =							batch.convert_to_tensors(tensor_type="""np""" )
         self.assertEqual(tensor_batch["""inputs"""].shape    ,      (2, 3) )
         self.assertEqual(tensor_batch["""labels"""].shape    ,      (2,) )
         # test converting the converted
         with CaptureStderr() as cs:
             UpperCamelCase				:   Any          =							batch.convert_to_tensors(tensor_type="""np""" )
         self.assertFalse(len(cs.err )    ,      msg=f'should have no warning, but got {cs.err}' )
  
         UpperCamelCase				:   Any          =							BatchEncoding({"""inputs""": [1, 2, 3], """labels""": 0} )
         UpperCamelCase				:   List[Any]          =							batch.convert_to_tensors(tensor_type="""np"""    ,      prepend_batch_axis=_lowerCamelCase )
         self.assertEqual(tensor_batch["""inputs"""].shape    ,      (1, 3) )
         self.assertEqual(tensor_batch["""labels"""].shape    ,      (1,) )
  
  
  
  
  
  
  
     @require_torch
     def       a_							(							self ):
         UpperCamelCase				:   Union[str, Any]          =							BatchEncoding({"""inputs""": [[1, 2, 3], [4, 5, 6]], """labels""": [0, 1]} )
         UpperCamelCase				:   Optional[Any]          =							batch.convert_to_tensors(tensor_type="""pt""" )
         self.assertEqual(tensor_batch["""inputs"""].shape    ,      (2, 3) )
         self.assertEqual(tensor_batch["""labels"""].shape    ,      (2,) )
         # test converting the converted
         with CaptureStderr() as cs:
             UpperCamelCase				:   Union[str, Any]          =							batch.convert_to_tensors(tensor_type="""pt""" )
         self.assertFalse(len(cs.err )    ,      msg=f'should have no warning, but got {cs.err}' )
  
         UpperCamelCase				:   int          =							BatchEncoding({"""inputs""": [1, 2, 3], """labels""": 0} )
         UpperCamelCase				:   Union[str, Any]          =							batch.convert_to_tensors(tensor_type="""pt"""    ,      prepend_batch_axis=_lowerCamelCase )
         self.assertEqual(tensor_batch["""inputs"""].shape    ,      (1, 3) )
         self.assertEqual(tensor_batch["""labels"""].shape    ,      (1,) )
  
  
  
  
  
  
  
     @require_tf
     def       a_							(							self ):
         UpperCamelCase				:   Any          =							BatchEncoding({"""inputs""": [[1, 2, 3], [4, 5, 6]], """labels""": [0, 1]} )
         UpperCamelCase				:   Optional[Any]          =							batch.convert_to_tensors(tensor_type="""tf""" )
         self.assertEqual(tensor_batch["""inputs"""].shape    ,      (2, 3) )
         self.assertEqual(tensor_batch["""labels"""].shape    ,      (2,) )
         # test converting the converted
         with CaptureStderr() as cs:
             UpperCamelCase				:   List[Any]          =							batch.convert_to_tensors(tensor_type="""tf""" )
         self.assertFalse(len(cs.err )    ,      msg=f'should have no warning, but got {cs.err}' )
  
         UpperCamelCase				:   List[str]          =							BatchEncoding({"""inputs""": [1, 2, 3], """labels""": 0} )
         UpperCamelCase				:   Optional[int]          =							batch.convert_to_tensors(tensor_type="""tf"""    ,      prepend_batch_axis=_lowerCamelCase )
         self.assertEqual(tensor_batch["""inputs"""].shape    ,      (1, 3) )
         self.assertEqual(tensor_batch["""labels"""].shape    ,      (1,) )
  
  
  
  
  
  
  
     @require_flax
     def       a_							(							self ):
         UpperCamelCase				:   str          =							BatchEncoding({"""inputs""": [[1, 2, 3], [4, 5, 6]], """labels""": [0, 1]} )
         UpperCamelCase				:   int          =							batch.convert_to_tensors(tensor_type="""jax""" )
         self.assertEqual(tensor_batch["""inputs"""].shape    ,      (2, 3) )
         self.assertEqual(tensor_batch["""labels"""].shape    ,      (2,) )
         # test converting the converted
         with CaptureStderr() as cs:
             UpperCamelCase				:   Any          =							batch.convert_to_tensors(tensor_type="""jax""" )
         self.assertFalse(len(cs.err )    ,      msg=f'should have no warning, but got {cs.err}' )
  
         UpperCamelCase				:   Optional[Any]          =							BatchEncoding({"""inputs""": [1, 2, 3], """labels""": 0} )
         UpperCamelCase				:   List[str]          =							batch.convert_to_tensors(tensor_type="""jax"""    ,      prepend_batch_axis=_lowerCamelCase )
         self.assertEqual(tensor_batch["""inputs"""].shape    ,      (1, 3) )
         self.assertEqual(tensor_batch["""labels"""].shape    ,      (1,) )
  
  
  
  
  
  
  
     def       a_							(							self ):
         UpperCamelCase				:   Optional[int]          =							[{"""input_ids""": np.array([0, 1, 2] )}, {"""input_ids""": np.array([0, 1, 2, 3] )}]
         UpperCamelCase				:   Optional[Any]          =							BertTokenizer.from_pretrained("""bert-base-cased""" )
  
         UpperCamelCase				:   int          =							tokenizer.pad(_lowerCamelCase    ,      padding=_lowerCamelCase )
         self.assertTrue(isinstance(batch["""input_ids"""]    ,      np.ndarray ) )
         self.assertEqual(batch["""input_ids"""].tolist()    ,      [[0, 1, 2, tokenizer.pad_token_id], [0, 1, 2, 3]] )
         UpperCamelCase				:   Any          =							tokenizer.pad(_lowerCamelCase    ,      padding=_lowerCamelCase    ,      return_tensors="""np""" )
         self.assertTrue(isinstance(batch["""input_ids"""]    ,      np.ndarray ) )
         self.assertEqual(batch["""input_ids"""].tolist()    ,      [[0, 1, 2, tokenizer.pad_token_id], [0, 1, 2, 3]] )
  
  
  
  
  
  
  
     @require_torch
     def       a_							(							self ):
         import torch
  
         UpperCamelCase				:   int          =							[{"""input_ids""": torch.tensor([0, 1, 2] )}, {"""input_ids""": torch.tensor([0, 1, 2, 3] )}]
         UpperCamelCase				:   Any          =							BertTokenizer.from_pretrained("""bert-base-cased""" )
  
         UpperCamelCase				:   Any          =							tokenizer.pad(_lowerCamelCase    ,      padding=_lowerCamelCase )
         self.assertTrue(isinstance(batch["""input_ids"""]    ,      torch.Tensor ) )
         self.assertEqual(batch["""input_ids"""].tolist()    ,      [[0, 1, 2, tokenizer.pad_token_id], [0, 1, 2, 3]] )
         UpperCamelCase				:   Any          =							tokenizer.pad(_lowerCamelCase    ,      padding=_lowerCamelCase    ,      return_tensors="""pt""" )
         self.assertTrue(isinstance(batch["""input_ids"""]    ,      torch.Tensor ) )
         self.assertEqual(batch["""input_ids"""].tolist()    ,      [[0, 1, 2, tokenizer.pad_token_id], [0, 1, 2, 3]] )
  
  
  
  
  
  
  
     @require_tf
     def       a_							(							self ):
         import tensorflow as tf
  
         UpperCamelCase				:   Dict          =							[{"""input_ids""": tf.constant([0, 1, 2] )}, {"""input_ids""": tf.constant([0, 1, 2, 3] )}]
         UpperCamelCase				:   List[Any]          =							BertTokenizer.from_pretrained("""bert-base-cased""" )
  
         UpperCamelCase				:   Optional[Any]          =							tokenizer.pad(_lowerCamelCase    ,      padding=_lowerCamelCase )
         self.assertTrue(isinstance(batch["""input_ids"""]    ,      tf.Tensor ) )
         self.assertEqual(batch["""input_ids"""].numpy().tolist()    ,      [[0, 1, 2, tokenizer.pad_token_id], [0, 1, 2, 3]] )
         UpperCamelCase				:   Union[str, Any]          =							tokenizer.pad(_lowerCamelCase    ,      padding=_lowerCamelCase    ,      return_tensors="""tf""" )
         self.assertTrue(isinstance(batch["""input_ids"""]    ,      tf.Tensor ) )
         self.assertEqual(batch["""input_ids"""].numpy().tolist()    ,      [[0, 1, 2, tokenizer.pad_token_id], [0, 1, 2, 3]] )
  
  
  
  
  
  
  
     @require_tokenizers
     def       a_							(							self ):
         UpperCamelCase				:   Optional[Any]          =							Tokenizer(WordPiece(unk_token="""[UNK]""" ) )
         PreTrainedTokenizerFast(tokenizer_object=_lowerCamelCase )
  
  
  
  
  
  
  
     @require_tokenizers
     def       a_							(							self ):
         UpperCamelCase				:   Dict          =							Tokenizer(WordPiece(unk_token="""[UNK]""" ) )
         with tempfile.TemporaryDirectory() as tmpdirname:
             bert_tokenizer.save(os.path.join(_lowerCamelCase    ,      """tokenizer.json""" ) )
             PreTrainedTokenizerFast(tokenizer_file=os.path.join(_lowerCamelCase    ,      """tokenizer.json""" ) )
  
  
  
  
  
  
  
style_context: 
  
  
  
  
  """simple docstring"""
  
  
  
  
  class 							lowerCamelCase		:
  
  
  
  
  
  
  
     def __init__(							self    ,      SCREAMING_SNAKE_CASE_=None ):
         UpperCamelCase				:   Optional[Any]          =							data
         UpperCamelCase				:   str          =							None
  
  
  
  
  
  
  
     def __repr__(							self ):
         UpperCamelCase				:   str          =							""""""
         UpperCamelCase				:   Any          =							self
         while temp:
             string_rep += f'<{temp.data}> ---> '
             UpperCamelCase				:   Optional[int]          =							temp.next
         string_rep += "<END>"
         return string_rep
  
  
  
  
  
  
  
  def 					A_			(		snake_case_     :       Tuple    ):
  
  
  
  
  
  
  
      '''simple docstring'''
  
      # if elements_list is empty
      if not elements_list:
          raise Exception("""The Elements List is empty"""    )
  
      # Set first element as Head
      UpperCamelCase				:   List[Any]          =							Node(elements_list[0]    )
      UpperCamelCase				:   str          =							head
      # Loop through elements from position 1
      for data in elements_list[1:]:
          UpperCamelCase				:   Optional[int]          =							Node(snake_case_    )
          UpperCamelCase				:   Optional[Any]          =							current.next
      return head
  
  
  __A :		List[Any]      							=    [1, 3, 5, 32, 44, 12, 43]
  print(F'''List: {list_data}''')
  print('''Creating Linked List from List.''')
  __A :		int      							=    make_linked_list(list_data)
  print('''Linked List:''')
  
  
  print(linked_list)
  
  
  
  
  