



import itertools
import os
import random
import tempfile
import unittest

import numpy as np
from datasets import load_dataset

from transformers import is_speech_available
from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio
from transformers.utils.import_utils import is_torch_available

from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin


if is_speech_available():
		from transformers import WhisperFeatureExtractor

if is_torch_available():
		import torch

_lowercase		:				str      		=random.Random()

def      lowerCAmelCase_					(  _lowercase    :       List[str]						,       _lowercase    :       List[str]=1.0						,       _lowercase    :       Optional[Any]=None						,       _lowercase    :       List[Any]=None)							->	Optional[int]:







			"""simple docstring"""
			if rng is None:
						a__       :						List[str]							=  global_rng

			a__       :						List[Any]							=  []
			for batch_idx in range(shape[0]):
						values.append([])
						for _ in range(shape[1]):
									values[-1].append(rng.random() * scale)

			return values

@require_torch
@require_torchaudio
class        snake_case__    (unittest.TestCase		):







						"""simple docstring"""




						def __init__(       self ,       __lowercase ,       __lowercase=7 ,       __lowercase=4_0_0 ,       __lowercase=2_0_0_0 ,       __lowercase=1_0 ,       __lowercase=1_6_0 ,       __lowercase=8 ,       __lowercase=0.0 ,       __lowercase=4_0_0_0 ,       __lowercase=False ,       __lowercase=True ,       ) ->				Union[str, Any]:
									"""simple docstring"""




									a__       :						Dict							=  parent
									a__       :						List[Any]							=  batch_size
									a__       :						List[Any]							=  min_seq_length
									a__       :						int							=  max_seq_length
									a__       :						str							=  (self.max_seq_length - self.min_seq_length) // (self.batch_size - 1)
									a__       :						Union[str, Any]							=  padding_value
									a__       :						Dict							=  sampling_rate
									a__       :						Any							=  return_attention_mask
									a__       :						Tuple							=  do_normalize
									a__       :						List[str]							=  feature_size
									a__       :						int							=  chunk_length
									a__       :						Optional[Any]							=  hop_length

						def 							SCREAMING_SNAKE_CASE__(       self  ) ->				str:
									"""simple docstring"""




									return {
									    "feature_size": self.feature_size,
									    "hop_length": self.hop_length,
									    "chunk_length": self.chunk_length,
									    "padding_value": self.padding_value,
									    "sampling_rate": self.sampling_rate,
									    "return_attention_mask": self.return_attention_mask,
									    "do_normalize": self.do_normalize,
									}

						def 							SCREAMING_SNAKE_CASE__(       self ,       __lowercase=False ,       __lowercase=False  ) ->				Optional[int]:
									"""simple docstring"""




									def _flatten(__lowercase  ):
												return list(itertools.chain(*__lowercase  )  )

									if equal_length:
												a__       :						str							=  [floats_list((self.max_seq_length, self.feature_size)  ) for _ in range(self.batch_size  )]
									else:
												# make sure that inputs increase in size
												a__       :						Union[str, Any]							=  [
												    floats_list((x, self.feature_size)  )
												    for x in range(self.min_seq_length ,       self.max_seq_length ,       self.seq_length_diff  )
												]
									if numpify:
												a__       :						Tuple							=  [np.asarray(__lowercase  ) for x in speech_inputs]
									return speech_inputs




@require_torch
@require_torchaudio
class        snake_case__    (A__ ,     unittest.TestCase		):







						"""simple docstring"""




						__lowerCAmelCase					:Optional[Any]      =					WhisperFeatureExtractor if is_speech_available() else None

						def 							SCREAMING_SNAKE_CASE__(       self  ) ->				Union[str, Any]:
									"""simple docstring"""




									a__       :						List[Any]							=  WhisperFeatureExtractionTester(self  )

						def 							SCREAMING_SNAKE_CASE__(       self  ) ->				Union[str, Any]:
									"""simple docstring"""




									a__       :						Optional[int]							=  self.feature_extraction_class(**self.feat_extract_dict  )

									with tempfile.TemporaryDirectory() as tmpdirname:
												a__       :						int							=  feat_extract_first.save_pretrained(__lowercase  )[0]
												check_json_file_has_correct_format(__lowercase  )
												a__       :						Optional[int]							=  self.feature_extraction_class.from_pretrained(__lowercase  )

									a__       :						Optional[Any]							=  feat_extract_first.to_dict()
									a__       :						Union[str, Any]							=  feat_extract_second.to_dict()
									a__       :						int							=  feat_extract_first.mel_filters
									a__       :						Union[str, Any]							=  feat_extract_second.mel_filters
									self.assertTrue(np.allclose(__lowercase ,       __lowercase  )  )
									self.assertEqual(__lowercase ,       __lowercase  )

						def 							SCREAMING_SNAKE_CASE__(       self  ) ->				List[Any]:
									"""simple docstring"""




									a__       :						Any							=  self.feature_extraction_class(**self.feat_extract_dict  )

									with tempfile.TemporaryDirectory() as tmpdirname:
												a__       :						Union[str, Any]							=  os.path.join(__lowercase ,       """feat_extract.json"""  )
												feat_extract_first.to_json_file(__lowercase  )
												a__       :						Any							=  self.feature_extraction_class.from_json_file(__lowercase  )

									a__       :						str							=  feat_extract_first.to_dict()
									a__       :						Tuple							=  feat_extract_second.to_dict()
									a__       :						Any							=  feat_extract_first.mel_filters
									a__       :						Tuple							=  feat_extract_second.mel_filters
									self.assertTrue(np.allclose(__lowercase ,       __lowercase  )  )
									self.assertEqual(__lowercase ,       __lowercase  )

						def 							SCREAMING_SNAKE_CASE__(       self  ) ->				Optional[Any]:
									"""simple docstring"""




									a__       :						int							=  self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()  )
									# create three inputs of length 800, 1000, and 1200
									a__       :						Optional[Any]							=  [floats_list((1, x)  )[0] for x in range(8_0_0 ,       1_4_0_0 ,       2_0_0  )]
									a__       :						Optional[Any]							=  [np.asarray(__lowercase  ) for speech_input in speech_inputs]

									# Test feature size
									a__       :						List[str]							=  feature_extractor(__lowercase ,       padding="""max_length""" ,       return_tensors="""np"""  ).input_features
									self.assertTrue(input_features.ndim == 3  )
									self.assertTrue(input_features.shape[-1] == feature_extractor.nb_max_frames  )
									self.assertTrue(input_features.shape[-2] == feature_extractor.feature_size  )

									# Test not batched input
									a__       :						List[Any]							=  feature_extractor(speech_inputs[0] ,       return_tensors="""np"""  ).input_features
									a__       :						List[Any]							=  feature_extractor(np_speech_inputs[0] ,       return_tensors="""np"""  ).input_features
									self.assertTrue(np.allclose(__lowercase ,       __lowercase ,       atol=1E-3  )  )

									# Test batched
									a__       :						List[Any]							=  feature_extractor(__lowercase ,       return_tensors="""np"""  ).input_features
									a__       :						str							=  feature_extractor(__lowercase ,       return_tensors="""np"""  ).input_features
									for enc_seq_a, enc_seq_a in zip(__lowercase ,       __lowercase  ):
												self.assertTrue(np.allclose(__lowercase ,       __lowercase ,       atol=1E-3  )  )

									# Test 2-D numpy arrays are batched.
									a__       :						Any							=  [floats_list((1, x)  )[0] for x in (8_0_0, 8_0_0, 8_0_0)]
									a__       :						Tuple							=  np.asarray(__lowercase  )
									a__       :						Optional[int]							=  feature_extractor(__lowercase ,       return_tensors="""np"""  ).input_features
									a__       :						str							=  feature_extractor(__lowercase ,       return_tensors="""np"""  ).input_features
									for enc_seq_a, enc_seq_a in zip(__lowercase ,       __lowercase  ):
												self.assertTrue(np.allclose(__lowercase ,       __lowercase ,       atol=1E-3  )  )

									# Test truncation required
									a__       :						int							=  [floats_list((1, x)  )[0] for x in range(2_0_0 ,       (feature_extractor.n_samples + 5_0_0) ,       2_0_0  )]
									a__       :						Tuple							=  [np.asarray(__lowercase  ) for speech_input in speech_inputs]

									a__       :						str							=  [x[: feature_extractor.n_samples] for x in speech_inputs]
									a__       :						Any							=  [np.asarray(__lowercase  ) for speech_input in speech_inputs_truncated]

									a__       :						str							=  feature_extractor(__lowercase ,       return_tensors="""np"""  ).input_features
									a__       :						Union[str, Any]							=  feature_extractor(__lowercase ,       return_tensors="""np"""  ).input_features
									for enc_seq_a, enc_seq_a in zip(__lowercase ,       __lowercase  ):
												self.assertTrue(np.allclose(__lowercase ,       __lowercase ,       atol=1E-3  )  )

						def 							SCREAMING_SNAKE_CASE__(       self  ) ->				Union[str, Any]:
									"""simple docstring"""




									import torch

									a__       :						Optional[int]							=  self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()  )
									a__       :						Optional[int]							=  np.random.rand(1_0_0 ,       3_2  ).astype(np.floataa  )
									a__       :						Optional[int]							=  np_speech_inputs.tolist()

									for inputs in [py_speech_inputs, np_speech_inputs]:
												a__       :						List[Any]							=  feature_extractor.pad([{"""input_features""": inputs}] ,       return_tensors="""np"""  )
												self.assertTrue(np_processed.input_features.dtype == np.floataa  )
												a__       :						List[str]							=  feature_extractor.pad([{"""input_features""": inputs}] ,       return_tensors="""pt"""  )
												self.assertTrue(pt_processed.input_features.dtype == torch.floataa  )

						def 							SCREAMING_SNAKE_CASE__(       self ,       __lowercase  ) ->				str:
									"""simple docstring"""




									a__       :						Union[str, Any]							=  load_dataset("""hf-internal-testing/librispeech_asr_dummy""" ,       """clean""" ,       split="""validation"""  )
									# automatic decoding with librispeech
									a__       :						Tuple							=  ds.sort("""id"""  ).select(range(__lowercase  )  )[:num_samples]["""audio"""]

									return [x["array"] for x in speech_samples]

						def 							SCREAMING_SNAKE_CASE__(       self  ) ->				Union[str, Any]:
									"""simple docstring"""




									a__       :						Tuple							=  torch.tensor(
									    [
									        0.1_1_9_3, -0.0_9_4_6, -0.1_0_9_8, -0.0_1_9_6, 0.0_2_2_5, -0.0_6_9_0, -0.1_7_3_6, 0.0_9_5_1,
									        0.0_9_7_1, -0.0_8_1_7, -0.0_7_0_2, 0.0_1_6_2, 0.0_2_6_0, 0.0_0_1_7, -0.0_1_9_2, -0.1_6_7_8,
									        0.0_7_0_9, -0.1_8_6_7, -0.0_6_5_5, -0.0_2_7_4, -0.0_2_3_4, -0.1_8_8_4, -0.0_5_1_6, -0.0_5_5_4,
									        -0.0_2_7_4, -0.1_4_2_5, -0.1_4_2_3, 0.0_8_3_7, 0.0_3_7_7, -0.0_8_5_4
									    ]  )
									# fmt: on

									a__       :						Tuple							=  self._load_datasamples(1  )
									a__       :						Union[str, Any]							=  WhisperFeatureExtractor()
									a__       :						List[Any]							=  feature_extractor(__lowercase ,       return_tensors="""pt"""  ).input_features
									self.assertEqual(input_features.shape ,       (1, 8_0, 3_0_0_0)  )
									self.assertTrue(torch.allclose(input_features[0, 0, :3_0] ,       __lowercase ,       atol=1E-4  )  )

						def 							SCREAMING_SNAKE_CASE__(       self  ) ->				Union[str, Any]:
									"""simple docstring"""




									a__       :						Union[str, Any]							=  self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()  )
									a__       :						Optional[int]							=  self._load_datasamples(1  )[0]
									a__       :						List[str]							=  ((audio - audio.min()) / (audio.max() - audio.min())) * 6_5_5_3_5  # Rescale to [0, 65535] to show issue
									a__       :						Optional[int]							=  feat_extract.zero_mean_unit_var_norm([audio] ,       attention_mask=__lowercase  )[0]

									self.assertTrue(np.all(np.mean(__lowercase  ) < 1E-3  )  )
									self.assertTrue(np.all(np.abs(np.var(__lowercase  ) - 1  ) < 1E-3  )  )





import asyncio
import os
import shutil
import subprocess
import sys
import tempfile
import unittest
from distutils.util import strtobool
from functools import partial
from pathlib import Path
from typing import List, Union
from unittest import mock

import torch

from ..state import AcceleratorState, PartialState
from ..utils import (
    gather,
    is_bnb_available,
    is_comet_ml_available,
    is_datasets_available,
    is_deepspeed_available,
    is_mps_available,
    is_safetensors_available,
    is_tensorboard_available,
    is_torch_version,
    is_tpu_available,
    is_transformers_available,
    is_wandb_available,
    is_xpu_available,
)

def      lowerCAmelCase_					(  _lowercase    :       Union[str, Any]						,       _lowercase    :       Dict=False)							->	Any:







			"""simple docstring"""
			try:
						a__       :						str							=  os.environ[key]
			except KeyError:
						# KEY isn't set, default to `default`.
						a__       :						Optional[int]							=  default
			else:
						# KEY is set, convert it to True or False.
						try:
									a__       :						Optional[int]							=  strtobool(_lowercase)
						except ValueError:
									# More values are supported, but let's keep the message simple.
									raise ValueError(F'''If set, {key} must be yes or no.''')
			return _value


_lowercase		:				Dict      		=parse_flag_from_env("RUN_SLOW", default=False)

def      lowerCAmelCase_					(  _lowercase    :       Any)							->	str:







			"""simple docstring"""
			return unittest.skip("""Test was skipped""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       str)							->	List[str]:







			"""simple docstring"""
			return unittest.skipUnless(_run_slow_tests						,       """test is slow""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       List[Any])							->	Union[str, Any]:







			"""simple docstring"""
			return unittest.skipUnless(not torch.cuda.is_available()						,       """test requires only a CPU""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       List[Any])							->	List[Any]:







			"""simple docstring"""
			return unittest.skipUnless(torch.cuda.is_available()						,       """test requires a GPU""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       Optional[int])							->	Dict:







			"""simple docstring"""
			return unittest.skipUnless(is_xpu_available()						,       """test requires a XPU""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       Tuple)							->	List[str]:







			"""simple docstring"""
			return unittest.skipUnless(is_mps_available()						,       """test requires a `mps` backend support in `torch`""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       Dict)							->	Union[str, Any]:







			"""simple docstring"""
			return unittest.skipUnless(
			    is_transformers_available() and is_datasets_available()						,       """test requires the Hugging Face suite""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       Tuple)							->	Any:







			"""simple docstring"""
			return unittest.skipUnless(is_bnb_available()						,       """test requires the bitsandbytes library""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       Union[str, Any])							->	List[str]:







			"""simple docstring"""
			return unittest.skipUnless(is_tpu_available()						,       """test requires TPU""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       str)							->	int:







			"""simple docstring"""
			return unittest.skipUnless(torch.cuda.device_count() == 1						,       """test requires a GPU""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       Any)							->	List[str]:







			"""simple docstring"""
			return unittest.skipUnless(torch.xpu.device_count() == 1						,       """test requires a XPU""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       Union[str, Any])							->	Union[str, Any]:







			"""simple docstring"""
			return unittest.skipUnless(torch.cuda.device_count() > 1						,       """test requires multiple GPUs""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       int)							->	Tuple:







			"""simple docstring"""
			return unittest.skipUnless(torch.xpu.device_count() > 1						,       """test requires multiple XPUs""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       int)							->	Optional[Any]:







			"""simple docstring"""
			return unittest.skipUnless(is_safetensors_available()						,       """test requires safetensors""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       Optional[int])							->	List[str]:







			"""simple docstring"""
			return unittest.skipUnless(is_deepspeed_available()						,       """test requires DeepSpeed""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       Union[str, Any])							->	Optional[Any]:







			"""simple docstring"""
			return unittest.skipUnless(is_torch_version(""">="""						,       """1.12.0""")						,       """test requires torch version >= 1.12.0""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       Any=None						,       _lowercase    :       List[str]=None)							->	Dict:







			"""simple docstring"""
			if test_case is None:
						return partial(_lowercase						,       version=_lowercase)
			return unittest.skipUnless(is_torch_version(""">="""						,       _lowercase)						,       F'''test requires torch version >= {version}''')(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       Any)							->	int:







			"""simple docstring"""
			return unittest.skipUnless(is_tensorboard_available()						,       """test requires Tensorboard""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       str)							->	Union[str, Any]:







			"""simple docstring"""
			return unittest.skipUnless(is_wandb_available()						,       """test requires wandb""")(_lowercase)

def      lowerCAmelCase_					(  _lowercase    :       Optional[int])							->	Union[str, Any]:







			"""simple docstring"""
			return unittest.skipUnless(is_comet_ml_available()						,       """test requires comet_ml""")(_lowercase)


_lowercase		:				List[str]      		=(
    any([is_wandb_available(), is_tensorboard_available()]) and not is_comet_ml_available()
)

def      lowerCAmelCase_					(  _lowercase    :       Optional[int])							->	Union[str, Any]:







			"""simple docstring"""
			return unittest.skipUnless(
			    _atleast_one_tracker_available						,       """test requires at least one tracker to be available and for `comet_ml` to not be installed"""						,       )(_lowercase)

class        snake_case__    (unittest.TestCase		):







						"""simple docstring"""




						__lowerCAmelCase					:Optional[Any]      =					True

						@classmethod
						def 							SCREAMING_SNAKE_CASE__(       cls  ) ->				Optional[int]:
									"""simple docstring"""




									a__       :						Tuple							=  tempfile.mkdtemp()

						@classmethod
						def 							SCREAMING_SNAKE_CASE__(       cls  ) ->				Dict:
									"""simple docstring"""




									if os.path.exists(cls.tmpdir  ):
												shutil.rmtree(cls.tmpdir  )

						def 							SCREAMING_SNAKE_CASE__(       self  ) ->				List[Any]:
									"""simple docstring"""




									if self.clear_on_setup:
												for path in Path(self.tmpdir  ).glob("""**/*"""  ):
															if path.is_file():
																		path.unlink()
															elif path.is_dir():
																		shutil.rmtree(__lowercase  )




class        snake_case__    (unittest.TestCase		):







						"""simple docstring"""




						def 							SCREAMING_SNAKE_CASE__(       self  ) ->				Union[str, Any]:
									"""simple docstring"""




									super().tearDown()
									# Reset the state of the AcceleratorState singleton.
									AcceleratorState._reset_state()
									PartialState._reset_state()




class        snake_case__    (unittest.TestCase		):







						"""simple docstring"""




						def 							SCREAMING_SNAKE_CASE__(       self ,       __lowercase  ) ->				Union[str, Any]:
									"""simple docstring"""




									a__       :						Tuple							=  mocks if isinstance(__lowercase ,       (tuple, list)  ) else [mocks]
									for m in self.mocks:
												m.start()
												self.addCleanup(m.stop  )




def      lowerCAmelCase_					(  _lowercase    :       Optional[int])							->	List[Any]:







			"""simple docstring"""
			a__       :						Tuple							=  AcceleratorState()
			a__       :						List[str]							=  tensor[None].clone().to(state.device)
			a__       :						Any							=  gather(_lowercase).cpu()
			a__       :						Optional[Any]							=  tensor[0].cpu()
			for i in range(tensors.shape[0]):
						if not torch.equal(tensors[i]						,       _lowercase):
									return False
			return True

class        snake_case__    :







						"""simple docstring"""




						def __init__(       self ,       __lowercase ,       __lowercase ,       __lowercase  ) ->				Any:
									"""simple docstring"""




									a__       :						Any							=  returncode
									a__       :						List[Any]							=  stdout
									a__       :						Any							=  stderr




async def      lowerCAmelCase_					(  _lowercase    :       str						,       _lowercase    :       str)							->	List[Any]:







			"""simple docstring"""
			while True:
						a__       :						str							=  await stream.readline()
						if line:
									callback(_lowercase)
						else:
									break

async def      lowerCAmelCase_					(  _lowercase    :       Any						,       _lowercase    :       Union[str, Any]=None						,       _lowercase    :       List[str]=None						,       _lowercase    :       Tuple=None						,       _lowercase    :       Optional[Any]=False						,       _lowercase    :       Dict=False)							->	_RunOutput:







			"""simple docstring"""
			if echo:
						print("""\nRunning: """						,       """ """.join(_lowercase))

			a__       :						int							=  await asyncio.create_subprocess_exec(
			    cmd[0]						,       *cmd[1:]						,       stdin=_lowercase						,       stdout=asyncio.subprocess.PIPE						,       stderr=asyncio.subprocess.PIPE						,       env=_lowercase						,       )

			# note: there is a warning for a possible deadlock when using `wait` with huge amounts of data in the pipe
			# https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.asyncio.subprocess.Process.wait
			#
			# If it starts hanging, will need to switch to the following code. The problem is that no data
			# will be seen until it's done and if it hangs for example there will be no debug info.
			# out, err = await p.communicate()
			# return _RunOutput(p.returncode, out, err)

			a__       :						int							=  []
			a__       :						Optional[int]							=  []

			def tee(_lowercase    :       List[str]						,       _lowercase    :       Optional[int]						,       _lowercase    :       Any						,       _lowercase    :       Optional[Any]=""):
						a__       :						int							=  line.decode("""utf-8""").rstrip()
						sink.append(_lowercase)
						if not quiet:
									print(_lowercase						,       _lowercase						,       file=_lowercase)

    # XXX: the timeout doesn't seem to make any difference here
			await asyncio.wait(
			    [
			        asyncio.create_task(_read_stream(p.stdout						,       lambda _lowercase: tee(_lowercase						,       _lowercase						,       sys.stdout						,       label="""stdout:"""))),
			        asyncio.create_task(_read_stream(p.stderr						,       lambda _lowercase: tee(_lowercase						,       _lowercase						,       sys.stderr						,       label="""stderr:"""))),
			    ]						,       timeout=_lowercase						,       )
			return _RunOutput(await p.wait()						,       _lowercase						,       _lowercase)

def      lowerCAmelCase_					(  _lowercase    :       Optional[int]						,       _lowercase    :       Optional[int]=None						,       _lowercase    :       Tuple=None						,       _lowercase    :       Any=180						,       _lowercase    :       List[Any]=False						,       _lowercase    :       Dict=True)							->	_RunOutput:







			"""simple docstring"""
			a__       :						Any							=  asyncio.get_event_loop()
			a__       :						List[Any]							=  loop.run_until_complete(
			    _stream_subprocess(_lowercase						,       env=_lowercase						,       stdin=_lowercase						,       timeout=_lowercase						,       quiet=_lowercase						,       echo=_lowercase))

			a__       :						Optional[int]							=  """ """.join(_lowercase)
			if result.returncode > 0:
						a__       :						List[Any]							=  """\n""".join(result.stderr)
						raise RuntimeError(
						    F'''\'{cmd_str}\' failed with returncode {result.returncode}\n\n'''
						    F'''The combined stderr from workers follows:\n{stderr}''')

			return result

class        snake_case__    (A__		):







						"""simple docstring"""




						pass




def      lowerCAmelCase_					(  _lowercase    :       List[str]						,       _lowercase    :       Optional[int]=False)							->	Dict:







			"""simple docstring"""
			try:
						a__       :						List[Any]							=  subprocess.check_output(_lowercase						,       stderr=subprocess.STDOUT)
						if return_stdout:
									if hasattr(_lowercase						,       """decode"""):
												a__       :						Tuple							=  output.decode("""utf-8""")
									return output
			except subprocess.CalledProcessError as e:
						raise SubprocessCallException(
						    F'''Command `{' '.join(_lowercase)}` failed with the following error:\n\n{e.output.decode()}''') from e




