MCPcopy
hub / github.com/scrapy/scrapy / Settings

Class Settings

scrapy/settings/__init__.py:705–727  ·  view source on GitHub ↗

This object stores Scrapy settings for the configuration of internal components, and can be used for any further customization. It is a direct subclass and supports all methods of :class:`~scrapy.settings.BaseSettings`. Additionally, after instantiation of this class, the new o

Source from the content-addressed store, hash-verified

703
704
705class Settings(BaseSettings):
706 """
707 This object stores Scrapy settings for the configuration of internal
708 components, and can be used for any further customization.
709
710 It is a direct subclass and supports all methods of
711 :class:`~scrapy.settings.BaseSettings`. Additionally, after instantiation
712 of this class, the new object will have the global default settings
713 described on :ref:`topics-settings-ref` already populated.
714 """
715
716 def __init__(self, values: _SettingsInput = None, priority: int | str = "project"):
717 # Do not pass kwarg values here. We don't want to promote user-defined
718 # dicts, and we want to update, not replace, default dicts with the
719 # values given by the user
720 super().__init__()
721 self.setmodule(default_settings, "default")
722 # Promote default dictionaries to BaseSettings instances for per-key
723 # priorities
724 for name, val in self.items():
725 if isinstance(val, dict):
726 self.set(name, BaseSettings(val, "default"), "default")
727 self.update(values, priority)
728
729
730def iter_default_settings() -> Iterable[tuple[str, Any]]:

Calls

no outgoing calls