






import gc
import random
import unittest

import numpy as np
import torch
from PIL import Image
from transformers import XLMRobertaTokenizerFast

from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel
from diffusers.pipelines.kandinsky.text_encoder import MCLIPConfig, MultilingualCLIP
from diffusers.utils import floats_tensor, load_image, load_numpy, slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu

from ..test_pipelines_common import PipelineTesterMixin, assert_mean_pixel_difference


enable_full_determinism()
class 							A_    (						__lowercase ,   unittest.TestCase			):






 '''simple docstring'''




 _SCREAMING_SNAKE_CASE							:			Optional[Any] =					KandinskyImgaImgPipeline
 _SCREAMING_SNAKE_CASE							:			int =					["prompt", "image_embeds", "negative_image_embeds", "image"]
 _SCREAMING_SNAKE_CASE							:			Any =					[
     "prompt",
     "negative_prompt",
     "image_embeds",
     "negative_image_embeds",
     "image",
 ]
 _SCREAMING_SNAKE_CASE							:			str =					[
     "generator",
     "height",
     "width",
     "strength",
     "guidance_scale",
     "negative_prompt",
     "num_inference_steps",
     "return_dict",
     "guidance_scale",
     "num_images_per_prompt",
     "output_type",
     "return_dict",
 ]
 _SCREAMING_SNAKE_CASE							:			List[str] =					False


 @property
 def  snake_case__				(	self) ->		Optional[Any]:

     """simple docstring"""



     return 32


 @property
 def  snake_case__				(	self) ->		Any:

     """simple docstring"""



     return 32


 @property
 def  snake_case__				(	self) ->		Dict:

     """simple docstring"""



     return self.time_input_dim


 @property
 def  snake_case__				(	self) ->		List[Any]:

     """simple docstring"""



     return self.time_input_dim * 4


 @property
 def  snake_case__				(	self) ->		str:

     """simple docstring"""



     return 100


 @property
 def  snake_case__				(	self) ->		Union[str, Any]:

     """simple docstring"""



     _UpperCAmelCase				:      str			  =				XLMRobertaTokenizerFast.from_pretrained('''YiYiXu/tiny-random-mclip-base''')
     return tokenizer


 @property
 def  snake_case__				(	self) ->		Union[str, Any]:

     """simple docstring"""



     torch.manual_seed(0)
     _UpperCAmelCase				:      Optional[Any]			  =				MCLIPConfig(
         numDims=self.cross_attention_dim							,  transformerDimensions=self.text_embedder_hidden_size							,  hidden_size=self.text_embedder_hidden_size							,  intermediate_size=37							,  num_attention_heads=4							,  num_hidden_layers=5							,  vocab_size=1005							,  )

     _UpperCAmelCase				:      List[str]			  =				MultilingualCLIP(_A)
     _UpperCAmelCase				:      Optional[Any]			  =				text_encoder.eval()

     return text_encoder


 @property
 def  snake_case__				(	self) ->		Dict:

     """simple docstring"""



     torch.manual_seed(0)

     _UpperCAmelCase				:      Dict			  =				{
         '''in_channels''': 4,
         # Out channels is double in channels because predicts mean and variance
         '''out_channels''': 8,
         '''addition_embed_type''': '''text_image''',
         '''down_block_types''': ('''ResnetDownsampleBlock2D''', '''SimpleCrossAttnDownBlock2D'''),
         '''up_block_types''': ('''SimpleCrossAttnUpBlock2D''', '''ResnetUpsampleBlock2D'''),
         '''mid_block_type''': '''UNetMidBlock2DSimpleCrossAttn''',
         '''block_out_channels''': (self.block_out_channels_a, self.block_out_channels_a * 2),
         '''layers_per_block''': 1,
         '''encoder_hid_dim''': self.text_embedder_hidden_size,
         '''encoder_hid_dim_type''': '''text_image_proj''',
         '''cross_attention_dim''': self.cross_attention_dim,
         '''attention_head_dim''': 4,
         '''resnet_time_scale_shift''': '''scale_shift''',
         '''class_embed_type''': None,
     }

     _UpperCAmelCase				:      Optional[int]			  =				UNetaDConditionModel(**_A)
     return model


 @property
 def  snake_case__				(	self) ->		Tuple:

     """simple docstring"""



     return {
         "block_out_channels": [32, 64],
         "down_block_types": ["DownEncoderBlock2D", "AttnDownEncoderBlock2D"],
         "in_channels": 3,
         "latent_channels": 4,
         "layers_per_block": 1,
         "norm_num_groups": 8,
         "norm_type": "spatial",
         "num_vq_embeddings": 12,
         "out_channels": 3,
         "up_block_types": [
             "AttnUpDecoderBlock2D",
             "UpDecoderBlock2D",
         ],
         "vq_embed_dim": 4,
     }


 @property
 def  snake_case__				(	self) ->		Dict:

     """simple docstring"""



     torch.manual_seed(0)
     _UpperCAmelCase				:      List[Any]			  =				VQModel(**self.dummy_movq_kwargs)
     return model


 def  snake_case__				(	self) ->		Any:

     """simple docstring"""



     _UpperCAmelCase				:      str			  =				self.dummy_text_encoder
     _UpperCAmelCase				:      str			  =				self.dummy_tokenizer
     _UpperCAmelCase				:      Tuple			  =				self.dummy_unet
     _UpperCAmelCase				:      Tuple			  =				self.dummy_movq

     _UpperCAmelCase				:      Tuple			  =				{
         '''num_train_timesteps''': 1000,
         '''beta_schedule''': '''linear''',
         '''beta_start''': 0.00085,
         '''beta_end''': 0.012,
         '''clip_sample''': False,
         '''set_alpha_to_one''': False,
         '''steps_offset''': 0,
         '''prediction_type''': '''epsilon''',
         '''thresholding''': False,
     }

     _UpperCAmelCase				:      str			  =				DDIMScheduler(**_A)

     _UpperCAmelCase				:      Optional[int]			  =				{
         '''text_encoder''': text_encoder,
         '''tokenizer''': tokenizer,
         '''unet''': unet,
         '''scheduler''': scheduler,
         '''movq''': movq,
     }

     return components


 def  snake_case__				(	self							,  _A							,  _A=0) ->		Dict:

     """simple docstring"""



     _UpperCAmelCase				:      Any			  =				floats_tensor((1, self.cross_attention_dim)							,  rng=random.Random(_A)).to(_A)
     _UpperCAmelCase				:      List[str]			  =				floats_tensor((1, self.cross_attention_dim)							,  rng=random.Random(seed + 1)).to(_A)
     # create init_image
     _UpperCAmelCase				:      Dict			  =				floats_tensor((1, 3, 64, 64)							,  rng=random.Random(_A)).to(_A)
     _UpperCAmelCase				:      Any			  =				image.cpu().permute(0							,  2							,  3							,  1)[0]
     _UpperCAmelCase				:      List[str]			  =				Image.fromarray(np.uinta(_A)).convert('''RGB''').resize((256, 256))

     if str(_A).startswith('''mps'''):
         _UpperCAmelCase				:      Any			  =				torch.manual_seed(_A)
     else:
         _UpperCAmelCase				:      Tuple			  =				torch.Generator(device=_A).manual_seed(_A)
     _UpperCAmelCase				:      int			  =				{
         '''prompt''': '''horse''',
         '''image''': init_image,
         '''image_embeds''': image_embeds,
         '''negative_image_embeds''': negative_image_embeds,
         '''generator''': generator,
         '''height''': 64,
         '''width''': 64,
         '''num_inference_steps''': 10,
         '''guidance_scale''': 7.0,
         '''strength''': 0.2,
         '''output_type''': '''np''',
     }
     return inputs


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

     """simple docstring"""



     _UpperCAmelCase				:      Optional[int]			  =				'''cpu'''

     _UpperCAmelCase				:      int			  =				self.get_dummy_components()

     _UpperCAmelCase				:      Dict			  =				self.pipeline_class(**_A)
     _UpperCAmelCase				:      Dict			  =				pipe.to(_A)

     pipe.set_progress_bar_config(disable=_A)

     _UpperCAmelCase				:      Any			  =				pipe(**self.get_dummy_inputs(_A))
     _UpperCAmelCase				:      List[Any]			  =				output.images

     _UpperCAmelCase				:      Optional[int]			  =				pipe(
         **self.get_dummy_inputs(_A)							,  return_dict=_A							,  )[0]

     _UpperCAmelCase				:      Dict			  =				image[0, -3:, -3:, -1]
     _UpperCAmelCase				:      Tuple			  =				image_from_tuple[0, -3:, -3:, -1]

     assert image.shape == (1, 64, 64, 3)

     _UpperCAmelCase				:      Dict			  =				np.array(
         [0.61474943, 0.6073539, 0.43308544, 0.5928269, 0.47493595, 0.46755973, 0.4613838, 0.45368797, 0.50119233])
     assert (
         np.abs(image_slice.flatten() - expected_slice).max() < 1e-2
     ), f''' expected_slice {expected_slice}, but got {image_slice.flatten()}'''
     assert (
         np.abs(image_from_tuple_slice.flatten() - expected_slice).max() < 1e-2
     ), f''' expected_slice {expected_slice}, but got {image_from_tuple_slice.flatten()}'''



@slow
@require_torch_gpu
class 							A_    (						unittest.TestCase			):






 '''simple docstring'''




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

     """simple docstring"""



     super().tearDown()
     gc.collect()
     torch.cuda.empty_cache()


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

     """simple docstring"""



     _UpperCAmelCase				:      int			  =				load_numpy(
         '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'''
         '''/kandinsky/kandinsky_img2img_frog.npy''')

     _UpperCAmelCase				:      int			  =				load_image(
         '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main''' '''/kandinsky/cat.png''')
     _UpperCAmelCase				:      Tuple			  =				'''A red cartoon frog, 4k'''

     _UpperCAmelCase				:      Dict			  =				KandinskyPriorPipeline.from_pretrained(
         '''kandinsky-community/kandinsky-2-1-prior'''							,  torch_dtype=torch.floataa)
     pipe_prior.to(_A)

     _UpperCAmelCase				:      str			  =				KandinskyImgaImgPipeline.from_pretrained(
         '''kandinsky-community/kandinsky-2-1'''							,  torch_dtype=torch.floataa)
     _UpperCAmelCase				:      str			  =				pipeline.to(_A)

     pipeline.set_progress_bar_config(disable=_A)

     _UpperCAmelCase				:      List[Any]			  =				torch.Generator(device='''cpu''').manual_seed(0)
     _UpperCAmelCase  , _UpperCAmelCase				:      str			  =				pipe_prior(
         _A							,  generator=_A							,  num_inference_steps=5							,  negative_prompt=''''''							,  ).to_tuple()

     _UpperCAmelCase				:      Dict			  =				pipeline(
         _A							,  image=_A							,  image_embeds=_A							,  negative_image_embeds=_A							,  generator=_A							,  num_inference_steps=100							,  height=768							,  width=768							,  strength=0.2							,  output_type='''np'''							,  )

     _UpperCAmelCase				:      List[Any]			  =				output.images[0]

     assert image.shape == (768, 768, 3)

     assert_mean_pixel_difference(_A							,  _A)












import collections
import json
import math
import os
import re
import time
from fnmatch import fnmatch
from typing import Dict

import requests
from slack_sdk import WebClient


SCREAMING_SNAKE_CASE 							=						WebClient(token=os.environ['CI_SLACK_BOT_TOKEN'])

def      _lowerCamelCase	(						__A    :							Optional[Any] )      ->					int:
    _UpperCAmelCase				:      Optional[int]			  =				test_results.split(''' ''' )

    _UpperCAmelCase				:      Optional[int]			  =				0
    _UpperCAmelCase				:      Union[str, Any]			  =				0

    # When the output is short enough, the output is surrounded by = signs: "== OUTPUT =="
    # When it is too long, those signs are not present.
    _UpperCAmelCase				:      Tuple			  =				expressions[-2] if '''=''' in expressions[-1] else expressions[-1]

    for i, expression in enumerate(__A ):
        if "failed" in expression:
            failed += int(expressions[i - 1] )
        if "passed" in expression:
            success += int(expressions[i - 1] )

    return failed, success, time_spent

def      _lowerCamelCase	(						__A    :							List[str] )      ->					int:
    _UpperCAmelCase				:      Optional[Any]			  =				{}
    _UpperCAmelCase				:      int			  =				None
    _UpperCAmelCase				:      Any			  =				False
    for line in failures_short_lines.split('''\n''' ):
        if re.search(r'''_ \[doctest\]'''		,		__A ):
            _UpperCAmelCase				:      Tuple			  =				True
            _UpperCAmelCase				:      Optional[Any]			  =				line.split(''' ''' )[2]
        elif in_error and not line.split(''' ''' )[0].isdigit():
            _UpperCAmelCase				:      int			  =				line
            _UpperCAmelCase				:      Optional[Any]			  =				False

    return failures
class 							A_    :






 '''simple docstring'''




 def __init__(	self							,  _A							,  _A) ->		Optional[int]:

     """simple docstring"""



     _UpperCAmelCase				:      Tuple			  =				title

     _UpperCAmelCase				:      List[str]			  =				doc_test_results['''time_spent'''].split(''',''')[0]
     _UpperCAmelCase				:      List[Any]			  =				doc_test_results['''success''']
     _UpperCAmelCase				:      Optional[Any]			  =				doc_test_results['''failures''']
     _UpperCAmelCase				:      Tuple			  =				self.n_success + self.n_failures

     # Failures and success of the modeling tests
     _UpperCAmelCase				:      Optional[int]			  =				doc_test_results


 @property
 def  snake_case__				(	self) ->		str:

     """simple docstring"""



     _UpperCAmelCase				:      List[str]			  =				[self._time_spent]
     _UpperCAmelCase				:      Dict			  =				0

     for time in time_spent:
         _UpperCAmelCase				:      Optional[int]			  =				time.split(''':''')

         # Time can be formatted as xx:xx:xx, as .xx, or as x.xx if the time spent was less than a minute.
         if len(_A) == 1:
             _UpperCAmelCase				:      List[Any]			  =				[0, 0, time_parts[0]]

         _UpperCAmelCase  , _UpperCAmelCase  , _UpperCAmelCase				:      Optional[int]			  =				int(time_parts[0]), int(time_parts[1]), float(time_parts[2])
         total_secs += hours * 3600 + minutes * 60 + seconds

     _UpperCAmelCase  , _UpperCAmelCase  , _UpperCAmelCase				:      Dict			  =				total_secs // 3600, (total_secs % 3600) // 60, total_secs % 60
     return f'''{int(_A)}h{int(_A)}m{int(_A)}s'''


 @property
 def  snake_case__				(	self) ->		Dict:

     """simple docstring"""



     return {"type": "header", "text": {"type": "plain_text", "text": self.title}}


 @property
 def  snake_case__				(	self) ->		Dict:

     """simple docstring"""



     return {
         "type": "section",
         "text": {
             "type": "plain_text",
             "text": f'''🌞 There were no failures: all {self.n_tests} tests passed. The suite ran in {self.time}.''',
             "emoji": True,
         },
         "accessory": {
             "type": "button",
             "text": {"type": "plain_text", "text": "Check Action results", "emoji": True},
             "url": f'''https://github.com/huggingface/transformers/actions/runs/{os.environ['GITHUB_RUN_ID']}''',
         },
     }


 @property
 def  snake_case__				(	self) ->		Dict:

     """simple docstring"""



     return {
         "type": "section",
         "text": {
             "type": "plain_text",
             "text": (
                 f'''There were {self.n_failures} failures, out of {self.n_tests} tests.\nThe suite ran in'''
                 f''' {self.time}.'''
             ),
             "emoji": True,
         },
         "accessory": {
             "type": "button",
             "text": {"type": "plain_text", "text": "Check Action results", "emoji": True},
             "url": f'''https://github.com/huggingface/transformers/actions/runs/{os.environ['GITHUB_RUN_ID']}''',
         },
     }


 @property
 def  snake_case__				(	self) ->		Dict:

     """simple docstring"""



     _UpperCAmelCase				:      List[str]			  =				40
     _UpperCAmelCase				:      List[str]			  =				{k: v['''failed'''] for k, v in doc_test_results.items() if isinstance(_A							,  _A)}

     _UpperCAmelCase				:      List[Any]			  =				''''''
     for category, failures in category_failures.items():
         if len(_A) == 0:
             continue

         if report != "":
             report += "\n\n"

         report += f'''*{category} failures*:'''.ljust(line_length // 2).rjust(line_length // 2) + "\n"
         report += "`"
         report += "`\n`".join(_A)
         report += "`"

     return {
         "type": "section",
         "text": {
             "type": "mrkdwn",
             "text": f'''The following examples had failures:\n\n\n{report}\n''',
         },
     }


 @property
 def  snake_case__				(	self) ->		str:

     """simple docstring"""



     _UpperCAmelCase				:      int			  =				[self.header]

     if self.n_failures > 0:
         blocks.append(self.failures)

     if self.n_failures > 0:
         blocks.extend([self.category_failures])

     if self.n_failures == 0:
         blocks.append(self.no_failures)

     return json.dumps(_A)


 @staticmethod
 def  snake_case__				(	) ->		List[str]:

     """simple docstring"""



     _UpperCAmelCase				:      Union[str, Any]			  =				[
         {
             '''type''': '''section''',
             '''text''': {
                 '''type''': '''plain_text''',
                 '''text''': '''There was an issue running the tests.''',
             },
             '''accessory''': {
                 '''type''': '''button''',
                 '''text''': {'''type''': '''plain_text''', '''text''': '''Check Action results''', '''emoji''': True},
                 '''url''': f'''https://github.com/huggingface/transformers/actions/runs/{os.environ['GITHUB_RUN_ID']}''',
             },
         }
     ]

     print('''Sending the following payload''')
     print(json.dumps({'''blocks''': json.loads(_A)}))

     client.chat_postMessage(
         channel=os.environ['''CI_SLACK_CHANNEL_ID_DAILY''']							,  text='''There was an issue running the tests.'''							,  blocks=_A							,  )


 def  snake_case__				(	self) ->		str:

     """simple docstring"""



     print('''Sending the following payload''')
     print(json.dumps({'''blocks''': json.loads(self.payload)}))

     _UpperCAmelCase				:      str			  =				f'''{self.n_failures} failures out of {self.n_tests} tests,''' if self.n_failures else '''All tests passed.'''

     _UpperCAmelCase				:      Optional[Any]			  =				client.chat_postMessage(
         channel=os.environ['''CI_SLACK_CHANNEL_ID_DAILY''']							,  blocks=self.payload							,  text=_A							,  )


 def  snake_case__				(	self							,  _A							,  _A							,  _A							,  _A) ->		Dict:

     """simple docstring"""



     _UpperCAmelCase				:      Optional[int]			  =				''''''
     for key, value in failures.items():
         _UpperCAmelCase				:      str			  =				value[:200] + ''' [Truncated]''' if len(_A) > 250 else value
         failures_text += f'''*{key}*\n_{value}_\n\n'''

     _UpperCAmelCase				:      Optional[Any]			  =				job_name
     _UpperCAmelCase				:      Any			  =				{'''type''': '''section''', '''text''': {'''type''': '''mrkdwn''', '''text''': text}}

     if job_link is not None:
         _UpperCAmelCase				:      List[Any]			  =				{
             '''type''': '''button''',
             '''text''': {'''type''': '''plain_text''', '''text''': '''GitHub Action job''', '''emoji''': True},
             '''url''': job_link,
         }

     return [
         {"type": "header", "text": {"type": "plain_text", "text": title.upper(), "emoji": True}},
         content,
         {"type": "section", "text": {"type": "mrkdwn", "text": failures_text}},
     ]


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

     """simple docstring"""



     if self.thread_ts is None:
         raise ValueError('''Can only post reply if a post has been made.''')

     _UpperCAmelCase				:      Tuple			  =				self.doc_test_results.pop('''job_link''')
     self.doc_test_results.pop('''failures''')
     self.doc_test_results.pop('''success''')
     self.doc_test_results.pop('''time_spent''')

     _UpperCAmelCase				:      Any			  =				sorted(self.doc_test_results.items()							,  key=lambda _A: t[0])
     for job, job_result in sorted_dict:
         if len(job_result['''failures''']):
             _UpperCAmelCase				:      Dict			  =				f'''*Num failures* :{len(job_result['failed'])} \n'''
             _UpperCAmelCase				:      Tuple			  =				job_result['''failures''']
             _UpperCAmelCase				:      Dict			  =				self.get_reply_blocks(_A							,  _A							,  _A							,  text=_A)

             print('''Sending the following reply''')
             print(json.dumps({'''blocks''': blocks}))

             client.chat_postMessage(
                 channel=os.environ['''CI_SLACK_CHANNEL_ID_DAILY''']							,  text=f'''Results for {job}'''							,  blocks=_A							,  thread_ts=self.thread_ts['''ts''']							,  )

             time.sleep(1)



def      _lowerCamelCase	(						)      ->					str:
    _UpperCAmelCase				:      Any			  =				os.environ['''GITHUB_RUN_ID''']
    _UpperCAmelCase				:      Any			  =				f'''https://api.github.com/repos/huggingface/transformers/actions/runs/{run_id}/jobs?per_page=100'''
    _UpperCAmelCase				:      Optional[int]			  =				requests.get(__A ).json()
    _UpperCAmelCase				:      Optional[int]			  =				{}

    try:
        jobs.update({job['''name''']: job['''html_url'''] for job in result['''jobs''']} )
        _UpperCAmelCase				:      int			  =				math.ceil((result['''total_count'''] - 100) / 100 )

        for i in range(__A ):
            _UpperCAmelCase				:      int			  =				requests.get(url + f'''&page={i + 2}''' ).json()
            jobs.update({job['''name''']: job['''html_url'''] for job in result['''jobs''']} )

        return jobs
    except Exception as e:
        print('''Unknown error, could not fetch links.'''		,		__A )

    return {}

def      _lowerCamelCase	(						__A    :							str )      ->					Tuple:
    _UpperCAmelCase				:      Optional[Any]			  =				{}

    if os.path.exists(__A ):
        _UpperCAmelCase				:      Optional[int]			  =				os.listdir(__A )
        for file in files:
            try:
                with open(os.path.join(__A		,		__A )		,		encoding='''utf-8''' ) as f:
                    _UpperCAmelCase				:      Tuple			  =				f.read()
            except UnicodeDecodeError as e:
                raise ValueError(f'''Could not open {os.path.join(__A		,		__A )}.''' ) from e

    return _artifact

def      _lowerCamelCase	(						)      ->					List[str]:
    class 							A_    :






     '''simple docstring'''




     def __init__(	self							,  _A) ->		int:

         """simple docstring"""



         _UpperCAmelCase				:      List[Any]			  =				name
         _UpperCAmelCase				:      Union[str, Any]			  =				[]


     def __str__(	self) ->		int:

         """simple docstring"""



         return self.name


     def  snake_case__				(	self							,  _A) ->		int:

         """simple docstring"""



         self.paths.append({'''name''': self.name, '''path''': path})



    _UpperCAmelCase				:      Dict[str, Artifact]			  =				{}

    _UpperCAmelCase				:      Dict			  =				filter(os.path.isdir		,		os.listdir() )
    for directory in directories:
        _UpperCAmelCase				:      List[str]			  =				directory
        if artifact_name not in _available_artifacts:
            _UpperCAmelCase				:      Optional[int]			  =				Artifact(__A )

            _available_artifacts[artifact_name].add_path(__A )

    return _available_artifacts


if __name__ == "__main__":
  SCREAMING_SNAKE_CASE 							=						get_job_links()
  SCREAMING_SNAKE_CASE 							=						retrieve_available_artifacts()

  SCREAMING_SNAKE_CASE 							=						collections.OrderedDict(
      [
          ('*.py', 'API Examples'),
          ('*.md', 'MD Examples'),
      ]
  )

  # This dict will contain all the information relative to each doc test category:
  # - failed: list of failed tests
  # - failures: dict in the format 'test': 'error_message'
  SCREAMING_SNAKE_CASE 							=						{
      v: {
          'failed': [],
          'failures': {},
      }
      for v in docs.values()
  }

  # Link to the GitHub Action job
  SCREAMING_SNAKE_CASE 							=						github_actions_job_links.get('run_doctests')

  SCREAMING_SNAKE_CASE 							=						available_artifacts['doc_tests_gpu_test_reports'].paths[0]
  SCREAMING_SNAKE_CASE 							=						retrieve_artifact(artifact_path['name'])
  if "stats" in artifact:
    SCREAMING_SNAKE_CASE							,			SCREAMING_SNAKE_CASE							,			SCREAMING_SNAKE_CASE 							=						handle_test_results(artifact['stats'])
    SCREAMING_SNAKE_CASE 							=						failed
    SCREAMING_SNAKE_CASE 							=						success
    SCREAMING_SNAKE_CASE 							=						time_spent[1:-1] + ', '

    SCREAMING_SNAKE_CASE 							=						extract_first_line_failure(artifact['failures_short'])
    for line in artifact["summary_short"].split('\n'):
      if re.search('FAILED', line):
        SCREAMING_SNAKE_CASE 							=						line.replace('FAILED ', '')
        SCREAMING_SNAKE_CASE 							=						line.split()[0].replace('\n', '')

        if "::" in line:
          SCREAMING_SNAKE_CASE							,			SCREAMING_SNAKE_CASE 							=						line.split('::')
        else:
          SCREAMING_SNAKE_CASE							,			SCREAMING_SNAKE_CASE 							=						line, line

        for file_regex in docs.keys():
          if fnmatch(file_path, file_regex):
            SCREAMING_SNAKE_CASE 							=						docs[file_regex]
            doc_test_results[category]["failed"].append(test)

            SCREAMING_SNAKE_CASE 							=						all_failures[test] if test in all_failures else 'N/A'
            SCREAMING_SNAKE_CASE 							=						failure
            break

  SCREAMING_SNAKE_CASE 							=						Message('🤗 Results of the doc tests.', doc_test_results)
  message.post()
  message.post_reply()




