コード例 #1
0
def test_pygmtscraper():
    """
    Make sure the scraper finds the figures and removes them from the pool.
    """

    showed = SHOWED_FIGURES.copy()
    for _ in range(len(SHOWED_FIGURES)):
        SHOWED_FIGURES.pop()
    try:
        fig = Figure()
        fig.coast(region="BR", projection="M6i", land="gray", frame=True)
        fig.show()
        assert len(SHOWED_FIGURES) == 1
        assert SHOWED_FIGURES[0] is fig
        scraper = PyGMTScraper()
        with TemporaryDirectory(dir=os.getcwd()) as tmpdir:
            conf = {"src_dir": "meh"}
            fname = os.path.join(tmpdir, "meh.png")
            block_vars = {"image_path_iterator": (i for i in [fname])}
            assert not os.path.exists(fname)
            scraper(None, block_vars, conf)
            assert os.path.exists(fname)
            assert not SHOWED_FIGURES
    finally:
        SHOWED_FIGURES.extend(showed)
コード例 #2
0
ファイル: conf.py プロジェクト: xdshivani/pygmt
    False,
    # Sort gallery example by file name instead of number of lines (default)
    "within_subsection_order":
    ExampleTitleSortKey,
    # directory where function granular galleries are stored
    "backreferences_dir":
    "api/generated/backreferences",
    # Modules for which function level galleries are created.  In
    # this case sphinx_gallery and numpy in a tuple of strings.
    "doc_module":
    "pygmt",
    # Insert links to documentation of objects in the examples
    "reference_url": {
        "pygmt": None
    },
    "image_scrapers": (PyGMTScraper(), ),
    # Removes configuration comments from scripts
    "remove_config_comments":
    True,
}

# Sphinx project configuration
templates_path = ["_templates"]
exclude_patterns = ["_build", "**.ipynb_checkpoints"]
source_suffix = ".rst"
needs_sphinx = "1.8"
# The encoding of source files.
source_encoding = "utf-8-sig"
master_doc = "index"

# General information about the project
コード例 #3
0
            github_url,
        ),
         (
            '<i class="fa fa-envelope fa-fw"></i> E-mail',
            "mailto:[email protected]",
        ),
    ],
}


# sphinx-gallery configuration
sphinx_gallery_conf = {
    
    'matplotlib_animations': True,
    'remove_config_comments': True,
    "image_scrapers": (PyGMTScraper(),'matplotlib'),
    # Remove the "Download all examples" button from the top level gallery
    "download_all_examples": False,
    # path to your example scripts
    #'examples_dirs': ['../obspy', '../obspy1'],
    'examples_dirs': ['../obspy','../pygmt'],
    # path to where to save gallery generated output
    'gallery_dirs': ['obspydoc','pygmtdoc'],
    # specify that examples should be ordered according to filename
    'within_subsection_order': FileNameSortKey,
    # directory where function granular galleries are stored
    'backreferences_dir': 'gen_modules/backreferences',
    # Modules for which function level galleries are created.  In
    # this case sphinx_gallery and numpy in a tuple of strings.
    #'doc_module': ('SampleModule'),
}