sphinx_gallery.scrapers#

用於嵌入圖片的 Scraper。

收集程式碼區塊產生的圖片。

我們原生僅支援 Matplotlib scraper,其他 scraper 應存在於支援它們的模組中 (例如 PyVista、Plotly)。抓取的圖片會以 rst image-sg 指令插入到為每個範例腳本生成的 .rst 檔案中。

函式#

sphinx_gallery.scrapers.clean_modules(gallery_conf, fname, when)[原始碼]#

移除、卸載或重置模組。

執行腳本後,它可能會載入各種設定,而這些設定不應影響圖庫中的其他範例。

參數:
  • gallery_conf (dict) – 圖庫設定。

  • fname (strNone) – 正在執行的範例。當呼叫此函數進入要建置的範例目錄時,將為 None。

  • when (str) –

    此模組是在範例之前還是之後執行。

    只有在可呼叫物件接受 3 個參數時,才會傳遞此參數。

類別#

class sphinx_gallery.scrapers.ImagePathIterator(image_path)[原始碼]#

針對給定的範例,迭代圖片路徑。

參數:

image_path (str) – 範本圖片路徑。

next()[原始碼]#

傳回下一個圖片路徑,編號從 1 開始。