
"""simple docstring"""

import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_torch


if is_torch_available():
      import torch

      from transformers.generation import DisjunctiveConstraint

@require_torch
class __lowerCAmelCase	(   unittest.TestCase    ):





     def 		UpperCAmelCase      (			self   ):

      '''simple docstring'''




      __UpperCamelCase       						= [[1, 2, 4], [1, 2, 3, 4]]
      __UpperCamelCase       						= DisjunctiveConstraint(__UpperCAmelCase   )
      self.assertTrue(isinstance(dc.token_ids			,  __UpperCAmelCase   )   )

      with self.assertRaises(__UpperCAmelCase   ):
       DisjunctiveConstraint(torch.LongTensor([[1, 2, 4], [1, 2, 3]]   )   )

      with self.assertRaises(__UpperCAmelCase   ):
       DisjunctiveConstraint([torch.LongTensor([1, 2, 4]   ), torch.LongTensor([1, 2, 3, 4, 5]   )]   )





     def 		UpperCAmelCase      (			self   ):

      '''simple docstring'''




      __UpperCamelCase       						= [[1, 2], [1, 2, 3, 4]]

      with self.assertRaises(__UpperCAmelCase   ):
       DisjunctiveConstraint(__UpperCAmelCase   )  # fails here





     def 		UpperCAmelCase      (			self   ):

      '''simple docstring'''




      __UpperCamelCase       						= [[1, 2, 3], [1, 2, 4]]

      __UpperCamelCase       						= DisjunctiveConstraint(__UpperCAmelCase   )

      __UpperCamelCase						,			__UpperCamelCase						,			__UpperCamelCase       						= dc.update(1   )
      __UpperCamelCase       						= stepped is True and completed is False and reset is False
      self.assertTrue(__UpperCAmelCase   )
      self.assertTrue(not dc.completed   )
      self.assertTrue(dc.current_seq == [1]   )

      __UpperCamelCase						,			__UpperCamelCase						,			__UpperCamelCase       						= dc.update(2   )
      __UpperCamelCase       						= stepped is True and completed is False and reset is False
      self.assertTrue(__UpperCAmelCase   )
      self.assertTrue(not dc.completed   )
      self.assertTrue(dc.current_seq == [1, 2]   )

      __UpperCamelCase						,			__UpperCamelCase						,			__UpperCamelCase       						= dc.update(3   )
      __UpperCamelCase       						= stepped is True and completed is True and reset is False
      self.assertTrue(__UpperCAmelCase   )
      self.assertTrue(dc.completed   )  # Completed!
      self.assertTrue(dc.current_seq == [1, 2, 3]   )







     def 		UpperCAmelCase      (			self   ):

      '''simple docstring'''




      __UpperCamelCase       						= [[1, 2, 3], [1, 2, 4, 5], [1, 2, 5]]

      __UpperCamelCase       						= DisjunctiveConstraint(__UpperCAmelCase   )

      __UpperCamelCase						,			__UpperCamelCase						,			__UpperCamelCase       						= dc.update(1   )
      self.assertTrue(not dc.completed   )
      self.assertTrue(dc.current_seq == [1]   )

      __UpperCamelCase						,			__UpperCamelCase						,			__UpperCamelCase       						= dc.update(2   )
      self.assertTrue(not dc.completed   )
      self.assertTrue(dc.current_seq == [1, 2]   )

      __UpperCamelCase						,			__UpperCamelCase						,			__UpperCamelCase       						= dc.update(4   )
      self.assertTrue(not dc.completed   )
      self.assertTrue(dc.current_seq == [1, 2, 4]   )

      __UpperCamelCase						,			__UpperCamelCase						,			__UpperCamelCase       						= dc.update(5   )
      self.assertTrue(dc.completed   )  # Completed!
      self.assertTrue(dc.current_seq == [1, 2, 4, 5]   )

      dc.reset()

      __UpperCamelCase						,			__UpperCamelCase						,			__UpperCamelCase       						= dc.update(1   )
      self.assertTrue(not dc.completed   )
      self.assertTrue(dc.remaining() == 3   )
      self.assertTrue(dc.current_seq == [1]   )

      __UpperCamelCase						,			__UpperCamelCase						,			__UpperCamelCase       						= dc.update(2   )
      self.assertTrue(not dc.completed   )
      self.assertTrue(dc.remaining() == 2   )
      self.assertTrue(dc.current_seq == [1, 2]   )

      __UpperCamelCase						,			__UpperCamelCase						,			__UpperCamelCase       						= dc.update(5   )
      self.assertTrue(dc.completed   )  # Completed!
      self.assertTrue(dc.remaining() == 0   )
      self.assertTrue(dc.current_seq == [1, 2, 5]   )





"""simple docstring"""

from __future__ import annotations

import os
from typing import Any

import requests

UpperCamelCase			:       Union[str, Any]									=				"https://api.github.com"

# https://docs.github.com/en/free-pro-team@latest/rest/reference/users#get-the-authenticated-user
UpperCamelCase			:       Union[str, Any]									=				BASE_URL + "/user"

# https://github.com/settings/tokens
UpperCamelCase			:       Optional[int]									=				os.environ.get("USER_TOKEN", "")






def 							A		(       snake_case   :str	)   ->			dict[Any, Any]:
 __UpperCamelCase       						= {
     'Authorization': f'token {auth_token}',
     'Accept': 'application/vnd.github.v3+json',
 }
 return requests.get(snake_case       ,      headers=snake_case	).json()


if __name__ == "__main__":  # pragma: no cover
      if USER_TOKEN:
            for key, value in fetch_github_info(USER_TOKEN).items():
                  print(f'''{key}: {value}''')
      else:
            raise ValueError("'USER_TOKEN' field cannot be empty.")



