o
    i                     @  s   d Z ddlmZ dZddlZddlZddlmZmZm	Z	 ddl
mZ dZerDddlmZ dd	lmZ dd
lmZ ddlmZ ddl
mZ G dd de	ZG dd deZdddZdS )z0
This package contains Docutils Reader modules.
    )annotationsreStructuredTextN)utilsparsers	Component)	universalF)Final)nodes)Input)Parser)	Transformc                      sr   e Zd ZU dZdZded< dZded< d fd	d
Z		ddddZd ddZ	dd Z
d!ddZd"ddZ  ZS )#Readera9  
    Abstract base class for docutils Readers.

    Each reader module or package must export a subclass also called 'Reader'.

    The two steps of a Reader's responsibility are to read data from the
    source Input object and parse the data with the Parser object.
    Call `read()` to process a document.
    readerr   component_typereadersconfig_sectionreturnlist[type[Transform]]c                   s   t   tjtjtjg S N)superget_transformsr   DecorationsExposeInternalsStripCommentsself	__class__ _/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/docutils/readers/__init__.pyr   ,   s   zReader.get_transformsNparserParser | str | Noneparser_name
str | NoneNonec                 C  sZ   || _ 	 t|tr| | |dur$tjdtdd | j du r$| | d| _	 d| _dS )a2  
        Initialize the Reader instance.

        :parser: A parser instance or name (an instance will be created).
        :parser_name: deprecated, use "parser".

        Several instance attributes are defined with dummy initial values.
        Subclasses may use these attributes as they wish.
        NzgArgument "parser_name" will be removed in Docutils 2.0.
  Specify parser name in the "parser" argument.   )
stacklevel)	r    
isinstancestr
set_parserwarningswarnPendingDeprecationWarningsourceinput)r   r    r"   r   r   r   __init__1   s   



zReader.__init__r(   c                 C  s   t |}| | _dS )zSet `self.parser` by name.N)r   get_parser_classr    )r   r"   parser_classr   r   r   r)   T   s   
zReader.set_parserc                 C  s2   || _ | js	|| _|| _| j  | _|   | jS r   )r-   r    settingsreadr.   parsedocument)r   r-   r    r2   r   r   r   r3   Y   s   zReader.readc                 C  s.   |   }| j| j| d |_|_|| _dS )z(Parse `self.input` into a document tree.N)new_documentr    r4   r.   current_sourcecurrent_liner5   )r   r5   r   r   r   r4   b   s   
zReader.parsenodes.documentc                 C  s   t | jj| jS )z8Create and return a new empty document tree (root node).)r   r6   r-   source_pathr2   r   r   r   r   r6   i   s   zReader.new_documentr   r   )NN)r    r!   r"   r#   r   r$   )r"   r(   r   r$   )r   r$   )r   r9   )__name__
__module____qualname____doc__r   __annotations__r   r   r/   r)   r3   r4   r6   __classcell__r   r   r   r   r      s   
 

#
	r   c                   @  s   e Zd ZdZdddZdS )ReReaderz
    A reader which rereads an existing document tree (e.g. a
    deserializer).

    Often used in conjunction with `writers.UnfilteredWriter`.
    r   r   c                 C  s
   t | S r   )r   r   r   r   r   r   r   w   s   
zReReader.get_transformsNr;   )r<   r=   r>   r?   r   r   r   r   r   rB   n   s    rB   reader_namer(   r   type[Reader]c                 C  sn   |   }ztd| }W |jS  ty6   z
t|}W Y |jS  ty5 } z	td|  d|d}~ww w )z6Return the Reader class from the `reader_name` module.zdocutils.readers.zReader "z" not found.N)lower	importlibimport_moduleImportErrorr   )rC   namemoduleerrr   r   r   get_reader_class}   s   rL   )rC   r(   r   rD   )r?   
__future__r   __docformat__rF   r*   docutilsr   r   r   docutils.transformsr   TYPE_CHECKINGtypingr   r	   docutils.ior
   docutils.parsersr   r   r   rB   rL   r   r   r   r   <module>   s"   Q