Skip to content

Commit

Permalink
Merge pull request scrapy#23 from scrapy/docs-nitpick
Browse files Browse the repository at this point in the history
Fix documentation references
  • Loading branch information
kmike authored Sep 2, 2020
2 parents 012d48f + c90e6c0 commit 97b5428
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 11 deletions.
10 changes: 6 additions & 4 deletions docs/built-in-processors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ Available built-in processors
=============================

Even though you can use any callable function as input and output processors,
``itemloaders`` provides some commonly used processors, which are described below. Some
of them, like the :class:`MapCompose` (which is typically used as input
processor) compose the output of several functions executed in order, to
produce the final parsed value.
``itemloaders`` provides some commonly used processors, which are described
below.

Some of them, like the :class:`~itemloaders.processors.MapCompose` (which is
typically used as input processor) compose the output of several functions
executed in order, to produce the final parsed value.

Here is a list of all built-in processors:

Expand Down
9 changes: 9 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.coverage',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
]

Expand Down Expand Up @@ -218,3 +219,11 @@ def maybe_skip_member(app, what, name, obj, skip, options):
# https://github.com/sphinx-doc/sphinx/issues/4422
return name in {'default_item_class', 'default_selector_class'}
return skip


nitpicky = True

intersphinx_mapping = {
'parsel': ('https://parsel.readthedocs.io/en/stable/', None),
'python': ('https://docs.python.org/3', None),
}
2 changes: 2 additions & 0 deletions docs/declaring-loaders.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. currentmodule:: itemloaders

.. _declaring-loaders:

Declaring Item Loaders
Expand Down
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. currentmodule:: itemloaders

.. _topics-index:

============
Expand Down
4 changes: 3 additions & 1 deletion docs/loaders-context.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. currentmodule:: itemloaders

.. _loaders-context:

Item Loader Context
Expand Down Expand Up @@ -36,7 +38,7 @@ There are several ways to modify Item Loader context values:
loader = ItemLoader(product, unit='cm')

3. On Item Loader declaration, for those input/output processors that support
instantiating them with an Item Loader context. :class:`~processor.MapCompose` is one of
instantiating them with an Item Loader context. :class:`~processors.MapCompose` is one of
them::

class ProductLoader(ItemLoader):
Expand Down
2 changes: 2 additions & 0 deletions docs/processors.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. currentmodule:: itemloaders

.. _processors:

Input and Output processors
Expand Down
6 changes: 3 additions & 3 deletions itemloaders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ItemLoader:
:param selector: The selector to extract data from, when using the
:meth:`add_xpath` (resp. :meth:`add_css`) or :meth:`replace_xpath`
(resp. :meth:`replace_css`) method.
:type selector: :class:`~parsel.Selector` object
:type selector: :class:`~parsel.selector.Selector` object
The item, selector and the remaining keyword arguments are
assigned to the Loader context (accessible through the :attr:`context` attribute).
Expand Down Expand Up @@ -88,7 +88,7 @@ class Product:
.. attribute:: selector
The :class:`~parsel.Selector` object to extract data from.
The :class:`~parsel.selector.Selector` object to extract data from.
It's the selector given in the ``__init__`` method.
This attribute is meant to be read-only.
Expand Down Expand Up @@ -222,7 +222,7 @@ def get_value(self, value, *processors, **kw):
Available keyword arguments:
:param re: a regular expression to use for extracting data from the
given value using :meth:`~parsel.utils.extract_regex` method,
given value using :func:`~parsel.utils.extract_regex` method,
applied before processors
:type re: str or typing.Pattern
Expand Down
6 changes: 3 additions & 3 deletions itemloaders/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MapCompose:
work with single values (instead of iterables). For this reason the
:class:`MapCompose` processor is typically used as input processor, since
data is often extracted using the
:meth:`~parsel.Selector.extract` method of `parsel selectors`_,
:meth:`~parsel.selector.Selector.extract` method of `parsel selectors`_,
which returns a list of unicode strings.
The example below should clarify how it works:
Expand Down Expand Up @@ -103,8 +103,8 @@ class Compose:
The keyword arguments passed in the ``__init__`` method are used as the default
Loader context values passed to each function call. However, the final
Loader context values passed to functions are overridden with the currently
active Loader context accessible through the :meth:`ItemLoader.context`
attribute.
active Loader context accessible through the :attr:`ItemLoader.context
<itemloaders.ItemLoader.context>` attribute.
"""

def __init__(self, *functions, **default_loader_context):
Expand Down

0 comments on commit 97b5428

Please sign in to comment.