
    3 d                     P    d Z ddlZddlmZ ddlmZ  G d dej                  ZdS )z;
Item Loader

See documentation in docs/topics/loaders.rst
    N)Item)Selectorc                   ,     e Zd ZdZeZeZd fd	Z xZ	S )
ItemLoadera
  
    A user-friendly abstraction to populate an :ref:`item <topics-items>` with data
    by applying :ref:`field processors <topics-loaders-processors>` to scraped data.
    When instantiated with a ``selector`` or a ``response`` it supports
    data extraction from web pages using :ref:`selectors <topics-selectors>`.

    :param item: The item instance to populate using subsequent calls to
        :meth:`~ItemLoader.add_xpath`, :meth:`~ItemLoader.add_css`,
        or :meth:`~ItemLoader.add_value`.
    :type item: scrapy.item.Item

    :param selector: The selector to extract data from, when using the
        :meth:`add_xpath`, :meth:`add_css`, :meth:`replace_xpath`, or
        :meth:`replace_css` method.
    :type selector: :class:`~scrapy.selector.Selector` object

    :param response: The response used to construct the selector using the
        :attr:`default_selector_class`, unless the selector argument is given,
        in which case this argument is ignored.
    :type response: :class:`~scrapy.http.Response` object

    If no item is given, one is instantiated automatically using the class in
    :attr:`default_item_class`.

    The item, selector, response and remaining keyword arguments are
    assigned to the Loader context (accessible through the :attr:`context` attribute).

    .. attribute:: item

        The item object being parsed by this Item Loader.
        This is mostly used as a property so, when attempting to override this
        value, you may want to check out :attr:`default_item_class` first.

    .. attribute:: context

        The currently active :ref:`Context <loaders-context>` of this Item Loader.

    .. attribute:: default_item_class

        An :ref:`item <topics-items>` class (or factory), used to instantiate
        items when not given in the ``__init__`` method.

    .. attribute:: default_input_processor

        The default input processor to use for those fields which don't specify
        one.

    .. attribute:: default_output_processor

        The default output processor to use for those fields which don't specify
        one.

    .. attribute:: default_selector_class

        The class used to construct the :attr:`selector` of this
        :class:`ItemLoader`, if only a response is given in the ``__init__`` method.
        If a selector is given in the ``__init__`` method this attribute is ignored.
        This attribute is sometimes overridden in subclasses.

    .. attribute:: selector

        The :class:`~scrapy.selector.Selector` object to extract data from.
        It's either the selector given in the ``__init__`` method or one created from
        the response given in the ``__init__`` method using the
        :attr:`default_selector_class`. This attribute is meant to be
        read-only.
    Nc                     |+|)	 |                      |          }n# t          $ r d }Y nw xY w|                    |            t                      j        d|||d| d S )N)response)itemselectorparent )default_selector_classAttributeErrorupdatesuper__init__)selfr	   r
   r   r   context	__class__s         6lib/python3.11/site-packages/scrapy/loader/__init__.pyr   zItemLoader.__init__T   s     	  	  66x@@!       )))PdXfPPPPPPPs    ,,)NNNN)
__name__
__module____qualname____doc__r   default_item_classr   r   r   __classcell__)r   s   @r   r   r      sb        B BH %Q Q Q Q Q Q Q Q Q Q    r   )r   itemloadersscrapy.itemr   scrapy.selectorr   r   r   r   r   <module>r       s    
           $ $ $ $ $ $OQ OQ OQ OQ OQ' OQ OQ OQ OQ OQr   