






'''simple docstring'''

from datetime import datetime as dt
import os

from github import Github


SCREAMING_SNAKE_CASE__     =       [
    "good first issue",
    "good second issue",
    "good difficult issue",
    "feature request",
    "new model",
    "wip",
]







def    lowercase__			(				)->			str:
      UpperCamelCase      = Github(os.environ["""GITHUB_TOKEN"""]   )
      UpperCamelCase      = g.get_repo("""huggingface/transformers"""   )
      UpperCamelCase      = repo.get_issues(state="""open"""   )

      for issue in open_issues:
            UpperCamelCase      = sorted([comment for comment in issue.get_comments()]		,						key=lambda __UpperCamelCase   : i.created_at		,						reverse=_UpperCAmelCase   )
            UpperCamelCase      = comments[0] if len(_UpperCAmelCase   ) > 0 else None
            if (
                last_comment is not None
                and last_comment.user.login == "github-actions[bot]"
                and (dt.utcnow() - issue.updated_at).days > 7
                and (dt.utcnow() - issue.created_at).days >= 30
                and not any(label.name.lower() in LABELS_TO_EXEMPT for label in issue.get_labels()   )
            ):
                  # print(f"Would close issue {issue.number} since it has been 7 days of inactivity since bot mention.")
                  issue.edit(state="""closed"""   )
            elif (
                (dt.utcnow() - issue.updated_at).days > 23
                and (dt.utcnow() - issue.created_at).days >= 30
                and not any(label.name.lower() in LABELS_TO_EXEMPT for label in issue.get_labels()   )
            ):
                  # print(f"Would add stale comment to {issue.number}")
                  issue.create_comment(
                      """This issue has been automatically marked as stale because it has not had """
                      """recent activity. If you think this still needs to be addressed """
                      """please comment on this thread.\n\nPlease note that issues that do not follow the """
                      """[contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) """
                      """are likely to be ignored."""   )


if __name__ == "__main__":
     main()








'''simple docstring'''

import functools
import logging
import os
import sys
import threading
from logging import (
    CRITICAL,  # NOQA
    DEBUG,  # NOQA
    ERROR,  # NOQA
    FATAL,  # NOQA
    INFO,  # NOQA
    NOTSET,  # NOQA
    WARN,  # NOQA
    WARNING,  # NOQA
)
from typing import Optional

import huggingface_hub.utils as hf_hub_utils
from tqdm import auto as tqdm_lib


SCREAMING_SNAKE_CASE__     =       threading.Lock()
SCREAMING_SNAKE_CASE__     =       None

SCREAMING_SNAKE_CASE__     =       {
    'debug': logging.DEBUG,
    'info': logging.INFO,
    'warning': logging.WARNING,
    'error': logging.ERROR,
    'critical': logging.CRITICAL,
}

SCREAMING_SNAKE_CASE__     =       logging.WARNING

SCREAMING_SNAKE_CASE__     =       True







def    lowercase__			(				)->			Optional[int]:
      UpperCamelCase      = os.getenv("""TRANSFORMERS_VERBOSITY"""		,						__UpperCamelCase   )
      if env_level_str:
            if env_level_str in log_levels:
                  return log_levels[env_level_str]
            else:
                  logging.getLogger().warning(
                      F"Unknown option TRANSFORMERS_VERBOSITY={env_level_str}, "
                      F"has to be one of: { ', '.join(log_levels.keys()   ) }"   )
      return _default_log_level







def    lowercase__			(				)->			str:
      return __name__.split("""."""   )[0]







def    lowercase__			(				)->			logging.Logger:
      return logging.getLogger(_get_library_name()   )







def    lowercase__			(				)->			None:
      global _default_handler

      with _lock:
            if _default_handler:
                  # This library has already configured the library root logger.
                  return
            UpperCamelCase      = logging.StreamHandler()  # Set sys.stderr as stream.
            UpperCamelCase      = sys.stderr.flush

            # Apply our default configuration to the library root logger.
            UpperCamelCase      = _get_library_root_logger()
            library_root_logger.addHandler(_default_handler   )
            library_root_logger.setLevel(_get_default_logging_level()   )
            UpperCamelCase      = False







def    lowercase__			(				)->			None:
      global _default_handler

      with _lock:
            if not _default_handler:
                  return

            UpperCamelCase      = _get_library_root_logger()
            library_root_logger.removeHandler(_default_handler   )
            library_root_logger.setLevel(logging.NOTSET   )
            UpperCamelCase      = None







def    lowercase__			(				)->			Tuple:
      return log_levels







def    lowercase__			(				__UpperCamelCase = None   )->			logging.Logger:

      if name is None:
            UpperCamelCase      = _get_library_name()

      _configure_library_root_logger()
      return logging.getLogger(__UpperCamelCase   )







def    lowercase__			(				)->			int:
      _configure_library_root_logger()
      return _get_library_root_logger().getEffectiveLevel()







def    lowercase__			(				__UpperCamelCase   )->			None:
      _configure_library_root_logger()
      _get_library_root_logger().setLevel(__UpperCamelCase   )







def    lowercase__			(				)->			Tuple:
      return set_verbosity(__UpperCamelCase   )







def    lowercase__			(				)->			Union[str, Any]:
      return set_verbosity(__UpperCamelCase   )







def    lowercase__			(				)->			Optional[int]:
      return set_verbosity(__UpperCamelCase   )







def    lowercase__			(				)->			Tuple:
      return set_verbosity(__UpperCamelCase   )







def    lowercase__			(				)->			None:
      _configure_library_root_logger()

      assert _default_handler is not None
      _get_library_root_logger().removeHandler(_default_handler   )







def    lowercase__			(				)->			None:
      _configure_library_root_logger()

      assert _default_handler is not None
      _get_library_root_logger().addHandler(_default_handler   )







def    lowercase__			(				__UpperCamelCase   )->			None:
      _configure_library_root_logger()

      assert handler is not None
      _get_library_root_logger().addHandler(__UpperCamelCase   )







def    lowercase__			(				__UpperCamelCase   )->			None:
      _configure_library_root_logger()

      assert handler is not None and handler not in _get_library_root_logger().handlers
      _get_library_root_logger().removeHandler(__UpperCamelCase   )







def    lowercase__			(				)->			None:
      _configure_library_root_logger()
      UpperCamelCase      = False







def    lowercase__			(				)->			None:
      _configure_library_root_logger()
      UpperCamelCase      = True







def    lowercase__			(				)->			None:
      UpperCamelCase      = _get_library_root_logger().handlers

      for handler in handlers:
            UpperCamelCase      = logging.Formatter("""[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s"""   )
            handler.setFormatter(__UpperCamelCase   )







def    lowercase__			(				)->			None:
      UpperCamelCase      = _get_library_root_logger().handlers

      for handler in handlers:
            handler.setFormatter(__UpperCamelCase   )







def    lowercase__			(				self		,						*__UpperCamelCase		,						**__UpperCamelCase   )->			Tuple:
      UpperCamelCase      = os.getenv("""TRANSFORMERS_NO_ADVISORY_WARNINGS"""		,						__UpperCamelCase   )
      if no_advisory_warnings:
            return
      self.warning(*__UpperCamelCase		,						**__UpperCamelCase   )


SCREAMING_SNAKE_CASE__     =       warning_advice







@functools.lru_cache(__UpperCamelCase   )
def    lowercase__			(				self		,						*__UpperCamelCase		,						**__UpperCamelCase   )->			Optional[Any]:
      self.warning(*__UpperCamelCase		,						**__UpperCamelCase   )


SCREAMING_SNAKE_CASE__     =       warning_once






class     a_						:

  def __init__(				self      ,		*_SCREAMING_SNAKE_CASE      ,		**_SCREAMING_SNAKE_CASE				)  ->				Optional[int]:  # pylint: disable=unused-argument



        """simple docstring"""






        UpperCamelCase      = args[0] if args else None

  def __iter__(				self				)  ->				List[Any]:



        """simple docstring"""






        return iter(self._iterator				)

  def __getattr__(				self      ,		_SCREAMING_SNAKE_CASE				)  ->				List[Any]:



        """simple docstring"""






        def empty_fn(*_SCREAMING_SNAKE_CASE      ,		**_SCREAMING_SNAKE_CASE				):  # pylint: disable=unused-argument
              return

        return empty_fn

  def __enter__(				self				)  ->				Dict:



        """simple docstring"""






        return self


  def __exit__(				self      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE      ,		_SCREAMING_SNAKE_CASE				)  ->				List[Any]:



        """simple docstring"""






        return






class     a_						:

  def __call__(				self      ,		*_SCREAMING_SNAKE_CASE      ,		**_SCREAMING_SNAKE_CASE				)  ->				str:



        """simple docstring"""






        if _tqdm_active:
              return tqdm_lib.tqdm(*_SCREAMING_SNAKE_CASE      ,		**_SCREAMING_SNAKE_CASE				)
        else:
              return EmptyTqdm(*_SCREAMING_SNAKE_CASE      ,		**_SCREAMING_SNAKE_CASE				)

  def   A__						(				self      ,		*_SCREAMING_SNAKE_CASE      ,		**_SCREAMING_SNAKE_CASE				)  ->				Optional[Any]:



        """simple docstring"""






        UpperCamelCase      = None
        if _tqdm_active:
              return tqdm_lib.tqdm.set_lock(*_SCREAMING_SNAKE_CASE      ,		**_SCREAMING_SNAKE_CASE				)


  def   A__						(				self				)  ->				Union[str, Any]:



        """simple docstring"""






        if _tqdm_active:
              return tqdm_lib.tqdm.get_lock()


SCREAMING_SNAKE_CASE__     =       _tqdm_cls()







def    lowercase__			(				)->			bool:
      global _tqdm_active
      return bool(_tqdm_active   )







def    lowercase__			(				)->			Optional[Any]:
      global _tqdm_active
      UpperCamelCase      = True
      hf_hub_utils.enable_progress_bars()







def    lowercase__			(				)->			str:
      global _tqdm_active
      UpperCamelCase      = False
      hf_hub_utils.disable_progress_bars()
