def __init__(self, app: "Sphinx" = None): self.app = None # type: Sphinx self.doctreedir = None # type: str self.srcdir = None # type: str self.config = None # type: Config self.config_status = None # type: int self.config_status_extra = None # type: str self.events = None # type: EventManager self.project = None # type: Project self.version = None # type: Dict[str, str] # the method of doctree versioning; see set_versioning_method self.versioning_condition = None # type: Union[bool, Callable] self.versioning_compare = None # type: bool # all the registered domains, set by the application self.domains = {} # the docutils settings for building self.settings = default_settings.copy() self.settings['env'] = self # All "docnames" here are /-separated and relative and exclude # the source suffix. self.all_docs = {} # type: Dict[str, float] # docname -> mtime at the time of reading # contains all read docnames self.dependencies = defaultdict(set) # type: Dict[str, Set[str]] # docname -> set of dependent file # names, relative to documentation root self.included = defaultdict(set) # type: Dict[str, Set[str]] # docname -> set of included file # docnames included from other documents self.reread_always = set() # type: Set[str] # docnames to re-read unconditionally on # next build # File metadata self.metadata = defaultdict(dict) # type: Dict[str, Dict[str, Any]] # docname -> dict of metadata items # TOC inventory self.titles = {} # type: Dict[str, nodes.title] # docname -> title node self.longtitles = {} # type: Dict[str, nodes.title] # docname -> title node; only different if # set differently with title directive self.tocs = {} # type: Dict[str, nodes.bullet_list] # docname -> table of contents nodetree self.toc_num_entries = {} # type: Dict[str, int] # docname -> number of real entries # used to determine when to show the TOC # in a sidebar (don't show if it's only one item) self.toc_secnumbers = {} # type: Dict[str, Dict[str, Tuple[int, ...]]] # docname -> dict of sectionid -> number self.toc_fignumbers = { } # type: Dict[str, Dict[str, Dict[str, Tuple[int, ...]]]] # docname -> dict of figtype -> # dict of figureid -> number self.toctree_includes = {} # type: Dict[str, List[str]] # docname -> list of toctree includefiles self.files_to_rebuild = {} # type: Dict[str, Set[str]] # docname -> set of files # (containing its TOCs) to rebuild too self.glob_toctrees = set() # type: Set[str] # docnames that have :glob: toctrees self.numbered_toctrees = set() # type: Set[str] # docnames that have :numbered: toctrees # domain-specific inventories, here to be pickled self.domaindata = {} # type: Dict[str, Dict] # domainname -> domain-specific dict # these map absolute path -> (docnames, unique filename) self.images = FilenameUniqDict() # type: FilenameUniqDict self.dlfiles = DownloadFiles() # type: DownloadFiles # filename -> (set of docnames, destination) # the original URI for images self.original_image_uri = {} # type: Dict[str, str] # temporary data storage while reading a document self.temp_data = {} # type: Dict[str, Any] # context for cross-references (e.g. current module or class) # this is similar to temp_data, but will for example be copied to # attributes of "any" cross references self.ref_context = {} # type: Dict[str, Any] # set up environment if app: self.setup(app)
def check_attr(self, env): if not hasattr(env, 'dllinkfiles'): env.dllinkfiles = DownloadFiles()