


'''simple docstring'''

import colorsys
import io

import cva
import matplotlib as mpl
import matplotlib.colors as mplc
import matplotlib.figure as mplfigure
import numpy as np
import torch
from matplotlib.backends.backend_agg import FigureCanvasAgg

from utils import img_tensorize


__lowercase:		List[str]    						=  1_000







class 			UpperCAmelCase			:

 def __init__(			self			:						List[Any],       a_			:						Any,       a_			:						Any=1.2,       a_			:						Optional[Any]="g",       a_			:						Union[str, Any]=0.5,       a_			:						Dict="-",       a_			:						Optional[int]="test_out.jpg",       a_			:						Optional[int]=True,       a_			:						List[str]=False,       a_			:						str=None,       a_			:						Union[str, Any]=None,       a_			:						str=0.7,       ):





    """simple docstring"""



    if isinstance(a_,       torch.Tensor       ):
       UpperCamelCase__			    =    img.numpy().astype("np.uint8"       )
    if isinstance(a_,       a_       ):
       UpperCamelCase__			    =    img_tensorize(a_       )
    assert isinstance(a_,       np.ndarray       )

    UpperCamelCase__    ,		UpperCamelCase__			    =    img.shape[1], img.shape[0]
    UpperCamelCase__			    =    mplfigure.Figure(frameon=a_       )
    UpperCamelCase__			    =    fig.get_dpi()
    UpperCamelCase__			    =    (width * scale + 1e-2) / dpi
    UpperCamelCase__			    =    (height * scale + 1e-2) / dpi
    fig.set_size_inches(a_,       a_       )
    UpperCamelCase__			    =    fig.add_axes([0.0, 0.0, 1.0, 1.0]       )
    ax.axis("off"       )
    ax.set_xlim(0.0,       a_       )
    ax.set_ylim(a_       )

    UpperCamelCase__			    =    saveas
    UpperCamelCase__			    =    rgb
    UpperCamelCase__			    =    pynb
    UpperCamelCase__			    =    img
    UpperCamelCase__			    =    edgecolor
    UpperCamelCase__			    =    0.5
    UpperCamelCase__			    =    linestyle
    UpperCamelCase__			    =    int(np.sqrt(min(a_,       a_       )       ) * scale // 3       )
    UpperCamelCase__			    =    width
    UpperCamelCase__			    =    height
    UpperCamelCase__			    =    scale
    UpperCamelCase__			    =    fig
    UpperCamelCase__			    =    ax
    UpperCamelCase__			    =    pad
    UpperCamelCase__			    =    idaobj
    UpperCamelCase__			    =    idaattr
    UpperCamelCase__			    =    FigureCanvasAgg(a_       )

 def 		lowercase_    (			self			:						Optional[int],       a_			:						Union[str, Any],       a_			:						List[str]=None       ):





    """simple docstring"""



    if color is None:
       UpperCamelCase__			    =    self.edgecolor
    ((UpperCamelCase__)    ,		(UpperCamelCase__)    ,		(UpperCamelCase__)    ,		(UpperCamelCase__))			    =    box
    UpperCamelCase__			    =    xa - xa
    UpperCamelCase__			    =    ya - ya
    self.ax.add_patch(
        mpl.patches.Rectangle(
            (xa, ya),       a_,       a_,       fill=a_,       edgecolor=a_,       linewidth=self.font_size // 3,       alpha=self.alpha,       linestyle=self.linestyle,       )       )

 def 		lowercase_    (			self			:						Optional[int],       a_			:						List[Any],       a_			:						Optional[Any]=None,       a_			:						Dict=None,       a_			:						Tuple=None,       a_			:						Dict=None       ):





    """simple docstring"""



    if len(boxes.shape       ) > 2:
       UpperCamelCase__			    =    boxes[0]
    if len(obj_ids.shape       ) > 1:
       UpperCamelCase__			    =    obj_ids[0]
    if len(obj_scores.shape       ) > 1:
       UpperCamelCase__			    =    obj_scores[0]
    if len(attr_ids.shape       ) > 1:
       UpperCamelCase__			    =    attr_ids[0]
    if len(attr_scores.shape       ) > 1:
       UpperCamelCase__			    =    attr_scores[0]
    if isinstance(a_,       torch.Tensor       ):
       UpperCamelCase__			    =    boxes.numpy()
    if isinstance(a_,       a_       ):
       UpperCamelCase__			    =    np.array(a_       )
    assert isinstance(a_,       np.ndarray       )
    UpperCamelCase__			    =    np.prod(boxes[:, 2:] - boxes[:, :2],       axis=1       )
    UpperCamelCase__			    =    np.argsort(-areas       ).tolist()
    UpperCamelCase__			    =    boxes[sorted_idxs] if boxes is not None else None
    UpperCamelCase__			    =    obj_ids[sorted_idxs] if obj_ids is not None else None
    UpperCamelCase__			    =    obj_scores[sorted_idxs] if obj_scores is not None else None
    UpperCamelCase__			    =    attr_ids[sorted_idxs] if attr_ids is not None else None
    UpperCamelCase__			    =    attr_scores[sorted_idxs] if attr_scores is not None else None

    UpperCamelCase__			    =    [self._random_color(maximum=1       ) for _ in range(len(a_       )       )]
    UpperCamelCase__			    =    [assigned_colors[idx] for idx in sorted_idxs]
    if obj_ids is not None:
       UpperCamelCase__			    =    self._create_text_labels_attr(a_,       a_,       a_,       a_       )
       for i in range(len(a_       )       ):
          UpperCamelCase__			    =    assigned_colors[i]
          self.add_box(boxes[i],       a_       )
          self.draw_labels(labels[i],       boxes[i],       a_       )

 def 		lowercase_    (			self			:						Dict,       a_			:						Dict,       a_			:						Any,       a_			:						int       ):





    """simple docstring"""



    UpperCamelCase__    ,		UpperCamelCase__    ,		UpperCamelCase__    ,		UpperCamelCase__			    =    box
    UpperCamelCase__			    =    (xa, ya)
    UpperCamelCase__			    =    (ya - ya) * (xa - xa)
    UpperCamelCase__			    =    _SMALL_OBJ * self.scale
    if instance_area < small or ya - ya < 40 * self.scale:
       if ya >= self.height - 5:
          UpperCamelCase__			    =    (xa, ya)
       else:
          UpperCamelCase__			    =    (xa, ya)

    UpperCamelCase__			    =    (ya - ya) / np.sqrt(self.height * self.width       )
    UpperCamelCase__			    =    self._change_color_brightness(a_,       brightness_factor=0.7       )
    UpperCamelCase__			    =    np.clip((height_ratio - 0.02) / 0.08 + 1,       1.2,       2       )
    font_size *= 0.75 * self.font_size

    self.draw_text(
        text=a_,       position=a_,       color=a_,       )

 def 		lowercase_    (			self			:						Any,       a_			:						List[Any],       a_			:						str,       a_			:						Dict="g",       a_			:						str="left",       ):





    """simple docstring"""



    UpperCamelCase__			    =    0
    UpperCamelCase__			    =    self.font_size
    UpperCamelCase__			    =    np.maximum(list(mplc.to_rgb(a_       )       ),       0.2       )
    UpperCamelCase__			    =    max(0.8,       np.max(a_       )       )
    UpperCamelCase__			    =    {
        "facecolor": "black",
        "alpha": self.alpha,
        "pad": self.pad,
        "edgecolor": "none",
    }
    UpperCamelCase__    ,		UpperCamelCase__			    =    position
    self.ax.text(
        a_,       a_,       a_,       size=font_size * self.scale,       family="sans-serif",       bbox=a_,       verticalalignment="top",       horizontalalignment=a_,       color=a_,       zorder=10,       rotation=a_,       )

 def 		lowercase_    (			self			:						Dict,       a_			:						List[Any]=None       ):





    """simple docstring"""



    if saveas is None:
       UpperCamelCase__			    =    self.saveas
    if saveas.lower().endswith(".jpg"       ) or saveas.lower().endswith(".png"       ):
       cva.imwrite(
           a_,       self._get_buffer()[:, :, ::-1],       )
    else:
       self.fig.savefig(a_       )

 def 		lowercase_    (			self			:						str,       a_			:						Tuple,       a_			:						List[str],       a_			:						Union[str, Any],       a_			:						List[str]       ):





    """simple docstring"""



    UpperCamelCase__			    =    [self.idaobj[i] for i in classes]
    UpperCamelCase__			    =    [self.idaattr[i] for i in attr_classes]
    UpperCamelCase__			    =    [
        f'{label} {score:.2f} {attr} {attr_score:.2f}'
        for label, score, attr, attr_score in zip(a_,       a_,       a_,       a_       )
    ]
    return labels

 def 		lowercase_    (			self			:						List[Any],       a_			:						Union[str, Any],       a_			:						List[str]       ):





    """simple docstring"""



    UpperCamelCase__			    =    [self.idaobj[i] for i in classes]
    if scores is not None:
       if labels is None:
          UpperCamelCase__			    =    ["{:.0f}%".format(s * 100       ) for s in scores]
       else:
          UpperCamelCase__			    =    ["{} {:.0f}%".format(a_,       s * 100       ) for li, s in zip(a_,       a_       )]
    return labels

 def 		lowercase_    (			self			:						Dict,       a_			:						str=255       ):





    """simple docstring"""



    UpperCamelCase__			    =    np.random.randint(0,       len(_COLORS       )       )
    UpperCamelCase__			    =    _COLORS[idx] * maximum
    if not self.rgb:
       UpperCamelCase__			    =    ret[::-1]
    return ret

 def 		lowercase_    (			self			:						Dict       ):





    """simple docstring"""



    if not self.pynb:
       UpperCamelCase__    ,		UpperCamelCase__			    =    self.canvas.print_to_buffer()
       if (width, height) != (self.width, self.height):
          UpperCamelCase__			    =    cva.resize(self.img,       (width, height)       )
       else:
          UpperCamelCase__			    =    self.img
    else:
       UpperCamelCase__			    =    io.BytesIO()  # works for cairo backend
       self.canvas.print_rgba(a_       )
       UpperCamelCase__    ,		UpperCamelCase__			    =    self.width, self.height
       UpperCamelCase__			    =    buf.getvalue()
       UpperCamelCase__			    =    self.img

    UpperCamelCase__			    =    np.frombuffer(a_,       dtype="uint8"       )
    UpperCamelCase__			    =    buffer.reshape(a_,       a_,       4       )
    UpperCamelCase__    ,		UpperCamelCase__			    =    np.split(a_,       [3],       axis=2       )

    try:
       import numexpr as ne  # fuse them with numexpr

       UpperCamelCase__			    =    ne.evaluate("img * (1 - alpha / 255.0) + rgb * (alpha / 255.0)"       )
    except ImportError:
       UpperCamelCase__			    =    alpha.astype("float32"       ) / 255.0
       UpperCamelCase__			    =    img * (1 - alpha) + rgb * alpha

    return visualized_image.astype("uint8"       )

 def 		lowercase_    (			self			:						Union[str, Any],       a_			:						str,       a_			:						List[Any]       ):





    """simple docstring"""



    assert brightness_factor >= -1.0 and brightness_factor <= 1.0
    UpperCamelCase__			    =    mplc.to_rgb(a_       )
    UpperCamelCase__			    =    colorsys.rgb_to_hls(*mplc.to_rgb(a_       )       )
    UpperCamelCase__			    =    polygon_color[1] + (brightness_factor * polygon_color[1])
    UpperCamelCase__			    =    0.0 if modified_lightness < 0.0 else modified_lightness
    UpperCamelCase__			    =    1.0 if modified_lightness > 1.0 else modified_lightness
    UpperCamelCase__			    =    colorsys.hls_to_rgb(polygon_color[0],       a_,       polygon_color[2]       )
    return modified_color







__lowercase:		Optional[Any]    						=  (
    np.array(
        [
            0.0_0_0,
            0.4_4_7,
            0.7_4_1,
            0.8_5_0,
            0.3_2_5,
            0.0_9_8,
            0.9_2_9,
            0.6_9_4,
            0.1_2_5,
            0.4_9_4,
            0.1_8_4,
            0.5_5_6,
            0.4_6_6,
            0.6_7_4,
            0.1_8_8,
            0.3_0_1,
            0.7_4_5,
            0.9_3_3,
            0.6_3_5,
            0.0_7_8,
            0.1_8_4,
            0.3_0_0,
            0.3_0_0,
            0.3_0_0,
            0.6_0_0,
            0.6_0_0,
            0.6_0_0,
            1.0_0_0,
            0.0_0_0,
            0.0_0_0,
            1.0_0_0,
            0.5_0_0,
            0.0_0_0,
            0.7_4_9,
            0.7_4_9,
            0.0_0_0,
            0.0_0_0,
            1.0_0_0,
            0.0_0_0,
            0.0_0_0,
            0.0_0_0,
            1.0_0_0,
            0.6_6_7,
            0.0_0_0,
            1.0_0_0,
            0.3_3_3,
            0.3_3_3,
            0.0_0_0,
            0.3_3_3,
            0.6_6_7,
            0.0_0_0,
            0.3_3_3,
            1.0_0_0,
            0.0_0_0,
            0.6_6_7,
            0.3_3_3,
            0.0_0_0,
            0.6_6_7,
            0.6_6_7,
            0.0_0_0,
            0.6_6_7,
            1.0_0_0,
            0.0_0_0,
            1.0_0_0,
            0.3_3_3,
            0.0_0_0,
            1.0_0_0,
            0.6_6_7,
            0.0_0_0,
            1.0_0_0,
            1.0_0_0,
            0.0_0_0,
            0.0_0_0,
            0.3_3_3,
            0.5_0_0,
            0.0_0_0,
            0.6_6_7,
            0.5_0_0,
            0.0_0_0,
            1.0_0_0,
            0.5_0_0,
            0.3_3_3,
            0.0_0_0,
            0.5_0_0,
            0.3_3_3,
            0.3_3_3,
            0.5_0_0,
            0.3_3_3,
            0.6_6_7,
            0.5_0_0,
            0.3_3_3,
            1.0_0_0,
            0.5_0_0,
            0.6_6_7,
            0.0_0_0,
            0.5_0_0,
            0.6_6_7,
            0.3_3_3,
            0.5_0_0,
            0.6_6_7,
            0.6_6_7,
            0.5_0_0,
            0.6_6_7,
            1.0_0_0,
            0.5_0_0,
            1.0_0_0,
            0.0_0_0,
            0.5_0_0,
            1.0_0_0,
            0.3_3_3,
            0.5_0_0,
            1.0_0_0,
            0.6_6_7,
            0.5_0_0,
            1.0_0_0,
            1.0_0_0,
            0.5_0_0,
            0.0_0_0,
            0.3_3_3,
            1.0_0_0,
            0.0_0_0,
            0.6_6_7,
            1.0_0_0,
            0.0_0_0,
            1.0_0_0,
            1.0_0_0,
            0.3_3_3,
            0.0_0_0,
            1.0_0_0,
            0.3_3_3,
            0.3_3_3,
            1.0_0_0,
            0.3_3_3,
            0.6_6_7,
            1.0_0_0,
            0.3_3_3,
            1.0_0_0,
            1.0_0_0,
            0.6_6_7,
            0.0_0_0,
            1.0_0_0,
            0.6_6_7,
            0.3_3_3,
            1.0_0_0,
            0.6_6_7,
            0.6_6_7,
            1.0_0_0,
            0.6_6_7,
            1.0_0_0,
            1.0_0_0,
            1.0_0_0,
            0.0_0_0,
            1.0_0_0,
            1.0_0_0,
            0.3_3_3,
            1.0_0_0,
            1.0_0_0,
            0.6_6_7,
            1.0_0_0,
            0.3_3_3,
            0.0_0_0,
            0.0_0_0,
            0.5_0_0,
            0.0_0_0,
            0.0_0_0,
            0.6_6_7,
            0.0_0_0,
            0.0_0_0,
            0.8_3_3,
            0.0_0_0,
            0.0_0_0,
            1.0_0_0,
            0.0_0_0,
            0.0_0_0,
            0.0_0_0,
            0.1_6_7,
            0.0_0_0,
            0.0_0_0,
            0.3_3_3,
            0.0_0_0,
            0.0_0_0,
            0.5_0_0,
            0.0_0_0,
            0.0_0_0,
            0.6_6_7,
            0.0_0_0,
            0.0_0_0,
            0.8_3_3,
            0.0_0_0,
            0.0_0_0,
            1.0_0_0,
            0.0_0_0,
            0.0_0_0,
            0.0_0_0,
            0.1_6_7,
            0.0_0_0,
            0.0_0_0,
            0.3_3_3,
            0.0_0_0,
            0.0_0_0,
            0.5_0_0,
            0.0_0_0,
            0.0_0_0,
            0.6_6_7,
            0.0_0_0,
            0.0_0_0,
            0.8_3_3,
            0.0_0_0,
            0.0_0_0,
            1.0_0_0,
            0.0_0_0,
            0.0_0_0,
            0.0_0_0,
            0.1_4_3,
            0.1_4_3,
            0.1_4_3,
            0.8_5_7,
            0.8_5_7,
            0.8_5_7,
            1.0_0_0,
            1.0_0_0,
            1.0_0_0,
        ]
    )
    .astype(np.floataa)
    .reshape(-1, 3)
)

"""simple docstring"""


import os
import warnings
from pathlib import Path
from typing import Optional, Union

from .dynamic_module_utils import custom_object_save
from .tokenization_utils_base import PreTrainedTokenizerBase
from .utils import PushToHubMixin, copy_func, direct_transformers_import, logging


__A					=			logging.get_logger(__name__)

# Dynamically import the Transformers module to grab the attribute classes of the processor form their names.
__A					=			direct_transformers_import(Path(__file__).parent)


__A					=			{
    'AutoTokenizer': 'PreTrainedTokenizerBase',
    'AutoFeatureExtractor': 'FeatureExtractionMixin',
    'AutoImageProcessor': 'ImageProcessingMixin',
}







class 						lowerCamelCase__   (   __magic_name__							):





			'''simple docstring'''
			lowerCamelCase       =						['''feature_extractor''', '''tokenizer''']
			# Names need to be attr_class for attr in attributes
			lowerCamelCase       =						None
			lowerCamelCase       =						None
			lowerCamelCase       =						None



			def __init__(				self	,	*__UpperCAmelCase	,	**__UpperCAmelCase    )					->	Dict:
				# Sanitize args and kwargs
				for key in kwargs:
					if key not in self.attributes:
						raise TypeError(f'''Unexpected keyword argument {key}.'''    )
				for arg, attribute_name in zip(__UpperCAmelCase	,	self.attributes    ):
					if attribute_name in kwargs:
						raise TypeError(f'''Got multiple values for argument {attribute_name}.'''    )
					else:
						_lowerCAmelCase								=arg

				if len(__UpperCAmelCase    ) != len(self.attributes    ):
					raise ValueError(
					    f'''This processor requires {len(self.attributes    )} arguments: {', '.join(self.attributes    )}. Got '''
					    f'''{len(__UpperCAmelCase    )} arguments instead.'''    )

				# Check each arg is of the proper class (this will also catch a user initializing in the wrong order)
				for attribute_name, arg in kwargs.items():
					_lowerCAmelCase								=getattr(self	,	f'''{attribute_name}_class'''    )
					# Nothing is ever going to be an instance of "AutoXxx", in that case we check the base class.
					_lowerCAmelCase								=AUTO_TO_BASE_CLASS_MAPPING.get(__UpperCAmelCase	,	__UpperCAmelCase    )
					if isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ):
						_lowerCAmelCase								=tuple(getattr(__UpperCAmelCase	,	__UpperCAmelCase    ) for n in class_name if n is not None    )
					else:
						_lowerCAmelCase								=getattr(__UpperCAmelCase	,	__UpperCAmelCase    )

					if not isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ):
						raise ValueError(
						    f'''Received a {type(__UpperCAmelCase    ).__name__} for argument {attribute_name}, but a {class_name} was expected.'''    )

					setattr(self	,	__UpperCAmelCase	,	__UpperCAmelCase    )



			def __repr__(				self    )					->	Optional[int]:
				_lowerCAmelCase								=[f'''- {name}: {repr(getattr(self	,	__UpperCAmelCase    )    )}''' for name in self.attributes]
				_lowerCAmelCase								="""\n""".join(__UpperCAmelCase    )
				return f'''{self.__class__.__name__}:\n{attributes_repr}'''



			def    _lowerCAmelCase						(				self	,	__UpperCAmelCase	,	__UpperCAmelCase = False	,	**__UpperCAmelCase    )					->	Union[str, Any]:
				os.makedirs(__UpperCAmelCase	,	exist_ok=__UpperCAmelCase    )

				if push_to_hub:
					_lowerCAmelCase								=kwargs.pop("""commit_message"""	,	__UpperCAmelCase    )
					_lowerCAmelCase								=kwargs.pop("""repo_id"""	,	save_directory.split(os.path.sep    )[-1]    )
					_lowerCAmelCase								=self._create_repo(__UpperCAmelCase	,	**__UpperCAmelCase    )
					_lowerCAmelCase								=self._get_files_timestamps(__UpperCAmelCase    )
				# If we have a custom config, we copy the file defining it in the folder and set the attributes so it can be
				# loaded from the Hub.
				if self._auto_class is not None:
					_lowerCAmelCase								=[getattr(self	,	__UpperCAmelCase    ) for attribute_name in self.attributes]
					_lowerCAmelCase								=[(a.init_kwargs if isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ) else a) for a in attrs]
					custom_object_save(self	,	__UpperCAmelCase	,	config=__UpperCAmelCase    )

				for attribute_name in self.attributes:
					_lowerCAmelCase								=getattr(self	,	__UpperCAmelCase    )
					# Include the processor class in the attribute config so this processor can then be reloaded with the
					# `AutoProcessor` API.
					if hasattr(__UpperCAmelCase	,	"""_set_processor_class"""    ):
						attribute._set_processor_class(self.__class__.__name__    )
					attribute.save_pretrained(__UpperCAmelCase    )

				if self._auto_class is not None:
					# We added an attribute to the init_kwargs of the tokenizers, which needs to be cleaned up.
					for attribute_name in self.attributes:
						_lowerCAmelCase								=getattr(self	,	__UpperCAmelCase    )
						if isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ):
							del attribute.init_kwargs["auto_map"]

				if push_to_hub:
					self._upload_modified_files(
					    __UpperCAmelCase	,	__UpperCAmelCase	,	__UpperCAmelCase	,	commit_message=__UpperCAmelCase	,	token=kwargs.get("""use_auth_token"""    )	,	)



			@classmethod
			def    _lowerCAmelCase						(				cls	,	__UpperCAmelCase	,	__UpperCAmelCase = None	,	__UpperCAmelCase = False	,	__UpperCAmelCase = False	,	__UpperCAmelCase = None	,	__UpperCAmelCase = "main"	,	**__UpperCAmelCase	,	)					->	Any:
				_lowerCAmelCase								=cache_dir
				_lowerCAmelCase								=force_download
				_lowerCAmelCase								=local_files_only
				_lowerCAmelCase								=revision

				_lowerCAmelCase								=kwargs.pop("""use_auth_token"""	,	__UpperCAmelCase    )
				if use_auth_token is not None:
					warnings.warn(
					    """The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers."""	,	__UpperCAmelCase    )
					if token is not None:
						raise ValueError(
						    """`token` and `use_auth_token` are both specified. Please set only the argument `token`."""    )
					_lowerCAmelCase								=use_auth_token

				if token is not None:
					# change to `token` in a follow-up PR
					_lowerCAmelCase								=token

				_lowerCAmelCase								=cls._get_arguments_from_pretrained(__UpperCAmelCase	,	**__UpperCAmelCase    )
				return cls(*__UpperCAmelCase    )



			@classmethod
			def    _lowerCAmelCase						(				cls	,	__UpperCAmelCase="AutoProcessor"    )					->	Optional[int]:
				if not isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ):
					_lowerCAmelCase								=auto_class.__name__

				import transformers.models.auto as auto_module

				if not hasattr(__UpperCAmelCase	,	__UpperCAmelCase    ):
					raise ValueError(f'''{auto_class} is not a valid auto class.'''    )

				_lowerCAmelCase								=auto_class



			@classmethod
			def    _lowerCAmelCase						(				cls	,	__UpperCAmelCase	,	**__UpperCAmelCase    )					->	Optional[Any]:
				_lowerCAmelCase								=[]
				for attribute_name in cls.attributes:
					_lowerCAmelCase								=getattr(cls	,	f'''{attribute_name}_class'''    )
					if isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ):
						_lowerCAmelCase								=tuple(getattr(__UpperCAmelCase	,	__UpperCAmelCase    ) if n is not None else None for n in class_name    )
						_lowerCAmelCase								=kwargs.get("""use_fast"""	,	__UpperCAmelCase    )
						if use_fast and classes[1] is not None:
							_lowerCAmelCase								=classes[1]
						else:
							_lowerCAmelCase								=classes[0]
					else:
						_lowerCAmelCase								=getattr(__UpperCAmelCase	,	__UpperCAmelCase    )

					args.append(attribute_class.from_pretrained(__UpperCAmelCase	,	**__UpperCAmelCase    )    )
				return args



			@property
			def    _lowerCAmelCase						(				self    )					->	Optional[int]:
				_lowerCAmelCase								=getattr(self	,	self.attributes[0]    )
				return getattr(__UpperCAmelCase	,	"""model_input_names"""	,	__UpperCAmelCase    )







__A					=			copy_func(ProcessorMixin.push_to_hub)
if ProcessorMixin.push_to_hub.__doc__ is not None:
			__A					=			ProcessorMixin.push_to_hub.__doc__.format(
			    object='processor', object_class='AutoProcessor', object_files='processor files'
			)



