Scrapy, a fast high-level web crawling & scraping framework for Python.
Fix references to Python types in parameter type fields
Adrián Chavesad6075440c02
diff --git a/docs/topics/contracts.rst b/docs/topics/contracts.rstindex 62f9a743b..15443f4cc 100644--- a/docs/topics/contracts.rst+++ b/docs/topics/contracts.rst@@ -85,7 +85,7 @@ override three methods:.. class:: Contract(method, \*args):param method: callback function to which the contract is associated- :type method: function+ :type method: collections.abc.Callable:param args: list of arguments passed into the docstring (whitespaceseparated)diff --git a/docs/topics/email.rst b/docs/topics/email.rstindex 949cdc638..73b1bdc3b 100644--- a/docs/topics/email.rst+++ b/docs/topics/email.rst@@ -63,10 +63,10 @@ uses `Twisted non-blocking IO`_, like the rest of the framework.:type smtpport: int:param smtptls: enforce using SMTP STARTTLS- :type smtptls: boolean+ :type smtptls: bool:param smtpssl: enforce using a secure SSL connection- :type smtpssl: boolean+ :type smtpssl: bool.. classmethod:: from_settings(settings)@@ -81,13 +81,13 @@ uses `Twisted non-blocking IO`_, like the rest of the framework.Send email to the given recipients.:param to: the e-mail recipients- :type to: str or list of str+ :type to: str or list:param subject: the subject of the e-mail:type subject: str:param cc: the e-mails to CC- :type cc: str or list of str+ :type cc: str or list:param body: the e-mail body:type body: str@@ -97,7 +97,7 @@ uses `Twisted non-blocking IO`_, like the rest of the framework.appear on the e-mail's attachment, ``mimetype`` is the mimetype of theattachment and ``file_object`` is a readable file object with thecontents of the attachment- :type attachs: iterable+ :type attachs: collections.abc.Iterable:param mimetype: the MIME type of the e-mail:type mimetype: strdiff --git a/docs/topics/exporters.rst b/docs/topics/exporters.rstindex a698a6a4e..da304922d 100644--- a/docs/topics/exporters.rst+++ b/docs/topics/exporters.rst@@ -300,7 +300,7 @@ CsvItemExporter:param include_headers_line: If enabled, makes the exporter output a headerline with the field names taken from:attr:`BaseItemExporter.fields_to_export` or the first exported item fields.- :type include_headers_line: boolean+ :type include_headers_line: bool:param join_multivalued: The char (or chars) that will be used for joiningmulti-valued fields, if found.diff --git a/docs/topics/leaks.rst b/docs/topics/leaks.rstindex 8278e9849..657f1cc61 100644--- a/docs/topics/leaks.rst+++ b/docs/topics/leaks.rst@@ -179,7 +179,7 @@ Here are the functions available in the :mod:`~scrapy.utils.trackref` module.:param ignore: if given, all objects from the specified class (or tuple ofclasses) will be ignored.- :type ignore: class or classes tuple+ :type ignore: type or tuple.. function:: get_oldest(class_name)diff --git a/docs/topics/link-extractors.rst b/docs/topics/link-extractors.rstindex 713a94e10..13b9ad7a5 100644--- a/docs/topics/link-extractors.rst+++ b/docs/topics/link-extractors.rst@@ -59,13 +59,13 @@ LxmlLinkExtractor:param allow: a single regular expression (or list of regular expressions)that the (absolute) urls must match in order to be extracted. If notgiven (or empty), it will match all links.- :type allow: a regular expression (or list of)+ :type allow: str or list:param deny: a single regular expression (or list of regular expressions)that the (absolute) urls must match in order to be excluded (ie. notextracted). It has precedence over the ``allow`` parameter. If notgiven (or empty) it won't exclude any links.- :type deny: a regular expression (or list of)+ :type deny: str or list:param allow_domains: a single value or a list of string containingdomains which will be considered for extracting the links@@ -97,7 +97,7 @@ LxmlLinkExtractorthat the link's text must match in order to be extracted. If notgiven (or empty), it will match all links. If a list of regular expressions isgiven, the link will be extracted if it matches at least one.- :type restrict_text: a regular expression (or list of)+ :type restrict_text: str or list:param tags: a tag or a list of tags to consider when extracting links.Defaults to ``('a', 'area')``.@@ -115,11 +115,11 @@ LxmlLinkExtractordifferent for requests with canonicalized and raw URLs. If you'reusing LinkExtractor to follow links it is more robust tokeep the default ``canonicalize=False``.- :type canonicalize: boolean+ :type canonicalize: bool:param unique: whether duplicate filtering should be applied to extractedlinks.- :type unique: boolean+ :type unique: bool:param process_value: a function which receives each value extracted fromthe tag and attributes scanned and can modify the value and return a@@ -141,7 +141,7 @@ LxmlLinkExtractorif m:return m.group(1)- :type process_value: callable+ :type process_value: collections.abc.Callable:param strip: whether to strip whitespaces from extracted attributes.According to HTML5 standard, leading and trailing whitespaces@@ -150,6 +150,6 @@ LxmlLinkExtractorelements, etc., so LinkExtractor strips space chars by default.Set ``strip=False`` to turn it off (e.g. if you're extracting urlsfrom elements or attributes which allow leading/trailing whitespaces).- :type strip: boolean+ :type strip: bool.. _scrapy.linkextractors: https://github.com/scrapy/scrapy/blob/master/scrapy/linkextractors/__init__.pydiff --git a/docs/topics/loaders.rst b/docs/topics/loaders.rstindex 1c2f1da4d..4137fdd24 100644--- a/docs/topics/loaders.rst+++ b/docs/topics/loaders.rst@@ -320,7 +320,7 @@ ItemLoader objects:param re: a regular expression to use for extracting data from thegiven value using :meth:`~scrapy.utils.misc.extract_regex` method,applied before processors- :type re: str or compiled regex+ :type re: str or typing.PatternExamples::@@ -365,7 +365,7 @@ ItemLoader objects:param re: a regular expression to use for extracting data from theselected XPath region- :type re: str or compiled regex+ :type re: str or typing.PatternExamples::@@ -408,7 +408,7 @@ ItemLoader objects:param re: a regular expression to use for extracting data from theselected CSS region- :type re: str or compiled regex+ :type re: str or typing.PatternExamples::diff --git a/docs/topics/request-response.rst b/docs/topics/request-response.rstindex 727c67482..2f99a72f5 100644--- a/docs/topics/request-response.rst+++ b/docs/topics/request-response.rst@@ -31,7 +31,7 @@ Request objectsa :class:`Response`.:param url: the URL of this request- :type url: string+ :type url: str:param callback: the function that will be called with the response of thisrequest (once its downloaded) as its first parameter. For more information@@ -40,10 +40,10 @@ Request objects:meth:`~scrapy.spiders.Spider.parse` method will be used.Note that if exceptions are raised during processing, errback is called instead.- :type callback: callable+ :type callback: collections.abc.Callable:param method: the HTTP method of this request. Defaults to ``'GET'``.- :type method: string+ :type method: str:param meta: the initial values for the :attr:`Request.meta` attribute. Ifgiven, the dict passed in this parameter will be shallow copied.@@ -54,7 +54,7 @@ Request objects``body`` is not given, an empty string is stored. Regardless of thetype of this argument, the final value stored will be a ``str`` (never``unicode`` or ``None``).- :type body: str or unicode+ :type body: str:param headers: the headers of this request. The dict values can be strings(for single valued headers) or lists (for multi-valued headers). If@@ -105,7 +105,7 @@ Request objects:param encoding: the encoding of this request (defaults to ``'utf-8'``).This encoding will be used to percent-encode the URL and to convert thebody to ``str`` (if given as ``unicode``).- :type encoding: string+ :type encoding: str:param priority: the priority of this request (defaults to ``0``).The priority is used by the scheduler to define the order used to process@@ -117,7 +117,7 @@ Request objectsthe scheduler. This is used when you want to perform an identicalrequest multiple times, to ignore the duplicates filter. Use it withcare, or you will get into crawling loops. Default to ``False``.- :type dont_filter: boolean+ :type dont_filter: bool:param errback: a function that will be called if any exception wasraised while processing the request. This includes pages that failed@@ -125,7 +125,7 @@ Request objectsas first parameter.For more information,see :ref:`topics-request-response-ref-errbacks` below.- :type errback: callable+ :type errback: collections.abc.Callable:param flags: Flags sent to the request, can be used for logging or similar purposes.:type flags: list@@ -407,7 +407,7 @@ fields with form data from :class:`Response` objects.:param formdata: is a dictionary (or iterable of (key, value) tuples)containing HTML Form data which will be url-encoded and assigned to thebody of the request.- :type formdata: dict or iterable of tuples+ :type formdata: dict or collections.abc.IterableThe :class:`FormRequest` objects support the following class method inaddition to the standard :class:`Request` methods:@@ -439,20 +439,20 @@ fields with form data from :class:`Response` objects.:type response: :class:`Response` object:param formname: if given, the form with name attribute set to this value will be used.- :type formname: string+ :type formname: str:param formid: if given, the form with id attribute set to this value will be used.- :type formid: string+ :type formid: str:param formxpath: if given, the first form that matches the xpath will be used.- :type formxpath: string+ :type formxpath: str:param formcss: if given, the first form that matches the css selector will be used.- :type formcss: string+ :type formcss: str:param formnumber: the number of form to use, when the response containsmultiple forms. The first one (and also the default) is ``0``.- :type formnumber: integer+ :type formnumber: int:param formdata: fields to override in the form data. If a field wasalready present in the response ``<form>`` element, its value is@@ -470,7 +470,7 @@ fields with form data from :class:`Response` objects.:param dont_click: If True, the form data will be submitted withoutclicking in any element.- :type dont_click: boolean+ :type dont_click: boolThe other parameters of this class method are passed directly to the:class:`FormRequest` constructor.@@ -558,7 +558,7 @@ dealing with JSON requests.if :attr:`Request.body` argument is provided this parameter will be ignored.if :attr:`Request.body` argument is not provided and data argument is provided :attr:`Request.method` will beset to ``'POST'`` automatically.- :type data: JSON serializable object+ :type data: object:param dumps_kwargs: Parameters that will be passed to underlying `json.dumps`_ method which is used to serializedata into JSON format.@@ -587,10 +587,10 @@ Response objectsdownloaded (by the Downloader) and fed to the Spiders for processing.:param url: the URL of this response- :type url: string+ :type url: str:param status: the HTTP status of the response. Defaults to ``200``.- :type status: integer+ :type status: int:param headers: the headers of this response. The dict values can be strings(for single valued headers) or lists (for multi-valued headers).@@ -730,7 +730,7 @@ TextResponse objectsbody, it will be encoded using this encoding (remember the body attributeis always a string). If ``encoding`` is ``None`` (default value), theencoding will be looked up in the response headers and body instead.- :type encoding: string+ :type encoding: str:class:`TextResponse` objects support the following attributes in additionto the standard :class:`Response` ones:diff --git a/scrapy/crawler.py b/scrapy/crawler.pyindex ded3c082b..84acf543f 100644--- a/scrapy/crawler.py+++ b/scrapy/crawler.py@@ -292,7 +292,7 @@ class CrawlerProcess(CrawlerRunner):If ``stop_after_crawl`` is True, the reactor will be stopped after allcrawlers have finished, using :meth:`join`.- :param boolean stop_after_crawl: stop or not the reactor when all+ :param bool stop_after_crawl: stop or not the reactor when allcrawlers have finished"""if stop_after_crawl:diff --git a/scrapy/robotstxt.py b/scrapy/robotstxt.pyindex 189f165d1..7faad308a 100644--- a/scrapy/robotstxt.py+++ b/scrapy/robotstxt.py@@ -43,10 +43,10 @@ class RobotParser(with_metaclass(ABCMeta)):"""Return ``True`` if ``user_agent`` is allowed to crawl ``url``, otherwise return ``False``.:param url: Absolute URL- :type url: string+ :type url: str:param user_agent: User agent- :type user_agent: string+ :type user_agent: str"""passdiff --git a/scrapy/settings/__init__.py b/scrapy/settings/__init__.pyindex f28c7940d..95c02021e 100644--- a/scrapy/settings/__init__.py+++ b/scrapy/settings/__init__.py@@ -105,10 +105,9 @@ class BaseSettings(MutableMapping):Get a setting value without affecting its original type.:param name: the setting name- :type name: string+ :type name: str:param default: the value to return if no setting is found- :type default: any"""return self[name] if self[name] is not None else default@@ -123,10 +122,9 @@ class BaseSettings(MutableMapping):``'0'`` will return ``False`` when using this method.:param name: the setting name- :type name: string+ :type name: str:param default: the value to return if no setting is found- :type default: any"""got = self.get(name, default)try:@@ -145,10 +143,9 @@ class BaseSettings(MutableMapping):Get a setting value as an int.:param name: the setting name- :type name: string+ :type name: str:param default: the value to return if no setting is found- :type default: any"""return int(self.get(name, default))@@ -157,10 +154,9 @@ class BaseSettings(MutableMapping):Get a setting value as a float.:param name: the setting name- :type name: string+ :type name: str:param default: the value to return if no setting is found- :type default: any"""return float(self.get(name, default))@@ -173,10 +169,9 @@ class BaseSettings(MutableMapping):``'one,two'`` will return a list ['one', 'two'] when using this method.:param name: the setting name- :type name: string+ :type name: str:param default: the value to return if no setting is found- :type default: any"""value = self.get(name, default or [])if isinstance(value, six.string_types):@@ -194,10 +189,9 @@ class BaseSettings(MutableMapping):and losing all information about priority and mutability.:param name: the setting name- :type name: string+ :type name: str:param default: the value to return if no setting is found- :type default: any"""value = self.get(name, default or {})if isinstance(value, six.string_types):@@ -209,7 +203,7 @@ class BaseSettings(MutableMapping):counterpart.:param name: name of the dictionary-like setting- :type name: string+ :type name: str"""compbs = BaseSettings()compbs.update(self[name + '_BASE'])@@ -222,7 +216,7 @@ class BaseSettings(MutableMapping):the given ``name`` does not exist.:param name: the setting name- :type name: string+ :type name: str"""if name not in self:return None@@ -252,14 +246,13 @@ class BaseSettings(MutableMapping):otherwise they won't have any effect.:param name: the setting name- :type name: string+ :type name: str:param value: the value to associate with the setting- :type value: any:param priority: the priority of the setting. Should be a key of:attr:`~scrapy.settings.SETTINGS_PRIORITIES` or an integer- :type priority: string or int+ :type priority: str or int"""self._assert_mutability()priority = get_settings_priority(priority)@@ -283,11 +276,11 @@ class BaseSettings(MutableMapping):uppercase variable of ``module`` with the provided ``priority``.:param module: the module or the path of the module- :type module: module object or string+ :type module: types.ModuleType or str:param priority: the priority of the settings. Should be a key of:attr:`~scrapy.settings.SETTINGS_PRIORITIES` or an integer- :type priority: string or int+ :type priority: str or int"""self._assert_mutability()if isinstance(module, six.string_types):@@ -316,7 +309,7 @@ class BaseSettings(MutableMapping)::param priority: the priority of the settings. Should be a key of:attr:`~scrapy.settings.SETTINGS_PRIORITIES` or an integer- :type priority: string or int+ :type priority: str or int"""self._assert_mutability()if isinstance(values, six.string_types):diff --git a/scrapy/signalmanager.py b/scrapy/signalmanager.pyindex 296d27ed8..c24b16fcb 100644--- a/scrapy/signalmanager.py+++ b/scrapy/signalmanager.py@@ -17,7 +17,7 @@ class SignalManager(object):section.:param receiver: the function to be connected- :type receiver: callable+ :type receiver: collections.abc.Callable:param signal: the signal to connect to:type signal: object