o
    ZhK                     @   s  d dl Z d dlZd dlZd dlZd dlmZmZmZmZm	Z	m
Z
 d dlZddlmZ ddlmZmZ ddlmZ ddlmZmZmZ ddlmZmZ dd	lmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z* dd
l+m,Z, ddl-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3 e) rddlm4Z4 e& rd dl5Z5e' rddlm6Z6 e( rd dl7m8Z9 nd dl:m8Z9 e*;e<Z=dZ>e de>e,ddG dd deZ?e"e?j@e?_@e?j@jAdure?j@jAjBdddde?j@_AdS dS )    N)AnyDictListOptionalTupleUnion   )custom_object_save)BatchFeatureget_size_dict)BaseImageProcessorFast)ChannelDimensionSizeDictvalidate_kwargs)UnpackVideosKwargs)VIDEO_PROCESSOR_NAME
TensorTypeadd_model_info_to_auto_map"add_model_info_to_custom_pipelinesadd_start_docstringscached_file	copy_funcdownload_urlis_offline_modeis_remote_urlis_torch_availableis_torchvision_availableis_torchvision_v2_availableis_vision_availablelogging)requires)
VideoInputgroup_videos_by_shape
load_videomake_batched_videosreorder_videosto_channel_dimension_format)PILImageResampling)pil_torch_interpolation_mapping)
functionalac  
    Args:
        do_resize (`bool`, *optional*, defaults to `self.do_resize`):
            Whether to resize the video's (height, width) dimensions to the specified `size`. Can be overridden by the
            `do_resize` parameter in the `preprocess` method.
        size (`dict`, *optional*, defaults to `self.size`):
            Size of the output video after resizing. Can be overridden by the `size` parameter in the `preprocess`
            method.
        size_divisor (`int`, *optional*, defaults to `self.size_divisor`):
            The size by which to make sure both the height and width can be divided.
        default_to_square (`bool`, *optional*, defaults to `self.default_to_square`):
            Whether to default to a square video when resizing, if size is an int.
        resample (`PILImageResampling`, *optional*, defaults to `self.resample`):
            Resampling filter to use if resizing the video. Only has an effect if `do_resize` is set to `True`. Can be
            overridden by the `resample` parameter in the `preprocess` method.
        do_center_crop (`bool`, *optional*, defaults to `self.do_center_crop`):
            Whether to center crop the video to the specified `crop_size`. Can be overridden by `do_center_crop` in the
            `preprocess` method.
        do_pad (`bool`, *optional*):
            Whether to pad the video to the `(max_height, max_width)` of the videos in the batch.
        crop_size (`Dict[str, int]` *optional*, defaults to `self.crop_size`):
            Size of the output video after applying `center_crop`. Can be overridden by `crop_size` in the `preprocess`
            method.
        do_rescale (`bool`, *optional*, defaults to `self.do_rescale`):
            Whether to rescale the video by the specified scale `rescale_factor`. Can be overridden by the
            `do_rescale` parameter in the `preprocess` method.
        rescale_factor (`int` or `float`, *optional*, defaults to `self.rescale_factor`):
            Scale factor to use if rescaling the video. Only has an effect if `do_rescale` is set to `True`. Can be
            overridden by the `rescale_factor` parameter in the `preprocess` method.
        do_normalize (`bool`, *optional*, defaults to `self.do_normalize`):
            Whether to normalize the video. Can be overridden by the `do_normalize` parameter in the `preprocess`
            method. Can be overridden by the `do_normalize` parameter in the `preprocess` method.
        image_mean (`float` or `List[float]`, *optional*, defaults to `self.image_mean`):
            Mean to use if normalizing the video. This is a float or list of floats the length of the number of
            channels in the video. Can be overridden by the `image_mean` parameter in the `preprocess` method. Can be
            overridden by the `image_mean` parameter in the `preprocess` method.
        image_std (`float` or `List[float]`, *optional*, defaults to `self.image_std`):
            Standard deviation to use if normalizing the video. This is a float or list of floats the length of the
            number of channels in the video. Can be overridden by the `image_std` parameter in the `preprocess` method.
            Can be overridden by the `image_std` parameter in the `preprocess` method.
        do_convert_rgb (`bool`, *optional*, defaults to `self.image_std`):
            Whether to convert the video to RGB.
        return_tensors (`str` or `TensorType`, *optional*):
            Returns stacked tensors if set to `pt, otherwise returns a list of tensors.
        data_format (`ChannelDimension` or `str`, *optional*, defaults to `ChannelDimension.FIRST`):
            The channel dimension format for the output video. Can be one of:
            - `"channels_first"` or `ChannelDimension.FIRST`: video in (num_channels, height, width) format.
            - `"channels_last"` or `ChannelDimension.LAST`: video in (height, width, num_channels) format.
            - Unset: Use the channel dimension format of the input video.
        input_data_format (`ChannelDimension` or `str`, *optional*):
            The channel dimension format for the input video. If unset, the channel dimension format is inferred
            from the input video. Can be one of:
            - `"channels_first"` or `ChannelDimension.FIRST`: video in (num_channels, height, width) format.
            - `"channels_last"` or `ChannelDimension.LAST`: video in (height, width, num_channels) format.
            - `"none"` or `ChannelDimension.NONE`: video in (height, width) format.
        device (`torch.device`, *optional*):
            The device to process the videos on. If unset, the device is inferred from the input videos.z!Constructs a base VideoProcessor.)ZvisionZtorchvision)backendsc                "       s  e Zd ZdZdZdZdZdZdZdZ	dZ
dZdZdZdZdZdZdZeZdgZdee ddf fddZdefd	d
ZdddefddZ		dMdedeeeef  ded ded fddZ e!e"dedee defddZ#	dNded de$de$de%dee& ded de$de%de$d e$d!e'd"e$d#eee'ee' f  d$eee'ee' f  d%eeee(f  def d&d'Z)e*		(	(		)dOd*eee+j,f d+eeee+j,f  d,e$d-e$d.eeee$f  d/efd0d1Z-dPd2eee+j,f d3e$fd4d5Z.e*d*eee+j,f de/e0ee1f e0ee1f f fd6d7Z2e*d8e0ee1f fd9d:Z3de0ee1f fd;d<Z4defd=d>Z5d?eee+j,f fd@dAZ6dBdC Z7e*dDeee+j,f fdEdFZ8e*dQdHdIZ9dJeeee f fdKdLZ:  Z;S )RBaseVideoProcessorNTgp?pixel_values_videoskwargsreturnc                    s"  t    |dd | _| D ](\}}zt| || W q ty8 } ztd| d| d|   |d }~ww |d| j	}|d urOt
||d| jdnd | _	|d| j}|d urct
|dd	nd | _t| jj | _| jD ]}||d urt| |||  qrt| |t| |d  qrd S )
Nprocessor_classz
Can't set z with value z for sizedefault_to_square)r1   r2   	crop_size)
param_name)super__init__pop_processor_classitemssetattrAttributeErrorloggererrorr1   r   r2   r3   listvalid_kwargs__annotations__keysZmodel_valid_processing_keysgetgetattr)selfr.   keyvalueerrr1   r3   	__class__ R/var/www/auris/lib/python3.10/site-packages/transformers/video_processing_utils.pyr6      s.   

zBaseVideoProcessor.__init__c                 K   s   | j |fi |S N)
preprocess)rD   videosr.   rJ   rJ   rK   __call__   s   zBaseVideoProcessor.__call__videoztorch.Tensorc                 C   s   t |}|jd dks|ddddddf dk  s|S |ddddddf d }d|ddddddf  d |ddddddf |dddddddf   }|S )z
        Converts a video to RGB format.

        Args:
            video (`"torch.Tensor"`):
                The video to convert.

        Returns:
            `torch.Tensor`: The converted video.
           .N   g     o@r   )FZgrayscale_to_rgbshapeany)rD   rP   alpharJ   rJ   rK   convert_to_rgb   s   
.Tz!BaseVideoProcessor.convert_to_rgbrN   input_data_formatdeviceztorch.devicec                 C   s^   t |}g }|D ]$}t|tjrt|tj|}t|	 }|dur'|
|}|| q|S )z:
        Prepare the input videos for processing.
        N)r%   
isinstancenpndarrayr'   r   ZFIRSTtorchZ
from_numpy
contiguoustoappend)rD   rN   rY   rZ   processed_videosrP   rJ   rJ   rK   _prepare_input_videos   s   	
z(BaseVideoProcessor._prepare_input_videosc                 K   s   t | | jj d | jjD ]}||t| |d  q|d}|d}| j|||d}| jd
i |}| j	d
i | |d}t
|ttfrOt| n||d< |d |d | jd
d	|i|S )N)Zcaptured_kwargsZvalid_processor_keysrY   rZ   )rN   rY   rZ   resampleinterpolationr2   Zdata_formatrN   rJ   )r   rA   r?   r@   
setdefaultrC   r7   rc   Z_further_process_kwargsZ_validate_preprocess_kwargsr[   r(   intr)   _preprocess)rD   rN   r.   Z
kwarg_namerY   rZ   rd   rJ   rJ   rK   rM      s   




zBaseVideoProcessor.preprocessdo_convert_rgb	do_resizer1   size_divisorre   zF.InterpolationModedo_center_cropr3   
do_rescaledo_padrescale_factordo_normalize
image_mean	image_stdreturn_tensorsc              	   C   s   t |\}}i }| D ]\}}|r| |}|r"| j||||d}|||< qt||}t |\}}i }| D ]\}}|rD| ||}| ||	||||}|||< q8t||}|ratj|ddn|}t	d|i|dS )N)r1   rk   re   r   )dimr-   )dataZtensor_type)
r#   r9   rX   resizer&   Zcenter_cropZrescale_and_normalizer^   stackr
   )rD   rN   ri   rj   r1   rk   re   rl   r3   rm   rn   ro   rp   rq   rr   rs   Zgrouped_videosZgrouped_videos_indexZresized_videos_groupedrU   Zstacked_videosZresized_videosZprocessed_videos_groupedrb   rJ   rJ   rK   rh     s.   




zBaseVideoProcessor._preprocessFmainpretrained_model_name_or_path	cache_dirforce_downloadlocal_files_onlytokenrevisionc           
      K   s   ||d< ||d< ||d< ||d< | dd}|dur*tdt |dur(td|}|dur2||d	< | j|fi |\}	}| j|	fi |S )
a  
        Instantiate a type of [`~video_processing_utils.VideoProcessorBase`] from an video processor.

        Args:
            pretrained_model_name_or_path (`str` or `os.PathLike`):
                This can be either:

                - a string, the *model id* of a pretrained video hosted inside a model repo on
                  huggingface.co.
                - a path to a *directory* containing a video processor file saved using the
                  [`~video_processing_utils.VideoProcessorBase.save_pretrained`] method, e.g.,
                  `./my_model_directory/`.
                - a path or url to a saved video processor JSON *file*, e.g.,
                  `./my_model_directory/preprocessor_config.json`.
            cache_dir (`str` or `os.PathLike`, *optional*):
                Path to a directory in which a downloaded pretrained model video processor should be cached if the
                standard cache should not be used.
            force_download (`bool`, *optional*, defaults to `False`):
                Whether or not to force to (re-)download the video processor files and override the cached versions if
                they exist.
            resume_download:
                Deprecated and ignored. All downloads are now resumed by default when possible.
                Will be removed in v5 of Transformers.
            proxies (`Dict[str, str]`, *optional*):
                A dictionary of proxy servers to use by protocol or endpoint, e.g., `{'http': 'foo.bar:3128',
                'http://hostname': 'foo.bar:4012'}.` The proxies are used on each request.
            token (`str` or `bool`, *optional*):
                The token to use as HTTP bearer authorization for remote files. If `True`, or not specified, will use
                the token generated when running `huggingface-cli login` (stored in `~/.huggingface`).
            revision (`str`, *optional*, defaults to `"main"`):
                The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
                git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any
                identifier allowed by git.


                <Tip>

                To test a pull request you made on the Hub, you can pass `revision="refs/pr/<pr_number>"`.

                </Tip>

            return_unused_kwargs (`bool`, *optional*, defaults to `False`):
                If `False`, then this function returns just the final video processor object. If `True`, then this
                functions returns a `Tuple(video_processor, unused_kwargs)` where *unused_kwargs* is a dictionary
                consisting of the key/value pairs whose keys are not video processor attributes: i.e., the part of
                `kwargs` which has not been used to update `video_processor` and is otherwise ignored.
            subfolder (`str`, *optional*, defaults to `""`):
                In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can
                specify the folder name here.
            kwargs (`Dict[str, Any]`, *optional*):
                The values in kwargs of any keys which are video processor attributes will be used to override the
                loaded values. Behavior concerning key/value pairs whose keys are *not* video processor attributes is
                controlled by the `return_unused_kwargs` keyword parameter.

        Returns:
            A video processor of type [`~video_processing_utils.ImagVideoProcessorBase`].

        Examples:

        ```python
        # We can't instantiate directly the base class *VideoProcessorBase* so let's show the examples on a
        # derived class: *LlavaOnevisionVideoProcessor*
        video_processor = LlavaOnevisionVideoProcessor.from_pretrained(
            "llava-hf/llava-onevision-qwen2-0.5b-ov-hf"
        )  # Download video_processing_config from huggingface.co and cache.
        video_processor = LlavaOnevisionVideoProcessor.from_pretrained(
            "./test/saved_model/"
        )  # E.g. video processor (or model) was saved using *save_pretrained('./test/saved_model/')*
        video_processor = LlavaOnevisionVideoProcessor.from_pretrained("./test/saved_model/preprocessor_config.json")
        video_processor = LlavaOnevisionVideoProcessor.from_pretrained(
            "llava-hf/llava-onevision-qwen2-0.5b-ov-hf", do_normalize=False, foo=False
        )
        assert video_processor.do_normalize is False
        video_processor, unused_kwargs = LlavaOnevisionVideoProcessor.from_pretrained(
            "llava-hf/llava-onevision-qwen2-0.5b-ov-hf", do_normalize=False, foo=False, return_unused_kwargs=True
        )
        assert video_processor.do_normalize is False
        assert unused_kwargs == {"foo": False}
        ```rz   r{   r|   r~   use_auth_tokenNrThe `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. Please use `token` instead.V`token` and `use_auth_token` are both specified. Please set only the argument `token`.r}   )r7   warningswarnFutureWarning
ValueErrorget_video_processor_dict	from_dict)
clsry   rz   r{   r|   r}   r~   r.   r   video_processor_dictrJ   rJ   rK   from_pretrainedI  s&   Zz"BaseVideoProcessor.from_pretrainedsave_directorypush_to_hubc           	      K   s  | dd}|dur tdt |dddurtd||d< tj|r.t	d| dtj
|dd	 |rX| d
d}| d|tjjd }| j|fi |}| |}| jdurdt| || d tj|t}| | td|  |r| j|||||dd |gS )aq  
        Save an video processor object to the directory `save_directory`, so that it can be re-loaded using the
        [`~video_processing_utils.VideoProcessorBase.from_pretrained`] class method.

        Args:
            save_directory (`str` or `os.PathLike`):
                Directory where the video processor JSON file will be saved (will be created if it does not exist).
            push_to_hub (`bool`, *optional*, defaults to `False`):
                Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the
                repository you want to push to with `repo_id` (will default to the name of `save_directory` in your
                namespace).
            kwargs (`Dict[str, Any]`, *optional*):
                Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
        r   Nr   r}   r   zProvided path (z#) should be a directory, not a fileT)exist_okcommit_messagerepo_id)configzVideo processor saved in )r   r}   )r7   r   r   r   rB   r   ospathisfileAssertionErrormakedirssplitsepZ_create_repoZ_get_files_timestamps_auto_classr	   joinr   to_json_filer<   infoZ_upload_modified_files)	rD   r   r   r.   r   r   r   Zfiles_timestampsZoutput_video_processor_filerJ   rJ   rK   save_pretrained  sB   


z"BaseVideoProcessor.save_pretrainedc                 K   s  | dd}| dd}| dd}| dd}| dd}| dd}| d	d}	| d
d}
| dd}| dd}| dd}|durVtdt |durTtd|}d|d}|durc||d< t ro|	sotd d}	t|}t	j
|}t	j
|r|}d}nYt|r|}t|}nNzt}t|||||||	|||
|d}W n: ty   d}t|||||||	|||
|d}td Y n ty     ty   td| d| dt dw z"t|ddd}| }W d   n1 sw   Y  t|}W n tjy   td | d!w |rtd"|  ntd"| d#|  |sGd$|v r9t|d$ ||d$< d%|v rGt|d% ||d%< ||fS )&a  
        From a `pretrained_model_name_or_path`, resolve to a dictionary of parameters, to be used for instantiating a
        video processor of type [`~video_processing_utils.VideoProcessorBase`] using `from_dict`.

        Parameters:
            pretrained_model_name_or_path (`str` or `os.PathLike`):
                The identifier of the pre-trained checkpoint from which we want the dictionary of parameters.
            subfolder (`str`, *optional*, defaults to `""`):
                In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can
                specify the folder name here.

        Returns:
            `Tuple[Dict, Dict]`: The dictionary(ies) that will be used to instantiate the video processor object.
        rz   Nr{   Fresume_downloadproxiesr}   r   r|   r~   	subfolder Z_from_pipelineZ
_from_autor   r   video processor)	file_typefrom_auto_classZusing_pipelinez+Offline mode: forcing local_files_only=TrueT)	rz   r{   r   r   r|   r}   
user_agentr~   r   zpreprocessor_config.jsonaA  You have video processor config saved in `preprocessor.json` file which is deprecated. Video processor configs should be saved in their own `video_preprocessor.json` file. You can rename the file or load and save the processor back which renames it automatically. Loading from `preprocessor.json` will be removed in v5.0.z Can't load video processor for 'z'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'z2' is the correct path to a directory containing a z filerutf-8encodingz"It looks like the config file at 'z' is not a valid JSON file.zloading configuration file z from cache at Zauto_mapZcustom_pipelines)r7   r   r   r   r   r   r<   r   strr   r   isdirr   r   r   r   r   EnvironmentErrorZwarning_once	ExceptionopenreadjsonloadsJSONDecodeErrorr   r   )r   ry   r.   rz   r{   r   r   r}   r   r|   r~   r   Zfrom_pipeliner   r   is_localZresolved_video_processor_fileZvideo_processor_filereadertextr   rJ   rJ   rK   r     s   




	



z+BaseVideoProcessor.get_video_processor_dictr   c                 K   s   |  }|dd}d|v rd|v r|d|d< d|v r(d|v r(|d|d< | di |}g }| D ]\}}t||rIt||| || q5|D ]}||d qLtd|  |rc||fS |S )a  
        Instantiates a type of [`~video_processing_utils.VideoProcessorBase`] from a Python dictionary of parameters.

        Args:
            video_processor_dict (`Dict[str, Any]`):
                Dictionary that will be used to instantiate the video processor object. Such a dictionary can be
                retrieved from a pretrained checkpoint by leveraging the
                [`~video_processing_utils.VideoProcessorBase.to_dict`] method.
            kwargs (`Dict[str, Any]`):
                Additional parameters from which to initialize the video processor object.

        Returns:
            [`~video_processing_utils.VideoProcessorBase`]: The video processor object instantiated from those
            parameters.
        return_unused_kwargsFr1   r3   NzVideo processor rJ   )copyr7   r9   hasattrr:   ra   r<   r   )r   r   r.   r   Zvideo_processor	to_removerE   rF   rJ   rJ   rK   r     s&   

zBaseVideoProcessor.from_dictc                 C   s   t | j}| jj|d< |S )z
        Serializes this instance to a Python dictionary.

        Returns:
            `Dict[str, Any]`: Dictionary of all the attributes that make up this video processor instance.
        Zvideo_processor_type)r   deepcopy__dict__rI   __name__)rD   outputrJ   rJ   rK   to_dict  s   zBaseVideoProcessor.to_dictc                 C   sb   |   }| D ]\}}t|tjr| ||< q|dd}|dur'||d< tj|dddd S )z
        Serializes this instance to a JSON string.

        Returns:
            `str`: String containing all the attributes that make up this feature_extractor instance in JSON format.
        r8   Nr0      T)indent	sort_keys
)	r   r9   r[   r\   r]   tolistr7   r   dumps)rD   
dictionaryrE   rF   r8   rJ   rJ   rK   to_json_string  s   z!BaseVideoProcessor.to_json_stringjson_file_pathc                 C   sB   t |ddd}||   W d   dS 1 sw   Y  dS )z
        Save this instance to a JSON file.

        Args:
            json_file_path (`str` or `os.PathLike`):
                Path to the JSON file in which this image_processor instance's parameters will be saved.
        wr   r   N)r   writer   )rD   r   writerrJ   rJ   rK   r     s   "zBaseVideoProcessor.to_json_filec                 C   s   | j j d|   S )N )rI   r   r   rD   rJ   rJ   rK   __repr__  s   zBaseVideoProcessor.__repr__	json_filec                 C   sN   t |ddd}| }W d   n1 sw   Y  t|}| di |S )a  
        Instantiates a video processor of type [`~video_processing_utils.VideoProcessorBase`] from the path to a JSON
        file of parameters.

        Args:
            json_file (`str` or `os.PathLike`):
                Path to the JSON file containing the parameters.

        Returns:
            A video processor of type [`~video_processing_utils.VideoProcessorBase`]: The video_processor object
            instantiated from that JSON file.
        r   r   r   NrJ   )r   r   r   r   )r   r   r   r   r   rJ   rJ   rK   from_json_file  s
   

z!BaseVideoProcessor.from_json_fileAutoVideoProcessorc                 C   sD   t |ts|j}ddlm  m} t||st| d|| _dS )a	  
        Register this class with a given auto class. This should only be used for custom video processors as the ones
        in the library are already mapped with `AutoVideoProcessor `.

        <Tip warning={true}>

        This API is experimental and may have some slight breaking changes in the next releases.

        </Tip>

        Args:
            auto_class (`str` or `type`, *optional*, defaults to `"AutoVideoProcessor "`):
                The auto class to register this new video processor with.
        r   Nz is not a valid auto class.)	r[   r   r   Ztransformers.models.automodelsautor   r   r   )r   Z
auto_classZauto_modulerJ   rJ   rK   register_for_auto_class  s   


z*BaseVideoProcessor.register_for_auto_classvideo_url_or_urlsc                    s@   t |tr fdd|D S t |trt|S tdt| )z
        Convert a single or a list of urls into the corresponding `np.array` objects.

        If a single url is passed, the return value will be a single object. If a list is passed a list of objects is
        returned.
        c                    s   g | ]}  |qS rJ   )fetch_videos).0xr   rJ   rK   
<listcomp>  s    z3BaseVideoProcessor.fetch_videos.<locals>.<listcomp>z=only a single or a list of entries is supported but got type=)r[   r>   r   r$   	TypeErrortype)rD   r   rJ   r   rK   r     s
   

zBaseVideoProcessor.fetch_videos)NNrL   )NFFNrx   )F)r   )<r   
__module____qualname__r   rd   rq   rr   r1   rk   r2   r3   rj   rl   rn   rm   ro   rp   ri   r   r?   Zmodel_input_namesr   r6   r
   rO   r"   rX   r   r   r   r   r   rc   r   BASE_VIDEO_PROCESSOR_DOCSTRINGrM   boolr   rg   floatr   rh   classmethodr   PathLiker   r   r   r   r   r   r   r   r   r   r   r   r   r   __classcell__rJ   rJ   rH   rK   r,      s    

.	

1q= ,"r,   r   r   zvideo processor file)objectZobject_classZobject_files)Cr   r   r   r   typingr   r   r   r   r   r   numpyr\   Zdynamic_module_utilsr	   Zimage_processing_utilsr
   r   Zimage_processing_utils_fastr   Zimage_utilsr   r   r   Zprocessing_utilsr   r   utilsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r    Zutils.import_utilsr!   Zvideo_utilsr"   r#   r$   r%   r&   r'   r(   r^   r)   Ztorchvision.transforms.v2r*   rT   Ztorchvision.transformsZ
get_loggerr   r<   r   r,   r   __doc__formatrJ   rJ   rJ   rK   <module>   sT    D 

;     