


"""simple docstring"""




import requests





def       a_ (	lowercase__ :str,			lowercase__ :str     ):
			__lowerCamelCase          =      {"""Content-Type""": """application/json"""}
			__lowerCamelCase          =      requests.post(lowercase__,			json={"""text""": message_body},			headers=lowercase__     )
			if response.status_code != 200:
						__lowerCamelCase          =      (
						    """Request to slack returned an error """
						    f'{response.status_code}, the response is:\n{response.text}'
						)
						raise ValueError(lowercase__     )


if __name__ == "__main__":
					# Set the slack url to the one provided by Slack when you create the webhook at
					# https://my.slack.com/services/new/incoming-webhook/
					send_slack_message('<YOUR MESSAGE BODY>', '<SLACK CHANNEL URL>')








"""simple docstring"""




import json
import os
import tempfile

from transformers.testing_utils import check_json_file_has_correct_format




class 			__snake_case   :
							__a					 =       None




							def   __a   (     self:    int   ):
										__lowerCamelCase          =      self.feature_extraction_class(**self.feat_extract_dict   )
										__lowerCamelCase          =      json.loads(feat_extract.to_json_string()   )
										for key, value in self.feat_extract_dict.items():
													self.assertEqual(obj[key]     ,							A_   )




							def   __a   (     self:    List[str]   ):
										__lowerCamelCase          =      self.feature_extraction_class(**self.feat_extract_dict   )

										with tempfile.TemporaryDirectory() as tmpdirname:
													__lowerCamelCase          =      os.path.join(A_     ,							"""feat_extract.json"""   )
													feat_extract_first.to_json_file(A_   )
													__lowerCamelCase          =      self.feature_extraction_class.from_json_file(A_   )

										self.assertEqual(feat_extract_second.to_dict()     ,							feat_extract_first.to_dict()   )




							def   __a   (     self:    Optional[Any]   ):
										__lowerCamelCase          =      self.feature_extraction_class(**self.feat_extract_dict   )

										with tempfile.TemporaryDirectory() as tmpdirname:
													__lowerCamelCase          =      feat_extract_first.save_pretrained(A_   )[0]
													check_json_file_has_correct_format(A_   )
													__lowerCamelCase          =      self.feature_extraction_class.from_pretrained(A_   )

										self.assertEqual(feat_extract_second.to_dict()     ,							feat_extract_first.to_dict()   )




							def   __a   (     self:    List[Any]   ):
										__lowerCamelCase          =      self.feature_extraction_class()
										self.assertIsNotNone(A_   )




