

import unittest

from transformers import SqueezeBertConfig, is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
	import torch

	from transformers import (
	    SQUEEZEBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
	    SqueezeBertForMaskedLM,
	    SqueezeBertForMultipleChoice,
	    SqueezeBertForQuestionAnswering,
	    SqueezeBertForSequenceClassification,
	    SqueezeBertForTokenClassification,
	    SqueezeBertModel,
	)



class     A__(a_				):
						"""simple docstring"""






						def __init__(  self   ,	_lowercase   ,	_lowercase=13   ,	_lowercase=7   ,	_lowercase=True   ,	_lowercase=True   ,	_lowercase=False   ,	_lowercase=True   ,	_lowercase=99   ,	_lowercase=32   ,	_lowercase=5   ,	_lowercase=4   ,	_lowercase=64   ,	_lowercase="gelu"   ,	_lowercase=0.1   ,	_lowercase=0.1   ,	_lowercase=512   ,	_lowercase=16   ,	_lowercase=2   ,	_lowercase=0.0_2   ,	_lowercase=3   ,	_lowercase=4   ,	_lowercase=None   ,	_lowercase=2   ,	_lowercase=2   ,	_lowercase=2   ,	_lowercase=2   ,	_lowercase=4   ,	_lowercase=1   ,	)			->      int:
									a_		:		Tuple      				=      parent
									a_		:		Dict      				=      batch_size
									a_		:		int      				=      seq_length
									a_		:		Union[str, Any]      				=      is_training
									a_		:		int      				=      use_input_mask
									a_		:		Optional[Any]      				=      use_token_type_ids
									a_		:		List[str]      				=      use_labels
									a_		:		Dict      				=      vocab_size
									a_		:		Optional[int]      				=      hidden_size
									a_		:		List[str]      				=      num_hidden_layers
									a_		:		Tuple      				=      num_attention_heads
									a_		:		Optional[int]      				=      intermediate_size
									a_		:		Optional[int]      				=      hidden_act
									a_		:		Dict      				=      hidden_dropout_prob
									a_		:		Any      				=      attention_probs_dropout_prob
									a_		:		Optional[Any]      				=      max_position_embeddings
									a_		:		Dict      				=      type_vocab_size
									a_		:		Dict      				=      type_sequence_label_size
									a_		:		Dict      				=      initializer_range
									a_		:		Dict      				=      num_labels
									a_		:		Dict      				=      num_choices
									a_		:		Dict      				=      scope
									a_		:		Optional[int]      				=      q_groups
									a_		:		Optional[Any]      				=      k_groups
									a_		:		Optional[int]      				=      v_groups
									a_		:		List[str]      				=      post_attention_groups
									a_		:		Tuple      				=      intermediate_groups
									a_		:		Tuple      				=      output_groups





						def        UpperCamelCase__ (  self  )			->      Optional[Any]:
									a_		:		List[str]      				=      ids_tensor([self.batch_size, self.seq_length]   ,	self.vocab_size  )

									a_		:		Optional[Any]      				=      None
									if self.use_input_mask:
												a_		:		Tuple      				=      random_attention_mask([self.batch_size, self.seq_length]  )

									a_		:		List[Any]      				=      None
									a_		:		Optional[Any]      				=      None
									a_		:		Union[str, Any]      				=      None
									if self.use_labels:
												a_		:		List[Any]      				=      ids_tensor([self.batch_size]   ,	self.type_sequence_label_size  )
												a_		:		Tuple      				=      ids_tensor([self.batch_size, self.seq_length]   ,	self.num_labels  )
												a_		:		Optional[int]      				=      ids_tensor([self.batch_size]   ,	self.num_choices  )

									a_		:		List[str]      				=      self.get_config()

									return config, input_ids, input_mask, sequence_labels, token_labels, choice_labels





						def        UpperCamelCase__ (  self  )			->      Optional[Any]:
									return SqueezeBertConfig(
									    embedding_size=self.hidden_size   ,	vocab_size=self.vocab_size   ,	hidden_size=self.hidden_size   ,	num_hidden_layers=self.num_hidden_layers   ,	num_attention_heads=self.num_attention_heads   ,	intermediate_size=self.intermediate_size   ,	hidden_act=self.hidden_act   ,	attention_probs_dropout_prob=self.hidden_dropout_prob   ,	attention_dropout=self.attention_probs_dropout_prob   ,	max_position_embeddings=self.max_position_embeddings   ,	initializer_range=self.initializer_range   ,	q_groups=self.q_groups   ,	k_groups=self.k_groups   ,	v_groups=self.v_groups   ,	post_attention_groups=self.post_attention_groups   ,	intermediate_groups=self.intermediate_groups   ,	output_groups=self.output_groups   ,	)





						def        UpperCamelCase__ (  self   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase  )			->      Any:
									a_		:		List[str]      				=      SqueezeBertModel(config=_lowercase  )
									model.to(_lowercase  )
									model.eval()
									a_		:		Optional[Any]      				=      model(_lowercase   ,	_lowercase  )
									a_		:		str      				=      model(_lowercase  )
									self.parent.assertEqual(result.last_hidden_state.shape   ,	(self.batch_size, self.seq_length, self.hidden_size)  )





						def        UpperCamelCase__ (  self   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase  )			->      Tuple:
									a_		:		List[str]      				=      SqueezeBertForMaskedLM(config=_lowercase  )
									model.to(_lowercase  )
									model.eval()
									a_		:		Any      				=      model(_lowercase   ,	attention_mask=_lowercase   ,	labels=_lowercase  )
									self.parent.assertEqual(result.logits.shape   ,	(self.batch_size, self.seq_length, self.vocab_size)  )





						def        UpperCamelCase__ (  self   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase  )			->      Tuple:
									a_		:		str      				=      SqueezeBertForQuestionAnswering(config=_lowercase  )
									model.to(_lowercase  )
									model.eval()
									a_		:		Optional[Any]      				=      model(
									    _lowercase   ,	attention_mask=_lowercase   ,	start_positions=_lowercase   ,	end_positions=_lowercase  )
									self.parent.assertEqual(result.start_logits.shape   ,	(self.batch_size, self.seq_length)  )
									self.parent.assertEqual(result.end_logits.shape   ,	(self.batch_size, self.seq_length)  )





						def        UpperCamelCase__ (  self   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase  )			->      Dict:
									a_		:		Tuple      				=      self.num_labels
									a_		:		Union[str, Any]      				=      SqueezeBertForSequenceClassification(_lowercase  )
									model.to(_lowercase  )
									model.eval()
									a_		:		Optional[Any]      				=      model(_lowercase   ,	attention_mask=_lowercase   ,	labels=_lowercase  )
									self.parent.assertEqual(result.logits.shape   ,	(self.batch_size, self.num_labels)  )





						def        UpperCamelCase__ (  self   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase  )			->      Tuple:
									a_		:		Any      				=      self.num_labels
									a_		:		Optional[int]      				=      SqueezeBertForTokenClassification(config=_lowercase  )
									model.to(_lowercase  )
									model.eval()

									a_		:		Dict      				=      model(_lowercase   ,	attention_mask=_lowercase   ,	labels=_lowercase  )
									self.parent.assertEqual(result.logits.shape   ,	(self.batch_size, self.seq_length, self.num_labels)  )





						def        UpperCamelCase__ (  self   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase   ,	_lowercase  )			->      Optional[int]:
									a_		:		Optional[Any]      				=      self.num_choices
									a_		:		Optional[Any]      				=      SqueezeBertForMultipleChoice(config=_lowercase  )
									model.to(_lowercase  )
									model.eval()
									a_		:		Optional[Any]      				=      input_ids.unsqueeze(1  ).expand(-1   ,	self.num_choices   ,	-1  ).contiguous()
									a_		:		Optional[int]      				=      input_mask.unsqueeze(1  ).expand(-1   ,	self.num_choices   ,	-1  ).contiguous()
									a_		:		str      				=      model(
									    _lowercase   ,	attention_mask=_lowercase   ,	labels=_lowercase   ,	)
									self.parent.assertEqual(result.logits.shape   ,	(self.batch_size, self.num_choices)  )





						def        UpperCamelCase__ (  self  )			->      str:
									a_		:		List[Any]      				=      self.prepare_config_and_inputs()
									((a_)				, (a_)				, (a_)				, (a_)				, (a_)				, (a_))		:		str      				=      config_and_inputs
									a_		:		Optional[int]      				=      {"""input_ids""": input_ids, """attention_mask""": input_mask}
									return config, inputs_dict







@require_torch
class     A__(a_,   a_,   unittest.TestCase				):
						"""simple docstring"""






						_A  :							int     =       (
						    (
						        SqueezeBertModel,
						        SqueezeBertForMaskedLM,
						        SqueezeBertForMultipleChoice,
						        SqueezeBertForQuestionAnswering,
						        SqueezeBertForSequenceClassification,
						        SqueezeBertForTokenClassification,
						    )
						    if is_torch_available()
						    else None
						)
						_A  :							Any     =       (
						    {
						        '''feature-extraction''': SqueezeBertModel,
						        '''fill-mask''': SqueezeBertForMaskedLM,
						        '''question-answering''': SqueezeBertForQuestionAnswering,
						        '''text-classification''': SqueezeBertForSequenceClassification,
						        '''token-classification''': SqueezeBertForTokenClassification,
						        '''zero-shot''': SqueezeBertForSequenceClassification,
						    }
						    if is_torch_available()
						    else {}
						)
						_A  :							int     =       False
						_A  :							Tuple     =       True
						_A  :							int     =       False





						def        UpperCamelCase__ (  self  )			->      List[Any]:
									a_		:		Dict      				=      SqueezeBertModelTester(self  )
									a_		:		Dict      				=      ConfigTester(self   ,	config_class=_lowercase   ,	dim=37  )





						def        UpperCamelCase__ (  self  )			->      Optional[int]:
									self.config_tester.run_common_tests()





						def        UpperCamelCase__ (  self  )			->      List[str]:
									a_		:		Any      				=      self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_squeezebert_model(*_lowercase  )





						def        UpperCamelCase__ (  self  )			->      Union[str, Any]:
									a_		:		Optional[int]      				=      self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_squeezebert_for_masked_lm(*_lowercase  )





						def        UpperCamelCase__ (  self  )			->      Tuple:
									a_		:		Optional[int]      				=      self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_squeezebert_for_question_answering(*_lowercase  )





						def        UpperCamelCase__ (  self  )			->      Optional[int]:
									a_		:		Tuple      				=      self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_squeezebert_for_sequence_classification(*_lowercase  )





						def        UpperCamelCase__ (  self  )			->      List[str]:
									a_		:		Any      				=      self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_squeezebert_for_token_classification(*_lowercase  )





						def        UpperCamelCase__ (  self  )			->      List[Any]:
									a_		:		int      				=      self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_squeezebert_for_multiple_choice(*_lowercase  )





						@slow
						def        UpperCamelCase__ (  self  )			->      Union[str, Any]:
									for model_name in SQUEEZEBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
												a_		:		Any      				=      SqueezeBertModel.from_pretrained(_lowercase  )
												self.assertIsNotNone(_lowercase  )







@require_sentencepiece
@require_tokenizers
@require_torch
class     A__(unittest.TestCase				):
						"""simple docstring"""






						@slow
						def        UpperCamelCase__ (  self  )			->      Dict:
									a_		:		Optional[int]      				=      SqueezeBertForSequenceClassification.from_pretrained("""squeezebert/squeezebert-mnli"""  )

									a_		:		Optional[int]      				=      torch.tensor([[1, 29_414, 232, 328, 740, 1_140, 12_695, 69, 13, 1_588, 2]]  )
									a_		:		Dict      				=      model(_lowercase  )[0]
									a_		:		Optional[Any]      				=      torch.Size((1, 3)  )
									self.assertEqual(output.shape   ,	_lowercase  )
									a_		:		List[str]      				=      torch.tensor([[0.6_4_0_1, -0.0_3_4_9, -0.6_0_4_1]]  )
									self.assertTrue(torch.allclose(_lowercase   ,	_lowercase   ,	atol=1e-4  )  )






import requests
from bsa import BeautifulSoup
def 				UpperCAmelCase_					(							__snake_case = "https://www.worldometers.info/coronavirus"						)     ->			dict:







 """simple docstring"""


 _lowercase							      =BeautifulSoup(requests.get(__snake_case						).text     ,						'''html.parser'''						)
 _lowercase							      =soup.findAll('''h1'''						)
 _lowercase							      =soup.findAll('''div'''     ,						{'''class''': '''maincounter-number'''}						)
 keys += soup.findAll('''span'''     ,						{'''class''': '''panel-title'''}						)
 values += soup.findAll('''div'''     ,						{'''class''': '''number-table-main'''}						)
 return {key.text.strip(): value.text.strip() for key, value in zip(__snake_case     ,						__snake_case						)}


if __name__ == "__main__":
  print('''\033[1m''' + '''COVID-19 Status of the World''' + '''\033[0m\n''')
  for key, value in world_covidaa_stats().items():
    print(f'''{key}\n{value}\n''')

