




import collections.abc
from typing import Optional, Tuple, Union

import torch
import torch.utils.checkpoint
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss

from ...activations import ACTaFN
from ...modeling_outputs import BaseModelOutputWithNoAttention, ImageClassifierOutputWithNoAttention
from ...modeling_utils import PreTrainedModel
from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging
from .configuration_poolformer import PoolFormerConfig


a    				=      logging.get_logger(__name__)

# General docstring
a    				=      "PoolFormerConfig"

# Base docstring
a    				=      "sail/poolformer_s12"
a    				=      [1, 512, 7, 7]

# Image classification docstring
a    				=      "sail/poolformer_s12"
a    				=      "tabby, tabby cat"

a    				=      [
    "sail/poolformer_s12",
    # See all PoolFormer models at https://huggingface.co/models?filter=poolformer
]




def 							_SCREAMING_SNAKE_CASE   (		snake_case      ,  snake_case = 0.0      ,  snake_case = False							)    ->					List[str]:
						if drop_prob == 0.0 or not training:
												return input
						_UpperCAmelCase	     =      1 - drop_prob
						_UpperCAmelCase	     =      (input.shape[0],) + (1,) * (input.ndim - 1)  # work with diff dim tensors, not just 2D ConvNets
						_UpperCAmelCase	     =      keep_prob + torch.rand(UpperCamelCase__      ,  dtype=input.dtype      ,  device=input.device							)
						random_tensor.floor_()  # binarize
						_UpperCAmelCase	     =      input.div(UpperCamelCase__							) * random_tensor
						return output




class    _A					(		nn.Module  ):






		def __init__(     self    ,		_SCREAMING_SNAKE_CASE = None      ):
								super().__init__()
								_UpperCAmelCase	     =      drop_prob






		def 					UpperCAmelCase			(     self    ,		_SCREAMING_SNAKE_CASE      ):
								return drop_path(__SCREAMING_SNAKE_CASE    ,		self.drop_prob    ,		self.training      )






		def 					UpperCAmelCase			(     self      ):
								return "p={}".format(self.drop_prob      )




class    _A					(		nn.Module  ):






		def __init__(     self    ,		_SCREAMING_SNAKE_CASE    ,		_SCREAMING_SNAKE_CASE    ,		_SCREAMING_SNAKE_CASE    ,		_SCREAMING_SNAKE_CASE    ,		_SCREAMING_SNAKE_CASE    ,		_SCREAMING_SNAKE_CASE=None      ):
								super().__init__()
								_UpperCAmelCase	     =      patch_size if isinstance(__SCREAMING_SNAKE_CASE    ,		collections.abc.Iterable      ) else (patch_size, patch_size)
								_UpperCAmelCase	     =      stride if isinstance(__SCREAMING_SNAKE_CASE    ,		collections.abc.Iterable      ) else (stride, stride)
								_UpperCAmelCase	     =      padding if isinstance(__SCREAMING_SNAKE_CASE    ,		collections.abc.Iterable      ) else (padding, padding)

								_UpperCAmelCase	     =      nn.Convad(__SCREAMING_SNAKE_CASE    ,		__SCREAMING_SNAKE_CASE    ,		kernel_size=__SCREAMING_SNAKE_CASE    ,		stride=__SCREAMING_SNAKE_CASE    ,		padding=__SCREAMING_SNAKE_CASE      )
								_UpperCAmelCase	     =      norm_layer(__SCREAMING_SNAKE_CASE      ) if norm_layer else nn.Identity()






		def 					UpperCAmelCase			(     self    ,		_SCREAMING_SNAKE_CASE      ):
								_UpperCAmelCase	     =      self.projection(__SCREAMING_SNAKE_CASE      )
								_UpperCAmelCase	     =      self.norm(__SCREAMING_SNAKE_CASE      )
								return embeddings




class    _A					(		nn.GroupNorm  ):






		def __init__(     self    ,		_SCREAMING_SNAKE_CASE    ,		**_SCREAMING_SNAKE_CASE      ):
								super().__init__(1    ,		__SCREAMING_SNAKE_CASE    ,		**__SCREAMING_SNAKE_CASE      )




class    _A					(		nn.Module  ):






		def __init__(     self    ,		_SCREAMING_SNAKE_CASE      ):
								super().__init__()
								_UpperCAmelCase	     =      nn.AvgPoolad(__SCREAMING_SNAKE_CASE    ,		stride=1    ,		padding=pool_size // 2    ,		count_include_pad=__SCREAMING_SNAKE_CASE      )






		def 					UpperCAmelCase			(     self    ,		_SCREAMING_SNAKE_CASE      ):
								return self.pool(__SCREAMING_SNAKE_CASE      ) - hidden_states




class    _A					(		nn.Module  ):






		def __init__(     self    ,		_SCREAMING_SNAKE_CASE    ,		_SCREAMING_SNAKE_CASE    ,		_SCREAMING_SNAKE_CASE    ,		_SCREAMING_SNAKE_CASE      ):
								super().__init__()
								_UpperCAmelCase	     =      nn.Convad(__SCREAMING_SNAKE_CASE    ,		__SCREAMING_SNAKE_CASE    ,		1      )
								_UpperCAmelCase	     =      nn.Convad(__SCREAMING_SNAKE_CASE    ,		__SCREAMING_SNAKE_CASE    ,		1      )
								_UpperCAmelCase	     =      PoolFormerDropPath(__SCREAMING_SNAKE_CASE      )
								if isinstance(config.hidden_act    ,		__SCREAMING_SNAKE_CASE      ):
														_UpperCAmelCase	     =      ACTaFN[config.hidden_act]
								else:
														_UpperCAmelCase	     =      config.hidden_act






		def 					UpperCAmelCase			(     self    ,		_SCREAMING_SNAKE_CASE      ):
								_UpperCAmelCase	     =      self.conva(__SCREAMING_SNAKE_CASE      )
								_UpperCAmelCase	     =      self.act_fn(__SCREAMING_SNAKE_CASE      )
								_UpperCAmelCase	     =      self.drop(__SCREAMING_SNAKE_CASE      )
								_UpperCAmelCase	     =      self.conva(__SCREAMING_SNAKE_CASE      )
								_UpperCAmelCase	     =      self.drop(__SCREAMING_SNAKE_CASE      )

								return hidden_states




class    _A					(		nn.Module  ):






		def __init__(     self    ,		_SCREAMING_SNAKE_CASE    ,		_SCREAMING_SNAKE_CASE    ,		_SCREAMING_SNAKE_CASE    ,		_SCREAMING_SNAKE_CASE    ,		_SCREAMING_SNAKE_CASE    ,		_SCREAMING_SNAKE_CASE      ):
								super().__init__()
								_UpperCAmelCase	     =      PoolFormerPooling(__SCREAMING_SNAKE_CASE      )
								_UpperCAmelCase	     =      PoolFormerOutput(__SCREAMING_SNAKE_CASE    ,		__SCREAMING_SNAKE_CASE    ,		__SCREAMING_SNAKE_CASE    ,		__SCREAMING_SNAKE_CASE      )
								_UpperCAmelCase	     =      PoolFormerGroupNorm(__SCREAMING_SNAKE_CASE      )
								_UpperCAmelCase	     =      PoolFormerGroupNorm(__SCREAMING_SNAKE_CASE      )

								# Useful for training neural nets
								_UpperCAmelCase	     =      PoolFormerDropPath(__SCREAMING_SNAKE_CASE      ) if drop_path > 0.0 else nn.Identity()
								_UpperCAmelCase	     =      config.use_layer_scale
								if config.use_layer_scale:
														_UpperCAmelCase	     =      nn.Parameter(
														    config.layer_scale_init_value * torch.ones((__SCREAMING_SNAKE_CASE)      )    ,		requires_grad=__SCREAMING_SNAKE_CASE      )
														_UpperCAmelCase	     =      nn.Parameter(
														    config.layer_scale_init_value * torch.ones((__SCREAMING_SNAKE_CASE)      )    ,		requires_grad=__SCREAMING_SNAKE_CASE      )






		def 					UpperCAmelCase			(     self    ,		_SCREAMING_SNAKE_CASE      ):







								if self.use_layer_scale:
														_UpperCAmelCase	     =      self.pooling(self.before_norm(__SCREAMING_SNAKE_CASE      )      )
														_UpperCAmelCase	     =      self.layer_scale_a.unsqueeze(-1      ).unsqueeze(-1      ) * pooling_output
														# First residual connection
														_UpperCAmelCase	     =      hidden_states + self.drop_path(__SCREAMING_SNAKE_CASE      )
														_UpperCAmelCase	     =      ()

														_UpperCAmelCase	     =      self.output(self.after_norm(__SCREAMING_SNAKE_CASE      )      )
														_UpperCAmelCase	     =      self.layer_scale_a.unsqueeze(-1      ).unsqueeze(-1      ) * layer_output
														# Second residual connection
														_UpperCAmelCase	     =      hidden_states + self.drop_path(__SCREAMING_SNAKE_CASE      )

														_UpperCAmelCase	     =      (output,) + outputs
														return outputs

								else:
														_UpperCAmelCase	     =      self.drop_path(self.pooling(self.before_norm(__SCREAMING_SNAKE_CASE      )      )      )
														# First residual connection
														_UpperCAmelCase	     =      pooling_output + hidden_states
														_UpperCAmelCase	     =      ()

														# Second residual connection inside the PoolFormerOutput block
														_UpperCAmelCase	     =      self.drop_path(self.output(self.after_norm(__SCREAMING_SNAKE_CASE      )      )      )
														_UpperCAmelCase	     =      hidden_states + layer_output

														_UpperCAmelCase	     =      (output,) + outputs
														return outputs




class    _A					(		nn.Module  ):






		def __init__(     self    ,		_SCREAMING_SNAKE_CASE      ):
								super().__init__()
								_UpperCAmelCase	     =      config
								# stochastic depth decay rule
								_UpperCAmelCase	     =      [x.item() for x in torch.linspace(0    ,		config.drop_path_rate    ,		sum(config.depths      )      )]

								# patch embeddings
								_UpperCAmelCase	     =      []
								for i in range(config.num_encoder_blocks      ):
														embeddings.append(
														    PoolFormerEmbeddings(
														        patch_size=config.patch_sizes[i]    ,		stride=config.strides[i]    ,		padding=config.padding[i]    ,		num_channels=config.num_channels if i == 0 else config.hidden_sizes[i - 1]    ,		hidden_size=config.hidden_sizes[i]    ,		)      )
								_UpperCAmelCase	     =      nn.ModuleList(__SCREAMING_SNAKE_CASE      )

								# Transformer blocks
								_UpperCAmelCase	     =      []
								_UpperCAmelCase	     =      0
								for i in range(config.num_encoder_blocks      ):
														# each block consists of layers
														_UpperCAmelCase	     =      []
														if i != 0:
																				cur += config.depths[i - 1]
														for j in range(config.depths[i]      ):
																				layers.append(
																				    PoolFormerLayer(
																				        __SCREAMING_SNAKE_CASE    ,		num_channels=config.hidden_sizes[i]    ,		pool_size=config.pool_size    ,		hidden_size=config.hidden_sizes[i]    ,		intermediate_size=int(config.hidden_sizes[i] * config.mlp_ratio      )    ,		drop_path=dpr[cur + j]    ,		)      )
														blocks.append(nn.ModuleList(__SCREAMING_SNAKE_CASE      )      )

								_UpperCAmelCase	     =      nn.ModuleList(__SCREAMING_SNAKE_CASE      )






		def 					UpperCAmelCase			(     self    ,		_SCREAMING_SNAKE_CASE    ,		_SCREAMING_SNAKE_CASE=False    ,		_SCREAMING_SNAKE_CASE=True      ):
								_UpperCAmelCase	     =      () if output_hidden_states else None

								_UpperCAmelCase	     =      pixel_values
								for idx, layers in enumerate(zip(self.patch_embeddings    ,		self.block      )      ):
														_UpperCAmelCase	     =      layers
														# Get patch embeddings from hidden_states
														_UpperCAmelCase	     =      embedding_layer(__SCREAMING_SNAKE_CASE      )
														# Send the embeddings through the blocks
														for _, blk in enumerate(__SCREAMING_SNAKE_CASE      ):
																				_UpperCAmelCase	     =      blk(__SCREAMING_SNAKE_CASE      )
																				_UpperCAmelCase	     =      layer_outputs[0]

														if output_hidden_states:
																				_UpperCAmelCase	     =      all_hidden_states + (hidden_states,)

								if not return_dict:
														return tuple(v for v in [hidden_states, all_hidden_states] if v is not None      )

								return BaseModelOutputWithNoAttention(last_hidden_state=__SCREAMING_SNAKE_CASE    ,		hidden_states=__SCREAMING_SNAKE_CASE      )




class    _A					(		UpperCamelCase_  ):
		__a            =							PoolFormerConfig
		__a            =							"""poolformer"""
		__a            =							"""pixel_values"""
		__a            =							True






		def 					UpperCAmelCase			(     self    ,		_SCREAMING_SNAKE_CASE      ):







								if isinstance(__SCREAMING_SNAKE_CASE    ,		(nn.Linear, nn.Convad)      ):
														module.weight.data.normal_(mean=0.0    ,		std=self.config.initializer_range      )
														if module.bias is not None:
																				module.bias.data.zero_()
								elif isinstance(__SCREAMING_SNAKE_CASE    ,		nn.LayerNorm      ):
														module.bias.data.zero_()
														module.weight.data.fill_(1.0      )






		def 					UpperCAmelCase			(     self    ,		_SCREAMING_SNAKE_CASE    ,		_SCREAMING_SNAKE_CASE=False      ):







								if isinstance(__SCREAMING_SNAKE_CASE    ,		__SCREAMING_SNAKE_CASE      ):
														_UpperCAmelCase	     =      value



a    				=      r"\n    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) sub-class. Use\n    it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and\n    behavior.\n\n    Parameters:\n        config ([`PoolFormerConfig`]): Model configuration class with all the parameters of the model.\n            Initializing with a config file does not load the weights associated with the model, only the\n            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.\n"

a    				=      r"\n    Args:\n        pixel_values (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`):\n            Pixel values. Pixel values can be obtained using [`AutoImageProcessor`]. See\n            [`PoolFormerImageProcessor.__call__`] for details.\n"




@add_start_docstrings(
    """The bare PoolFormer Model transformer outputting raw hidden-states without any specific head on top."""							,  UpperCamelCase_							,  )
class    _A					(		UpperCamelCase_  ):






		def __init__(     self    ,		_SCREAMING_SNAKE_CASE      ):
								super().__init__(__SCREAMING_SNAKE_CASE      )
								_UpperCAmelCase	     =      config

								_UpperCAmelCase	     =      PoolFormerEncoder(__SCREAMING_SNAKE_CASE      )

								# Initialize weights and apply final processing
								self.post_init()






		def 					UpperCAmelCase			(     self      ):
								return self.embeddings.patch_embeddings






		@add_start_docstrings_to_model_forward(__SCREAMING_SNAKE_CASE      )
		@add_code_sample_docstrings(
		    checkpoint=_CHECKPOINT_FOR_DOC    ,		output_type=__SCREAMING_SNAKE_CASE    ,		config_class=_CONFIG_FOR_DOC    ,		modality="""vision"""    ,		expected_output=_EXPECTED_OUTPUT_SHAPE    ,		)
		def 					UpperCAmelCase			(     self    ,		_SCREAMING_SNAKE_CASE = None    ,		_SCREAMING_SNAKE_CASE = None    ,		_SCREAMING_SNAKE_CASE = None    ,		):
								_UpperCAmelCase	     =      (
								    output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
								)
								_UpperCAmelCase	     =      return_dict if return_dict is not None else self.config.use_return_dict

								if pixel_values is None:
														raise ValueError("""You have to specify pixel_values"""      )

								_UpperCAmelCase	     =      self.encoder(
								    __SCREAMING_SNAKE_CASE    ,		output_hidden_states=__SCREAMING_SNAKE_CASE    ,		return_dict=__SCREAMING_SNAKE_CASE    ,		)
								_UpperCAmelCase	     =      encoder_outputs[0]

								if not return_dict:
														return (sequence_output, None) + encoder_outputs[1:]

								return BaseModelOutputWithNoAttention(
								    last_hidden_state=__SCREAMING_SNAKE_CASE    ,		hidden_states=encoder_outputs.hidden_states    ,		)




class    _A					(		nn.Module  ):






		def __init__(     self    ,		_SCREAMING_SNAKE_CASE      ):
								super().__init__()
								_UpperCAmelCase	     =      nn.Linear(config.hidden_size    ,		config.hidden_size      )






		def 					UpperCAmelCase			(     self    ,		_SCREAMING_SNAKE_CASE      ):
								_UpperCAmelCase	     =      self.dense(__SCREAMING_SNAKE_CASE      )
								return output




@add_start_docstrings(
    """
    PoolFormer Model transformer with an image classification head on top
    """							,  UpperCamelCase_							,  )
class    _A					(		UpperCamelCase_  ):






		def __init__(     self    ,		_SCREAMING_SNAKE_CASE      ):
								super().__init__(__SCREAMING_SNAKE_CASE      )
								_UpperCAmelCase	     =      config.num_labels
								_UpperCAmelCase	     =      PoolFormerModel(__SCREAMING_SNAKE_CASE      )

								# Final norm
								_UpperCAmelCase	     =      PoolFormerGroupNorm(config.hidden_sizes[-1]      )
								# Classifier head
								_UpperCAmelCase	     =      (
								    nn.Linear(config.hidden_sizes[-1]    ,		config.num_labels      ) if config.num_labels > 0 else nn.Identity()
								)

								# Initialize weights and apply final processing
								self.post_init()






		@add_start_docstrings_to_model_forward(__SCREAMING_SNAKE_CASE      )
		@add_code_sample_docstrings(
		    checkpoint=_IMAGE_CLASS_CHECKPOINT    ,		output_type=__SCREAMING_SNAKE_CASE    ,		config_class=_CONFIG_FOR_DOC    ,		expected_output=_IMAGE_CLASS_EXPECTED_OUTPUT    ,		)
		def 					UpperCAmelCase			(     self    ,		_SCREAMING_SNAKE_CASE = None    ,		_SCREAMING_SNAKE_CASE = None    ,		_SCREAMING_SNAKE_CASE = None    ,		_SCREAMING_SNAKE_CASE = None    ,		):
								_UpperCAmelCase	     =      return_dict if return_dict is not None else self.config.use_return_dict

								_UpperCAmelCase	     =      self.poolformer(
								    __SCREAMING_SNAKE_CASE    ,		output_hidden_states=__SCREAMING_SNAKE_CASE    ,		return_dict=__SCREAMING_SNAKE_CASE    ,		)

								_UpperCAmelCase	     =      outputs[0]

								_UpperCAmelCase	     =      self.classifier(self.norm(__SCREAMING_SNAKE_CASE      ).mean([-2, -1]      )      )

								_UpperCAmelCase	     =      None
								if labels is not None:
														if self.config.problem_type is None:
																				if self.num_labels == 1:
																										_UpperCAmelCase	     =      '''regression'''
																				elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
																										_UpperCAmelCase	     =      '''single_label_classification'''
																				else:
																										_UpperCAmelCase	     =      '''multi_label_classification'''

														if self.config.problem_type == "regression":
																				_UpperCAmelCase	     =      MSELoss()
																				if self.num_labels == 1:
																										_UpperCAmelCase	     =      loss_fct(logits.squeeze()    ,		labels.squeeze()      )
																				else:
																										_UpperCAmelCase	     =      loss_fct(__SCREAMING_SNAKE_CASE    ,		__SCREAMING_SNAKE_CASE      )
														elif self.config.problem_type == "single_label_classification":
																				_UpperCAmelCase	     =      CrossEntropyLoss()
																				_UpperCAmelCase	     =      loss_fct(logits.view(-1    ,		self.num_labels      )    ,		labels.view(-1      )      )
														elif self.config.problem_type == "multi_label_classification":
																				_UpperCAmelCase	     =      BCEWithLogitsLoss()
																				_UpperCAmelCase	     =      loss_fct(__SCREAMING_SNAKE_CASE    ,		__SCREAMING_SNAKE_CASE      )

								if not return_dict:
														_UpperCAmelCase	     =      (logits,) + outputs[2:]
														return ((loss,) + output) if loss is not None else output

								return ImageClassifierOutputWithNoAttention(loss=__SCREAMING_SNAKE_CASE    ,		logits=__SCREAMING_SNAKE_CASE    ,		hidden_states=outputs.hidden_states      )

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

from tqdm import auto as tqdm_lib


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

lowerCamelCase  =logging.WARNING


def 				SCREAMING_SNAKE_CASE_   (      ):
      UpperCamelCase__     : int											=					os.getenv('''DATASETS_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 DATASETS_VERBOSITY={env_level_str}, '''
                      f'''has to be one of: { ", ".join(log_levels.keys()		) }'''		)
      return _default_log_level


def 				SCREAMING_SNAKE_CASE_   (      ):
      return __name__.split('''.'''		)[0]


def 				SCREAMING_SNAKE_CASE_   (      ):
      return logging.getLogger(_get_library_name()		)


def 				SCREAMING_SNAKE_CASE_   (      ):
      # Apply our default configuration to the library root logger.
      UpperCamelCase__     : List[Any]											=					_get_library_root_logger()
      library_root_logger.setLevel(_get_default_logging_level()		)


def 				SCREAMING_SNAKE_CASE_   (      ):
      UpperCamelCase__     : List[Any]											=					_get_library_root_logger()
      library_root_logger.setLevel(logging.NOTSET		)


def 				SCREAMING_SNAKE_CASE_   (      UpperCamelCase__ = None		):
      if name is None:
            UpperCamelCase__     : Union[str, Any]											=					_get_library_name()
      return logging.getLogger(UpperCamelCase__		)


def 				SCREAMING_SNAKE_CASE_   (      ):
      return _get_library_root_logger().getEffectiveLevel()


def 				SCREAMING_SNAKE_CASE_   (      UpperCamelCase__		):
      _get_library_root_logger().setLevel(UpperCamelCase__		)


def 				SCREAMING_SNAKE_CASE_   (      ):
      return set_verbosity(UpperCamelCase__		)


def 				SCREAMING_SNAKE_CASE_   (      ):
      return set_verbosity(UpperCamelCase__		)


def 				SCREAMING_SNAKE_CASE_   (      ):
      return set_verbosity(UpperCamelCase__		)


def 				SCREAMING_SNAKE_CASE_   (      ):
      return set_verbosity(UpperCamelCase__		)


def 				SCREAMING_SNAKE_CASE_   (      ):
      UpperCamelCase__     : str											=					False


def 				SCREAMING_SNAKE_CASE_   (      ):
      UpperCamelCase__     : List[Any]											=					True


# Configure the library root logger at the module level (singleton-like)
_configure_library_root_logger()




class 					_lowerCamelCase			:





     """simple docstring"""







     def __init__(				self    ,    *__SCREAMING_SNAKE_CASE    ,    **__SCREAMING_SNAKE_CASE	)	-> int:  # pylint: disable=unused-argument




           """simple docstring"""







           UpperCamelCase__     : Dict											=					args[0] if args else None






     def __iter__(				self	)	-> Dict:




           """simple docstring"""







           return iter(self._iterator	)






     def __getattr__(				self    ,    __SCREAMING_SNAKE_CASE	)	-> Tuple:




           """simple docstring"""







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

           return empty_fn






     def __enter__(				self	)	-> Optional[int]:




           """simple docstring"""







           return self






     def __exit__(				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)	-> Dict:




           """simple docstring"""







           return
lowerCamelCase  =True




class 					_lowerCamelCase			:





     """simple docstring"""







     def __call__(				self    ,    *__SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE=False    ,    **__SCREAMING_SNAKE_CASE	)	-> int:




           """simple docstring"""







           if _tqdm_active and not disable:
                 return tqdm_lib.tqdm(*__SCREAMING_SNAKE_CASE    ,    **__SCREAMING_SNAKE_CASE	)
           else:
                 return EmptyTqdm(*__SCREAMING_SNAKE_CASE    ,    **__SCREAMING_SNAKE_CASE	)






     def  __SCREAMING_SNAKE_CASE      (				self    ,    *__SCREAMING_SNAKE_CASE    ,    **__SCREAMING_SNAKE_CASE	)	-> Tuple:




           """simple docstring"""







           UpperCamelCase__     : Any											=					None
           if _tqdm_active:
                 return tqdm_lib.tqdm.set_lock(*__SCREAMING_SNAKE_CASE    ,    **__SCREAMING_SNAKE_CASE	)






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Tuple:




           """simple docstring"""







           if _tqdm_active:
                 return tqdm_lib.tqdm.get_lock()
lowerCamelCase  =_tqdm_cls()


def 				SCREAMING_SNAKE_CASE_   (      ):
      global _tqdm_active
      return bool(_tqdm_active		)


def 				SCREAMING_SNAKE_CASE_   (      ):
      global _tqdm_active
      UpperCamelCase__     : Dict											=					True


def 				SCREAMING_SNAKE_CASE_   (      ):
      global _tqdm_active
      UpperCamelCase__     : Union[str, Any]											=					False


