o
    >@i                     @  sb   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ er(ddlm	Z	 G dd	 d	Z
d
S )zbarcode.base

    )annotations)TYPE_CHECKING)ClassVar)
BaseWriter)	SVGWriter)BinaryIOc                
   @  s   e Zd ZU dZdZeZddddddd	d
dd	Zded< ded< d/d0ddZ	d1ddZ
d1ddZd2ddZdd  Z	d3d4d&d'Z		d3d5d*d+Zd3d6d-d.ZdS )7Barcode r   g?g      .@g      @
   g      @whiteblackT)	module_widthmodule_height
quiet_zone	font_sizetext_distance
background
foreground
write_texttextzClassVar[dict]default_writer_optionsr   writerNcodestrBaseWriter | NonereturnNonec                 K     t NNotImplementedError)selfr   r   options r#   J/home/ubuntu/transcripts/venv/lib/python3.10/site-packages/barcode/base.py__init__%   s   zBarcode.__init__c                 C  s8   |   }t|dkstd|d }|ddddS )N   (Code list must contain a single element.r   1X0 )buildlenRuntimeErrorreplace)r!   	code_listr   r#   r#   r$   to_ascii(   s
   zBarcode.to_asciic                 C  s   d| j j d|  dS )N<(z)>)	__class____name__get_fullcoder!   r#   r#   r$   __repr__/   s   zBarcode.__repr__	list[str]c                 C  r   )zReturn a single-element list with a string encoding the barcode.

        Typically the string consists of 1s and 0s, although it can contain
        other characters such as G for guard lines (e.g. in EAN13).r   r7   r#   r#   r$   r,   2   s   zBarcode.buildc                 C  r   )z{Returns the full code, encoded in the barcode.

        :returns: Full human readable code.
        :rtype: String
        r   r7   r#   r#   r$   r6   9   s   zBarcode.get_fullcodefilenamer"   dict | Noner   
str | Nonec                 C  s(   |r|  ||n|  |}| j||S )a2  Renders the barcode and saves it in `filename`.

        :param filename: Filename to save the barcode in (without filename extension).
        :param options: The same as in `self.render`.
        :param text: Text to render under the barcode.

        :returns: The full filename with extension.
        )renderr   save)r!   r:   r"   r   outputr#   r#   r$   r>   A   s   zBarcode.savefpr   c                 C  s   |  ||}| j|| dS )zRenders the barcode and writes it to the file like object
        `fp`.

        :param fp: Object to write the raw data in.
        :param options: The same as in `self.render`.
        :param text: Text to render under the barcode.
        N)r=   r   write)r!   r@   r"   r   r?   r#   r#   r$   rA   P   s   zBarcode.writewriter_optionsc                 C  s   | j  }||p
i  |d s|dur#|dur||d< n|  |d< | j| |  }t|dks7td|d }| j	|gS )zRenders the barcode using `self.writer`.

        :param writer_options: Options for `self.writer`, see writer docs for details.
        :param text: Text to render under the barcode.

        :returns: Output of the writers render method.
        r   Nr   r&   r'   r   )
r   copyupdater6   r   set_optionsr,   r-   r.   r=   )r!   rB   r   r"   r0   r   r#   r#   r$   r=   `   s   

zBarcode.renderr   )r   r   r   r   r   r   )r   r   )r   r9   )NN)r:   r   r"   r;   r   r<   r   r   )r@   r   r"   r;   r   r<   r   r   )rB   r;   r   r<   )r5   
__module____qualname__namedigitsr   default_writerr   __annotations__r%   r1   r8   r,   r6   r>   rA   r=   r#   r#   r#   r$   r      s4   
 


	r   N)__doc__
__future__r   typingr   r   barcode.writerr   r   r   r   r#   r#   r#   r$   <module>   s    