






import os
import shutil
import unittest
from unittest.mock import patch

from transformers.testing_utils import CaptureStd, is_pt_tf_cross_test, require_torch





class     __a						(					unittest.TestCase ):







 @patch("sys.argv"							,     ["fakeprogrampath", "env"]		)
 def       __lowercase      (	self      :     Optional[Any]		):


      '''simple docstring'''






      import transformers.commands.transformers_cli

      with CaptureStd() as cs:
           transformers.commands.transformers_cli.main()
      self.assertIn("Python version"							,     cs.out		)
      self.assertIn("Platform"							,     cs.out		)
      self.assertIn("Using distributed or parallel set-up in script?"							,     cs.out		)







 @is_pt_tf_cross_test
 @patch(
     "sys.argv"							,     ["fakeprogrampath", "pt-to-tf", "--model-name", "hf-internal-testing/tiny-random-gptj", "--no-pr"]		)
 def       __lowercase      (	self      :     Union[str, Any]		):


      '''simple docstring'''






      import transformers.commands.transformers_cli

      shutil.rmtree("/tmp/hf-internal-testing/tiny-random-gptj"							,     ignore_errors=SCREAMING_SNAKE_CASE		)  # cleans potential past runs
      transformers.commands.transformers_cli.main()

      # The original repo has no TF weights -- if they exist, they were created by the CLI
      self.assertTrue(os.path.exists("/tmp/hf-internal-testing/tiny-random-gptj/tf_model.h5"		)		)







 @require_torch
 @patch("sys.argv"							,     ["fakeprogrampath", "download", "hf-internal-testing/tiny-random-gptj", "--cache-dir", "/tmp"]		)
 def       __lowercase      (	self      :     Any		):


      '''simple docstring'''






      import transformers.commands.transformers_cli

      # # remove any previously downloaded model to start clean
      shutil.rmtree("/tmp/models--hf-internal-testing--tiny-random-gptj"							,     ignore_errors=SCREAMING_SNAKE_CASE		)

      # run the command
      transformers.commands.transformers_cli.main()

      # check if the model files are downloaded correctly on /tmp/models--hf-internal-testing--tiny-random-gptj
      self.assertTrue(os.path.exists("/tmp/models--hf-internal-testing--tiny-random-gptj/blobs"		)		)
      self.assertTrue(os.path.exists("/tmp/models--hf-internal-testing--tiny-random-gptj/refs"		)		)
      self.assertTrue(os.path.exists("/tmp/models--hf-internal-testing--tiny-random-gptj/snapshots"		)		)







 @require_torch
 @patch(
     "sys.argv"							,     [
         "fakeprogrampath",
         "download",
         "hf-internal-testing/test_dynamic_model_with_tokenizer",
         "--trust-remote-code",
         "--cache-dir",
         "/tmp",
     ]							,     )
 def       __lowercase      (	self      :     Optional[Any]		):


      '''simple docstring'''






      import transformers.commands.transformers_cli

      # # remove any previously downloaded model to start clean
      shutil.rmtree("/tmp/models--hf-internal-testing--test_dynamic_model_with_tokenizer"							,     ignore_errors=SCREAMING_SNAKE_CASE		)

      # run the command
      transformers.commands.transformers_cli.main()

      # check if the model files are downloaded correctly on /tmp/models--hf-internal-testing--test_dynamic_model_with_tokenizer
      self.assertTrue(os.path.exists("/tmp/models--hf-internal-testing--test_dynamic_model_with_tokenizer/blobs"		)		)
      self.assertTrue(os.path.exists("/tmp/models--hf-internal-testing--test_dynamic_model_with_tokenizer/refs"		)		)
      self.assertTrue(
          os.path.exists("/tmp/models--hf-internal-testing--test_dynamic_model_with_tokenizer/snapshots"		)		)







from __future__ import annotations

from collections.abc import Iterator
from typing import Any





class     __a						:







 def __init__(	self      :     str							,     SCREAMING_SNAKE_CASE      :     Any		):


      '''simple docstring'''






      UpperCamelCase__    :     Any        =						data
      UpperCamelCase__    :     Node | None        =						None







 def __str__(	self      :     Union[str, Any]		):


      '''simple docstring'''






      return F'{self.data}'







class     __a						:







 def __init__(	self      :     Optional[int]		):


      '''simple docstring'''






      UpperCamelCase__    :     Node | None        =						None
      UpperCamelCase__    :     Node | None        =						None







 def __iter__(	self      :     str		):


      '''simple docstring'''






      UpperCamelCase__    :     int        =						self.front
      while node:
           yield node.data
           UpperCamelCase__    :     Any        =						node.next







 def __len__(	self      :     Tuple		):


      '''simple docstring'''






      return len(tuple(iter(self		)		)		)







 def __str__(	self      :     Union[str, Any]		):


      '''simple docstring'''






      return " <- ".join(str(SCREAMING_SNAKE_CASE		) for item in self		)







 def       __lowercase      (	self      :     List[str]		):


      '''simple docstring'''






      return len(self		) == 0







 def       __lowercase      (	self      :     Union[str, Any]							,     SCREAMING_SNAKE_CASE      :     Any		):


      '''simple docstring'''






      UpperCamelCase__    :     int        =						Node(SCREAMING_SNAKE_CASE		)
      if self.is_empty():
           UpperCamelCase__    :     int        =						node
      else:
           assert isinstance(self.rear							,     SCREAMING_SNAKE_CASE		)
           UpperCamelCase__    :     Dict        =						node
           UpperCamelCase__    :     str        =						node







 def       __lowercase      (	self      :     Dict		):


      '''simple docstring'''






      if self.is_empty():
           raise IndexError("dequeue from empty queue"		)
      assert isinstance(self.front							,     SCREAMING_SNAKE_CASE		)
      UpperCamelCase__    :     Optional[int]        =						self.front
      UpperCamelCase__    :     List[str]        =						self.front.next
      if self.front is None:
           UpperCamelCase__    :     List[Any]        =						None
      return node.data







 def       __lowercase      (	self      :     str		):


      '''simple docstring'''






      UpperCamelCase__    :     Optional[int]        =						None


if __name__ == "__main__":
 from doctest import testmod

 testmod()