-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploying to gh-pages from @ 16e4beb 🚀
- Loading branch information
Showing
3,330 changed files
with
80,192 additions
and
11,350 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
<!DOCTYPE html> | ||
<html class="writer-html5" lang="en" > | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>oaklib.converters.data_model_converter — oaklib documentation</title> | ||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" /> | ||
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" /> | ||
<link rel="stylesheet" href="../../../_static/copybutton.css" type="text/css" /> | ||
<!--[if lt IE 9]> | ||
<script src="../../../_static/js/html5shiv.min.js"></script> | ||
<![endif]--> | ||
|
||
<script src="../../../_static/jquery.js?v=5d32c60e"></script> | ||
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script> | ||
<script src="../../../_static/documentation_options.js?v=5929fcd5"></script> | ||
<script src="../../../_static/doctools.js?v=9a2dae69"></script> | ||
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script> | ||
<script src="../../../_static/clipboard.min.js?v=a7894cd8"></script> | ||
<script src="../../../_static/copybutton.js?v=046fa432"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/mermaid.min.js"></script> | ||
<script>mermaid.initialize({startOnLoad:true});</script> | ||
<script src="../../../_static/js/theme.js"></script> | ||
<link rel="index" title="Index" href="../../../genindex.html" /> | ||
<link rel="search" title="Search" href="../../../search.html" /> | ||
</head> | ||
|
||
<body class="wy-body-for-nav"> | ||
<div class="wy-grid-for-nav"> | ||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> | ||
<div class="wy-side-scroll"> | ||
<div class="wy-side-nav-search" > | ||
|
||
|
||
|
||
<a href="../../../index.html" class="icon icon-home"> | ||
oaklib | ||
</a> | ||
<div role="search"> | ||
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get"> | ||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
</div> | ||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> | ||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../introduction.html">Introduction</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../intro/index.html">Tutorial</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../guide/index.html">The OAK Guide</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../packages/index.html">OAK Library Documentation</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../cli.html">Command Line</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../datamodels/index.html">Datamodels</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../howtos/index.html">How-To Guides</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../notebooks.html">Jupyter Notebooks</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../glossary.html">Glossary</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../faq/index.html">FAQ</a></li> | ||
</ul> | ||
|
||
</div> | ||
</div> | ||
</nav> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > | ||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
<a href="../../../index.html">oaklib</a> | ||
</nav> | ||
|
||
<div class="wy-nav-content"> | ||
<div class="rst-content"> | ||
<div role="navigation" aria-label="Page navigation"> | ||
<ul class="wy-breadcrumbs"> | ||
<li><a href="../../../index.html" class="icon icon-home" aria-label="Home"></a></li> | ||
<li class="breadcrumb-item"><a href="../../index.html">Module code</a></li> | ||
<li class="breadcrumb-item active">oaklib.converters.data_model_converter</li> | ||
<li class="wy-breadcrumbs-aside"> | ||
</li> | ||
</ul> | ||
<hr/> | ||
</div> | ||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | ||
<div itemprop="articleBody"> | ||
|
||
<h1>Source code for oaklib.converters.data_model_converter</h1><div class="highlight"><pre> | ||
<span></span><span class="kn">from</span> <span class="nn">abc</span> <span class="kn">import</span> <span class="n">ABC</span><span class="p">,</span> <span class="n">abstractmethod</span> | ||
<span class="kn">from</span> <span class="nn">dataclasses</span> <span class="kn">import</span> <span class="n">dataclass</span> | ||
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Callable</span><span class="p">,</span> <span class="n">Optional</span> | ||
|
||
<span class="kn">import</span> <span class="nn">curies</span> | ||
|
||
<span class="kn">from</span> <span class="nn">oaklib.datamodels.ontology_metadata</span> <span class="kn">import</span> <span class="n">Any</span> | ||
<span class="kn">from</span> <span class="nn">oaklib.types</span> <span class="kn">import</span> <span class="n">CURIE</span> | ||
|
||
|
||
<div class="viewcode-block" id="DataModelConverter"> | ||
<a class="viewcode-back" href="../../../packages/converters/data-model-converter.html#oaklib.converters.data_model_converter.DataModelConverter">[docs]</a> | ||
<span class="nd">@dataclass</span><span class="p">(</span><span class="n">eq</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> | ||
<span class="k">class</span> <span class="nc">DataModelConverter</span><span class="p">(</span><span class="n">ABC</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Base class for all inter-data model converters.</span> | ||
|
||
<span class="sd"> Do not use this directly: use one of the subclasses.</span> | ||
<span class="sd"> """</span> | ||
|
||
<span class="n">curie_converter</span><span class="p">:</span> <span class="n">curies</span><span class="o">.</span><span class="n">Converter</span> <span class="o">=</span> <span class="kc">None</span> | ||
<span class="w"> </span><span class="sd">"""Converts between CURIEs and URIs"""</span> | ||
|
||
<span class="n">labeler</span><span class="p">:</span> <span class="n">Callable</span><span class="p">[[</span><span class="n">CURIE</span><span class="p">],</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> | ||
<span class="w"> </span><span class="sd">"""A function that returns a label for a given CURIE"""</span> | ||
|
||
<span class="n">enforce_canonical_ordering</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> | ||
<span class="w"> </span><span class="sd">"""If True, will enforce canonical ordering of keys in the output"""</span> | ||
|
||
<span class="k">def</span> <span class="fm">__hash__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | ||
<span class="k">return</span> <span class="nb">hash</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="p">))</span> | ||
|
||
<div class="viewcode-block" id="DataModelConverter.convert"> | ||
<a class="viewcode-back" href="../../../packages/converters/data-model-converter.html#oaklib.converters.data_model_converter.DataModelConverter.convert">[docs]</a> | ||
<span class="nd">@abstractmethod</span> | ||
<span class="k">def</span> <span class="nf">convert</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span> <span class="n">Any</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">Any</span><span class="p">:</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Converts from a source object to a target object.</span> | ||
|
||
<span class="sd"> Individual subclasses will map this to a specific subtype.</span> | ||
|
||
<span class="sd"> :param source:</span> | ||
<span class="sd"> :param target: Optional. If passed, modified in place</span> | ||
<span class="sd"> :param kwargs: Additional arguments</span> | ||
<span class="sd"> :return:</span> | ||
<span class="sd"> """</span> | ||
<span class="k">raise</span> <span class="ne">NotImplementedError</span></div> | ||
|
||
|
||
<div class="viewcode-block" id="DataModelConverter.dump"> | ||
<a class="viewcode-back" href="../../../packages/converters/data-model-converter.html#oaklib.converters.data_model_converter.DataModelConverter.dump">[docs]</a> | ||
<span class="nd">@abstractmethod</span> | ||
<span class="k">def</span> <span class="nf">dump</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Dumps a source object to a target file.</span> | ||
|
||
<span class="sd"> :param source:</span> | ||
<span class="sd"> :param target:</span> | ||
<span class="sd"> :return:</span> | ||
<span class="sd"> """</span> | ||
<span class="k">raise</span> <span class="ne">NotImplementedError</span></div> | ||
</div> | ||
|
||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
<footer> | ||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<p>© Copyright 2022-2024, OAK developers.</p> | ||
</div> | ||
|
||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a | ||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> | ||
provided by <a href="https://readthedocs.org">Read the Docs</a>. | ||
|
||
|
||
</footer> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
<script> | ||
jQuery(function () { | ||
SphinxRtdTheme.Navigation.enable(true); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.