This commit is contained in:
remco
2022-08-23 08:40:02 +02:00
parent 590bb1e353
commit 14e571d0e2
276 changed files with 97483 additions and 1 deletions
@@ -0,0 +1,173 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>hansken_extraction_plugin.api.data_context &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/underscore.js"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hansken_extraction_plugin.api.extraction_plugin" href="hansken_extraction_plugin.api.extraction_plugin.html" />
<link rel="prev" title="hansken_extraction_plugin.api" href="hansken_extraction_plugin.api.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2"><a class="reference internal" href="../prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="../getting_started.html">Getting started</a></li>
<li class="toctree-l2"><a class="reference internal" href="../packaging.html">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="../snippets.html">Python code snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="../hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="../debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../python.html#api-documentation">API Documentation</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a><ul class="current">
<li class="toctree-l4 current"><a class="current reference internal" href="#">hansken_extraction_plugin.api.data_context</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_plugin.html">hansken_extraction_plugin.api.extraction_plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_trace.html">hansken_extraction_plugin.api.extraction_trace</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.plugin_info.html">hansken_extraction_plugin.api.plugin_info</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.search_result.html">hansken_extraction_plugin.api.search_result</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.trace_searcher.html">hansken_extraction_plugin.api.trace_searcher</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.tracelet.html">hansken_extraction_plugin.api.tracelet</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.transformation.html">hansken_extraction_plugin.api.transformation</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../../python.html">Python</a> &raquo;</li>
<li><a href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a> &raquo;</li>
<li>hansken_extraction_plugin.api.data_context</li>
<li class="wy-breadcrumbs-aside">
<a href="../../../_sources/dev/python/api/hansken_extraction_plugin.api.data_context.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="module-hansken_extraction_plugin.api.data_context">
<span id="hansken-extraction-plugin-api-data-context"></span><h1>hansken_extraction_plugin.api.data_context<a class="headerlink" href="#module-hansken_extraction_plugin.api.data_context" title="Permalink to this heading"></a></h1>
<p>This module contains the definition of the DataContext.</p>
<p class="rubric">Classes</p>
<table class="autosummary longtable docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.data_context.DataContext" title="hansken_extraction_plugin.api.data_context.DataContext"><code class="xref py py-obj docutils literal notranslate"><span class="pre">DataContext</span></code></a>(data_type, data_size)</p></td>
<td><p>This class contains the data context of a plugin that is processing a trace.</p></td>
</tr>
</tbody>
</table>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.data_context.DataContext">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">DataContext</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_size</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/data_context.html#DataContext"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.data_context.DataContext" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>This class contains the data context of a plugin that is processing a trace.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.data_context.DataContext.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.data_context.DataContext.data_type" title="Permalink to this definition"></a></dt>
<dd><p>the named data type that is being processed</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.data_context.DataContext.data_size">
<span class="sig-name descname"><span class="pre">data_size</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">int</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.data_context.DataContext.data_size" title="Permalink to this definition"></a></dt>
<dd><p>the size / total length of the data stream that is being processed</p>
</dd></dl>
</dd></dl>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="hansken_extraction_plugin.api.html" class="btn btn-neutral float-left" title="hansken_extraction_plugin.api" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="hansken_extraction_plugin.api.extraction_plugin.html" class="btn btn-neutral float-right" title="hansken_extraction_plugin.api.extraction_plugin" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
@@ -0,0 +1,242 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>hansken_extraction_plugin.api.extraction_plugin &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/underscore.js"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hansken_extraction_plugin.api.extraction_trace" href="hansken_extraction_plugin.api.extraction_trace.html" />
<link rel="prev" title="hansken_extraction_plugin.api.data_context" href="hansken_extraction_plugin.api.data_context.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2"><a class="reference internal" href="../prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="../getting_started.html">Getting started</a></li>
<li class="toctree-l2"><a class="reference internal" href="../packaging.html">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="../snippets.html">Python code snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="../hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="../debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../python.html#api-documentation">API Documentation</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.data_context.html">hansken_extraction_plugin.api.data_context</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">hansken_extraction_plugin.api.extraction_plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_trace.html">hansken_extraction_plugin.api.extraction_trace</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.plugin_info.html">hansken_extraction_plugin.api.plugin_info</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.search_result.html">hansken_extraction_plugin.api.search_result</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.trace_searcher.html">hansken_extraction_plugin.api.trace_searcher</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.tracelet.html">hansken_extraction_plugin.api.tracelet</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.transformation.html">hansken_extraction_plugin.api.transformation</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../../python.html">Python</a> &raquo;</li>
<li><a href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a> &raquo;</li>
<li>hansken_extraction_plugin.api.extraction_plugin</li>
<li class="wy-breadcrumbs-aside">
<a href="../../../_sources/dev/python/api/hansken_extraction_plugin.api.extraction_plugin.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="module-hansken_extraction_plugin.api.extraction_plugin">
<span id="hansken-extraction-plugin-api-extraction-plugin"></span><h1>hansken_extraction_plugin.api.extraction_plugin<a class="headerlink" href="#module-hansken_extraction_plugin.api.extraction_plugin" title="Permalink to this heading"></a></h1>
<p>This module contains the different types of Extraction Plugins.</p>
<p>The types of Extraction Plugins differ in their process functions.</p>
<p class="rubric">Classes</p>
<table class="autosummary longtable docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.extraction_plugin.BaseExtractionPlugin" title="hansken_extraction_plugin.api.extraction_plugin.BaseExtractionPlugin"><code class="xref py py-obj docutils literal notranslate"><span class="pre">BaseExtractionPlugin</span></code></a>()</p></td>
<td><p>All Extraction Plugins are derived from this class.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.extraction_plugin.DeferredExtractionPlugin" title="hansken_extraction_plugin.api.extraction_plugin.DeferredExtractionPlugin"><code class="xref py py-obj docutils literal notranslate"><span class="pre">DeferredExtractionPlugin</span></code></a>()</p></td>
<td><p>Extraction Plugin that can be run at a different extraction stage.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.extraction_plugin.ExtractionPlugin" title="hansken_extraction_plugin.api.extraction_plugin.ExtractionPlugin"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ExtractionPlugin</span></code></a>()</p></td>
<td><p>Default extraction plugin, that processes a trace and one of its datastreams.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.extraction_plugin.MetaExtractionPlugin" title="hansken_extraction_plugin.api.extraction_plugin.MetaExtractionPlugin"><code class="xref py py-obj docutils literal notranslate"><span class="pre">MetaExtractionPlugin</span></code></a>()</p></td>
<td><p>Extraction Plugin that processes a trace only with its metadata, without processing its data.</p></td>
</tr>
</tbody>
</table>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_plugin.BaseExtractionPlugin">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">BaseExtractionPlugin</span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_plugin.html#BaseExtractionPlugin"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_plugin.BaseExtractionPlugin" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">ABC</span></code></p>
<p>All Extraction Plugins are derived from this class.</p>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_plugin.BaseExtractionPlugin.plugin_info">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">plugin_info</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="hansken_extraction_plugin.api.plugin_info.html#hansken_extraction_plugin.api.plugin_info.PluginInfo" title="hansken_extraction_plugin.api.plugin_info.PluginInfo"><span class="pre">PluginInfo</span></a></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_plugin.html#BaseExtractionPlugin.plugin_info"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_plugin.BaseExtractionPlugin.plugin_info" title="Permalink to this definition"></a></dt>
<dd><p>Return information about this extraction plugin.</p>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_plugin.ExtractionPlugin">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">ExtractionPlugin</span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_plugin.html#ExtractionPlugin"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_plugin.ExtractionPlugin" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#hansken_extraction_plugin.api.extraction_plugin.BaseExtractionPlugin" title="hansken_extraction_plugin.api.extraction_plugin.BaseExtractionPlugin"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseExtractionPlugin</span></code></a></p>
<p>Default extraction plugin, that processes a trace and one of its datastreams.</p>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_plugin.ExtractionPlugin.process">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">process</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">trace</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_trace.html#hansken_extraction_plugin.api.extraction_trace.ExtractionTrace" title="hansken_extraction_plugin.api.extraction_trace.ExtractionTrace"><span class="pre">ExtractionTrace</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_context</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="hansken_extraction_plugin.api.data_context.html#hansken_extraction_plugin.api.data_context.DataContext" title="hansken_extraction_plugin.api.data_context.DataContext"><span class="pre">DataContext</span></a></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_plugin.html#ExtractionPlugin.process"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_plugin.ExtractionPlugin.process" title="Permalink to this definition"></a></dt>
<dd><p>Process a given trace.</p>
<p>This method is called for every trace that is processed by this tool.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>trace</strong> Trace that is being processed</p></li>
<li><p><strong>data_context</strong> Data data_context describing the data stream that is being processed</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_plugin.MetaExtractionPlugin">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">MetaExtractionPlugin</span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_plugin.html#MetaExtractionPlugin"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_plugin.MetaExtractionPlugin" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#hansken_extraction_plugin.api.extraction_plugin.BaseExtractionPlugin" title="hansken_extraction_plugin.api.extraction_plugin.BaseExtractionPlugin"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseExtractionPlugin</span></code></a></p>
<p>Extraction Plugin that processes a trace only with its metadata, without processing its data.</p>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_plugin.MetaExtractionPlugin.process">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">process</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">trace</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_trace.html#hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace" title="hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace"><span class="pre">MetaExtractionTrace</span></a></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_plugin.html#MetaExtractionPlugin.process"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_plugin.MetaExtractionPlugin.process" title="Permalink to this definition"></a></dt>
<dd><p>Process a given trace.</p>
<p>This method is called for every trace that is processed by this tool.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>trace</strong> Trace that is being processed</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_plugin.DeferredExtractionPlugin">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">DeferredExtractionPlugin</span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_plugin.html#DeferredExtractionPlugin"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_plugin.DeferredExtractionPlugin" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#hansken_extraction_plugin.api.extraction_plugin.BaseExtractionPlugin" title="hansken_extraction_plugin.api.extraction_plugin.BaseExtractionPlugin"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseExtractionPlugin</span></code></a></p>
<p>Extraction Plugin that can be run at a different extraction stage.</p>
<p>This type of plugin also allows accessing other traces using the searcher.</p>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_plugin.DeferredExtractionPlugin.process">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">process</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">trace</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_trace.html#hansken_extraction_plugin.api.extraction_trace.ExtractionTrace" title="hansken_extraction_plugin.api.extraction_trace.ExtractionTrace"><span class="pre">ExtractionTrace</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_context</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="hansken_extraction_plugin.api.data_context.html#hansken_extraction_plugin.api.data_context.DataContext" title="hansken_extraction_plugin.api.data_context.DataContext"><span class="pre">DataContext</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">searcher</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="hansken_extraction_plugin.api.trace_searcher.html#hansken_extraction_plugin.api.trace_searcher.TraceSearcher" title="hansken_extraction_plugin.api.trace_searcher.TraceSearcher"><span class="pre">TraceSearcher</span></a></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_plugin.html#DeferredExtractionPlugin.process"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_plugin.DeferredExtractionPlugin.process" title="Permalink to this definition"></a></dt>
<dd><p>Process a given trace.</p>
<p>This method is called for every trace that is processed by this tool.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>trace</strong> Trace that is being processed</p></li>
<li><p><strong>data_context</strong> Data data_context describing the data stream that is being processed</p></li>
<li><p><strong>searcher</strong> TraceSearcher that can be used to obtain more traces</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</dd></dl>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="hansken_extraction_plugin.api.data_context.html" class="btn btn-neutral float-left" title="hansken_extraction_plugin.api.data_context" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="hansken_extraction_plugin.api.extraction_trace.html" class="btn btn-neutral float-right" title="hansken_extraction_plugin.api.extraction_trace" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
@@ -0,0 +1,439 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>hansken_extraction_plugin.api.extraction_trace &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/underscore.js"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hansken_extraction_plugin.api.plugin_info" href="hansken_extraction_plugin.api.plugin_info.html" />
<link rel="prev" title="hansken_extraction_plugin.api.extraction_plugin" href="hansken_extraction_plugin.api.extraction_plugin.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2"><a class="reference internal" href="../prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="../getting_started.html">Getting started</a></li>
<li class="toctree-l2"><a class="reference internal" href="../packaging.html">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="../snippets.html">Python code snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="../hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="../debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../python.html#api-documentation">API Documentation</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.data_context.html">hansken_extraction_plugin.api.data_context</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_plugin.html">hansken_extraction_plugin.api.extraction_plugin</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">hansken_extraction_plugin.api.extraction_trace</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.plugin_info.html">hansken_extraction_plugin.api.plugin_info</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.search_result.html">hansken_extraction_plugin.api.search_result</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.trace_searcher.html">hansken_extraction_plugin.api.trace_searcher</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.tracelet.html">hansken_extraction_plugin.api.tracelet</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.transformation.html">hansken_extraction_plugin.api.transformation</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../../python.html">Python</a> &raquo;</li>
<li><a href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a> &raquo;</li>
<li>hansken_extraction_plugin.api.extraction_trace</li>
<li class="wy-breadcrumbs-aside">
<a href="../../../_sources/dev/python/api/hansken_extraction_plugin.api.extraction_trace.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="module-hansken_extraction_plugin.api.extraction_trace">
<span id="hansken-extraction-plugin-api-extraction-trace"></span><h1>hansken_extraction_plugin.api.extraction_trace<a class="headerlink" href="#module-hansken_extraction_plugin.api.extraction_trace" title="Permalink to this heading"></a></h1>
<p>This module contains the different Trace apis.</p>
<dl class="simple">
<dt>Note that there are a couple of different traces:</dt><dd><ul class="simple">
<li><p>The ExtractionTrace and MetaExtractionTrace, which are offered to the process function.</p></li>
<li><p>ExtractionTraceBuilder, which is a trace that can be built; it does not exist in hansken yet, but it is added after
building.</p></li>
<li><p>SearchTrace, which represents an immutable trace which is returned after searching for traces.</p></li>
</ul>
</dd>
</dl>
<p class="rubric">Classes</p>
<table class="autosummary longtable docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTrace" title="hansken_extraction_plugin.api.extraction_trace.ExtractionTrace"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ExtractionTrace</span></code></a>()</p></td>
<td><p>Trace offered to be processed.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder" title="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ExtractionTraceBuilder</span></code></a>()</p></td>
<td><p>ExtractionTrace that can be build.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace" title="hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace"><code class="xref py py-obj docutils literal notranslate"><span class="pre">MetaExtractionTrace</span></code></a>()</p></td>
<td><p>MetaExtractionTraces contain only metadata.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.extraction_trace.SearchTrace" title="hansken_extraction_plugin.api.extraction_trace.SearchTrace"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SearchTrace</span></code></a>()</p></td>
<td><p>SearchTraces represent traces returned when searching for traces.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.extraction_trace.Trace" title="hansken_extraction_plugin.api.extraction_trace.Trace"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Trace</span></code></a>()</p></td>
<td><p>All trace classes should be able to return values.</p></td>
</tr>
</tbody>
</table>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">ExtractionTraceBuilder</span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#ExtractionTraceBuilder"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">ABC</span></code></p>
<p>ExtractionTrace that can be build.</p>
<p>Represents child traces.</p>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.update">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">update</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key_or_updates</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">Mapping</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Any</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Mapping</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">bytes</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder" title="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder"><span class="pre">ExtractionTraceBuilder</span></a></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#ExtractionTraceBuilder.update"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.update" title="Permalink to this definition"></a></dt>
<dd><p>Update or add metadata properties for this <cite>.ExtractionTraceBuilder</cite>.</p>
<p>Can be used to update the name of the Trace represented by this builder,
if not already set.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>key_or_updates</strong> either a <cite>str</cite> (the metadata property to be
updated) or a mapping supplying both keys and values to be updated</p></li>
<li><p><strong>value</strong> the value to update metadata property <em>key</em> to (used
only when <em>key_or_updates</em> is a <cite>str</cite>, an exception will be thrown
if <em>key_or_updates</em> is a mapping)</p></li>
<li><p><strong>data</strong> a <cite>dict</cite> mapping data type / stream name to bytes to be
added to the trace</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>this <cite>.ExtractionTraceBuilder</cite></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.add_tracelet">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">add_tracelet</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tracelet</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="hansken_extraction_plugin.api.tracelet.html#hansken_extraction_plugin.api.tracelet.Tracelet" title="hansken_extraction_plugin.api.tracelet.Tracelet"><span class="pre">Tracelet</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Mapping</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Any</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder" title="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder"><span class="pre">ExtractionTraceBuilder</span></a></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#ExtractionTraceBuilder.add_tracelet"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.add_tracelet" title="Permalink to this definition"></a></dt>
<dd><p>Add a <cite>.Tracelet</cite> to this <cite>.ExtractionTraceBuilder</cite>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tracelet</strong> the Tracelet or tracelet type (supplied as a <cite>str</cite>) to add</p></li>
<li><p><strong>value</strong> the tracelet properties to add (only applicable when <em>tracelet</em> is a <cite>str</cite>)</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>this <cite>.ExtractionTraceBuilder</cite></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.add_transformation">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">add_transformation</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transformation</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="hansken_extraction_plugin.api.transformation.html#hansken_extraction_plugin.api.transformation.Transformation" title="hansken_extraction_plugin.api.transformation.Transformation"><span class="pre">Transformation</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder" title="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder"><span class="pre">ExtractionTraceBuilder</span></a></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#ExtractionTraceBuilder.add_transformation"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.add_transformation" title="Permalink to this definition"></a></dt>
<dd><p>Update or add transformations for this <cite>.ExtractionTraceBuilder</cite>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data_type</strong> data type of the Transformation</p></li>
<li><p><strong>transformation</strong> the Transformation to add</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>this <cite>.ExtractionTraceBuilder</cite></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.child_builder">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">child_builder</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder" title="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder"><span class="pre">ExtractionTraceBuilder</span></a></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#ExtractionTraceBuilder.child_builder"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.child_builder" title="Permalink to this definition"></a></dt>
<dd><p>Create a new <cite>.TraceBuilder</cite> to build a child trace to the trace to be represented by this builder.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Traces should be created and built in depth first order,
parent before child (pre-order).</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>a <cite>.TraceBuilder</cite> set up to save a new trace as the child
trace of this builder</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.add_data">
<span class="sig-name descname"><span class="pre">add_data</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bytes</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder" title="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder"><span class="pre">ExtractionTraceBuilder</span></a></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#ExtractionTraceBuilder.add_data"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.add_data" title="Permalink to this definition"></a></dt>
<dd><p>Add data to this trace as a named stream.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>stream</strong> name of the data stream to be added</p></li>
<li><p><strong>data</strong> data to be attached</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>this <cite>.ExtractionTraceBuilder</cite></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.build">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">build</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#ExtractionTraceBuilder.build"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.build" title="Permalink to this definition"></a></dt>
<dd><p>Save the trace being built by this builder to remote.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Building more than once will result in an error being raised.</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>the new trace id</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.Trace">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">Trace</span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#Trace"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.Trace" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">ABC</span></code></p>
<p>All trace classes should be able to return values.</p>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.Trace.get">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">get</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">default</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Any</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Any</span></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#Trace.get"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.Trace.get" title="Permalink to this definition"></a></dt>
<dd><p>Return metadata properties for this <cite>.ExtractionTrace</cite>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>key</strong> the metadata property to be retrieved</p></li>
<li><p><strong>default</strong> value returned if property is not set</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>the value of the requested metadata property</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.SearchTrace">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">SearchTrace</span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#SearchTrace"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.SearchTrace" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#hansken_extraction_plugin.api.extraction_trace.Trace" title="hansken_extraction_plugin.api.extraction_trace.Trace"><code class="xref py py-class docutils literal notranslate"><span class="pre">Trace</span></code></a></p>
<p>SearchTraces represent traces returned when searching for traces.</p>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.SearchTrace.open">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">open</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'raw'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">offset</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">size</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">BufferedReader</span></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#SearchTrace.open"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.SearchTrace.open" title="Permalink to this definition"></a></dt>
<dd><p>Open a data stream of the data that is being processed.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>stream</strong> data stream of trace to open. defaults to raw. other examples are html, text, etc.</p></li>
<li><p><strong>offset</strong> byte offset to start the stream on</p></li>
<li><p><strong>size</strong> the number of bytes to make available</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>a file-like object to read bytes from the named stream</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">MetaExtractionTrace</span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#MetaExtractionTrace"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#hansken_extraction_plugin.api.extraction_trace.Trace" title="hansken_extraction_plugin.api.extraction_trace.Trace"><code class="xref py py-class docutils literal notranslate"><span class="pre">Trace</span></code></a></p>
<p>MetaExtractionTraces contain only metadata.</p>
<p>This class represenst traces during the extraction of an extraction plugin without a data stream.</p>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace.update">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">update</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key_or_updates</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">Mapping</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Any</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Mapping</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">bytes</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#MetaExtractionTrace.update"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace.update" title="Permalink to this definition"></a></dt>
<dd><p>Update or add metadata properties for this <cite>.ExtractionTrace</cite>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>key_or_updates</strong> either a <cite>str</cite> (the metadata property to be
updated) or a mapping supplying both keys and values to be updated</p></li>
<li><p><strong>value</strong> the value to update metadata property <em>key</em> to (used
only when <em>key_or_updates</em> is a <cite>str</cite>, an exception will be thrown
if <em>key_or_updates</em> is a mapping)</p></li>
<li><p><strong>data</strong> a <cite>dict</cite> mapping data type / stream name to bytes to be
added to the trace</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace.add_tracelet">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">add_tracelet</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tracelet</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="hansken_extraction_plugin.api.tracelet.html#hansken_extraction_plugin.api.tracelet.Tracelet" title="hansken_extraction_plugin.api.tracelet.Tracelet"><span class="pre">Tracelet</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Mapping</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Any</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#MetaExtractionTrace.add_tracelet"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace.add_tracelet" title="Permalink to this definition"></a></dt>
<dd><p>Add a <cite>.Tracelet</cite> to this <cite>.MetaExtractionTrace</cite>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tracelet</strong> the Tracelet or tracelet type to add</p></li>
<li><p><strong>value</strong> the tracelet properties to add (only applicable when <em>tracelet</em> is a tracelet type)</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace.add_transformation">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">add_transformation</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transformation</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="hansken_extraction_plugin.api.transformation.html#hansken_extraction_plugin.api.transformation.Transformation" title="hansken_extraction_plugin.api.transformation.Transformation"><span class="pre">Transformation</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#MetaExtractionTrace.add_transformation"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace.add_transformation" title="Permalink to this definition"></a></dt>
<dd><p>Update or add transformations for this <cite>.ExtractionTraceBuilder</cite>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data_type</strong> data type of the Transformation</p></li>
<li><p><strong>transformation</strong> the Transformation to add</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace.child_builder">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">child_builder</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder" title="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder"><span class="pre">ExtractionTraceBuilder</span></a></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#MetaExtractionTrace.child_builder"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace.child_builder" title="Permalink to this definition"></a></dt>
<dd><p>Create a <cite>.TraceBuilder</cite> to build a trace to be saved as a child of this <cite>.Trace</cite>.</p>
<p>A new trace will only be added to the index once explicitly saved (e.g.
through <cite>.TraceBuilder.build</cite>).</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Traces should be created and built in depth first order,
parent before child (pre-order).</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>name</strong> the name for the trace being built</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>a <cite>.TraceBuilder</cite> set up to create a child trace of this <cite>.MetaExtractionTrace</cite></p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.ExtractionTrace">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">ExtractionTrace</span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#ExtractionTrace"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTrace" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace" title="hansken_extraction_plugin.api.extraction_trace.MetaExtractionTrace"><code class="xref py py-class docutils literal notranslate"><span class="pre">MetaExtractionTrace</span></code></a></p>
<p>Trace offered to be processed.</p>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.extraction_trace.ExtractionTrace.open">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">open</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">offset</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">size</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">BufferedReader</span></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/extraction_trace.html#ExtractionTrace.open"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.extraction_trace.ExtractionTrace.open" title="Permalink to this definition"></a></dt>
<dd><p>Open a data stream of the data that is being processed.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>offset</strong> byte offset to start the stream on</p></li>
<li><p><strong>size</strong> the number of bytes to make available</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>a file-like object to read bytes from the named stream</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="hansken_extraction_plugin.api.extraction_plugin.html" class="btn btn-neutral float-left" title="hansken_extraction_plugin.api.extraction_plugin" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="hansken_extraction_plugin.api.plugin_info.html" class="btn btn-neutral float-right" title="hansken_extraction_plugin.api.plugin_info" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
@@ -0,0 +1,175 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>hansken_extraction_plugin.api &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/underscore.js"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hansken_extraction_plugin.api.data_context" href="hansken_extraction_plugin.api.data_context.html" />
<link rel="prev" title="How to debug an Extraction Plugin" href="../debugging.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2"><a class="reference internal" href="../prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="../getting_started.html">Getting started</a></li>
<li class="toctree-l2"><a class="reference internal" href="../packaging.html">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="../snippets.html">Python code snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="../hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="../debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../python.html#api-documentation">API Documentation</a><ul class="current">
<li class="toctree-l3 current"><a class="current reference internal" href="#">hansken_extraction_plugin.api</a><ul>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.data_context.html">hansken_extraction_plugin.api.data_context</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_plugin.html">hansken_extraction_plugin.api.extraction_plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_trace.html">hansken_extraction_plugin.api.extraction_trace</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.plugin_info.html">hansken_extraction_plugin.api.plugin_info</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.search_result.html">hansken_extraction_plugin.api.search_result</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.trace_searcher.html">hansken_extraction_plugin.api.trace_searcher</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.tracelet.html">hansken_extraction_plugin.api.tracelet</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.transformation.html">hansken_extraction_plugin.api.transformation</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../../python.html">Python</a> &raquo;</li>
<li>hansken_extraction_plugin.api</li>
<li class="wy-breadcrumbs-aside">
<a href="../../../_sources/dev/python/api/hansken_extraction_plugin.api.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="module-hansken_extraction_plugin.api">
<span id="hansken-extraction-plugin-api"></span><h1>hansken_extraction_plugin.api<a class="headerlink" href="#module-hansken_extraction_plugin.api" title="Permalink to this heading"></a></h1>
<p>This package contains the apis of the different classes used by extraction plugins.</p>
<p>Implementations can be found in the runtime module.</p>
<p class="rubric">Modules</p>
<table class="autosummary longtable docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="hansken_extraction_plugin.api.data_context.html#module-hansken_extraction_plugin.api.data_context" title="hansken_extraction_plugin.api.data_context"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hansken_extraction_plugin.api.data_context</span></code></a></p></td>
<td><p>This module contains the definition of the DataContext.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="hansken_extraction_plugin.api.extraction_plugin.html#module-hansken_extraction_plugin.api.extraction_plugin" title="hansken_extraction_plugin.api.extraction_plugin"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hansken_extraction_plugin.api.extraction_plugin</span></code></a></p></td>
<td><p>This module contains the different types of Extraction Plugins.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="hansken_extraction_plugin.api.extraction_trace.html#module-hansken_extraction_plugin.api.extraction_trace" title="hansken_extraction_plugin.api.extraction_trace"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hansken_extraction_plugin.api.extraction_trace</span></code></a></p></td>
<td><p>This module contains the different Trace apis.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="hansken_extraction_plugin.api.plugin_info.html#module-hansken_extraction_plugin.api.plugin_info" title="hansken_extraction_plugin.api.plugin_info"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hansken_extraction_plugin.api.plugin_info</span></code></a></p></td>
<td><p>This module contains all definitions to describe meta data of a plugin, a.k.a.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="hansken_extraction_plugin.api.search_result.html#module-hansken_extraction_plugin.api.search_result" title="hansken_extraction_plugin.api.search_result"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hansken_extraction_plugin.api.search_result</span></code></a></p></td>
<td><p>This module contains a representation of a search result.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="hansken_extraction_plugin.api.trace_searcher.html#module-hansken_extraction_plugin.api.trace_searcher" title="hansken_extraction_plugin.api.trace_searcher"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hansken_extraction_plugin.api.trace_searcher</span></code></a></p></td>
<td><p>This module contains the definition of a trace searcher.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="hansken_extraction_plugin.api.tracelet.html#module-hansken_extraction_plugin.api.tracelet" title="hansken_extraction_plugin.api.tracelet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hansken_extraction_plugin.api.tracelet</span></code></a></p></td>
<td><p>This module contains the definition of a Tracelet.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="hansken_extraction_plugin.api.transformation.html#module-hansken_extraction_plugin.api.transformation" title="hansken_extraction_plugin.api.transformation"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hansken_extraction_plugin.api.transformation</span></code></a></p></td>
<td><p>This module contains the definition of a Transformation.</p></td>
</tr>
</tbody>
</table>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="../debugging.html" class="btn btn-neutral float-left" title="How to debug an Extraction Plugin" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="hansken_extraction_plugin.api.data_context.html" class="btn btn-neutral float-right" title="hansken_extraction_plugin.api.data_context" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
@@ -0,0 +1,322 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>hansken_extraction_plugin.api.plugin_info &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/underscore.js"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hansken_extraction_plugin.api.search_result" href="hansken_extraction_plugin.api.search_result.html" />
<link rel="prev" title="hansken_extraction_plugin.api.extraction_trace" href="hansken_extraction_plugin.api.extraction_trace.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2"><a class="reference internal" href="../prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="../getting_started.html">Getting started</a></li>
<li class="toctree-l2"><a class="reference internal" href="../packaging.html">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="../snippets.html">Python code snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="../hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="../debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../python.html#api-documentation">API Documentation</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.data_context.html">hansken_extraction_plugin.api.data_context</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_plugin.html">hansken_extraction_plugin.api.extraction_plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_trace.html">hansken_extraction_plugin.api.extraction_trace</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">hansken_extraction_plugin.api.plugin_info</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.search_result.html">hansken_extraction_plugin.api.search_result</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.trace_searcher.html">hansken_extraction_plugin.api.trace_searcher</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.tracelet.html">hansken_extraction_plugin.api.tracelet</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.transformation.html">hansken_extraction_plugin.api.transformation</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../../python.html">Python</a> &raquo;</li>
<li><a href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a> &raquo;</li>
<li>hansken_extraction_plugin.api.plugin_info</li>
<li class="wy-breadcrumbs-aside">
<a href="../../../_sources/dev/python/api/hansken_extraction_plugin.api.plugin_info.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="module-hansken_extraction_plugin.api.plugin_info">
<span id="hansken-extraction-plugin-api-plugin-info"></span><h1>hansken_extraction_plugin.api.plugin_info<a class="headerlink" href="#module-hansken_extraction_plugin.api.plugin_info" title="Permalink to this heading"></a></h1>
<p>This module contains all definitions to describe meta data of a plugin, a.k.a. PluginInfo.</p>
<p class="rubric">Classes</p>
<table class="autosummary longtable docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.plugin_info.Author" title="hansken_extraction_plugin.api.plugin_info.Author"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Author</span></code></a>(name, email, organisation)</p></td>
<td><p>The author of an Extraction Plugin.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.plugin_info.MaturityLevel" title="hansken_extraction_plugin.api.plugin_info.MaturityLevel"><code class="xref py py-obj docutils literal notranslate"><span class="pre">MaturityLevel</span></code></a>(value)</p></td>
<td><p>This class represents the maturity level of an extraction plugin.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.plugin_info.PluginId" title="hansken_extraction_plugin.api.plugin_info.PluginId"><code class="xref py py-obj docutils literal notranslate"><span class="pre">PluginId</span></code></a>(domain, category, name)</p></td>
<td><p>Identifier of a plugin, consisting of domain, category and name.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.plugin_info.PluginInfo" title="hansken_extraction_plugin.api.plugin_info.PluginInfo"><code class="xref py py-obj docutils literal notranslate"><span class="pre">PluginInfo</span></code></a>(id, version, description, author, ...)</p></td>
<td><p>This information is used by Hansken to identify and run the plugin.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.plugin_info.PluginResources" title="hansken_extraction_plugin.api.plugin_info.PluginResources"><code class="xref py py-obj docutils literal notranslate"><span class="pre">PluginResources</span></code></a>(maximum_cpu, maximum_memory)</p></td>
<td><p>PluginResources contains information about how many resources will be used for a plugin.</p></td>
</tr>
</tbody>
</table>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.Author">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">Author</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">email</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">organisation</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/plugin_info.html#Author"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.Author" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>The author of an Extraction Plugin.</p>
<p>This information can be retrieved by an end-user from Hansken.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.Author.name">
<span class="sig-name descname"><span class="pre">name</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.Author.name" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.Author.email">
<span class="sig-name descname"><span class="pre">email</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.Author.email" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.Author.organisation">
<span class="sig-name descname"><span class="pre">organisation</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.Author.organisation" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.MaturityLevel">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">MaturityLevel</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/plugin_info.html#MaturityLevel"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.MaturityLevel" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Enum</span></code></p>
<p>This class represents the maturity level of an extraction plugin.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.MaturityLevel.PROOF_OF_CONCEPT">
<span class="sig-name descname"><span class="pre">PROOF_OF_CONCEPT</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">0</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.MaturityLevel.PROOF_OF_CONCEPT" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.MaturityLevel.READY_FOR_TEST">
<span class="sig-name descname"><span class="pre">READY_FOR_TEST</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">1</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.MaturityLevel.READY_FOR_TEST" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.MaturityLevel.PRODUCTION_READY">
<span class="sig-name descname"><span class="pre">PRODUCTION_READY</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">2</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.MaturityLevel.PRODUCTION_READY" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginId">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">PluginId</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">domain</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">category</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/plugin_info.html#PluginId"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginId" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Identifier of a plugin, consisting of domain, category and name. Needs to be unique among all tools/plugins.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginId.domain">
<span class="sig-name descname"><span class="pre">domain</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginId.domain" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginId.category">
<span class="sig-name descname"><span class="pre">category</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginId.category" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginId.name">
<span class="sig-name descname"><span class="pre">name</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginId.name" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginResources">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">PluginResources</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">maximum_cpu</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">float</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">maximum_memory</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/plugin_info.html#PluginResources"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginResources" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>PluginResources contains information about how many resources will be used for a plugin.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginResources.maximum_cpu">
<span class="sig-name descname"><span class="pre">maximum_cpu</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">float</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginResources.maximum_cpu" title="Permalink to this definition"></a></dt>
<dd><p>CPU resources are measured in cpu units. One cpu is equivalent to 1 vCPU/Core for cloud providers and 1 hyperthread
on bare-metal Intel processors. Also, fractional requests are allowed. A plugin that asks 0.5 CPU uses half as
much CPU as one that asks for 1 CPU.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginResources.maximum_memory">
<span class="sig-name descname"><span class="pre">maximum_memory</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginResources.maximum_memory" title="Permalink to this definition"></a></dt>
<dd><p>Max usable memory for a plugin, measured in megabytes.</p>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginInfo">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">PluginInfo</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#hansken_extraction_plugin.api.plugin_info.PluginId" title="hansken_extraction_plugin.api.plugin_info.PluginId"><span class="pre">PluginId</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">version</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">description</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">author</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#hansken_extraction_plugin.api.plugin_info.Author" title="hansken_extraction_plugin.api.plugin_info.Author"><span class="pre">Author</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">maturity</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#hansken_extraction_plugin.api.plugin_info.MaturityLevel" title="hansken_extraction_plugin.api.plugin_info.MaturityLevel"><span class="pre">MaturityLevel</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">matcher</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">webpage_url</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">license</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">deferred_iterations</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">resources</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#hansken_extraction_plugin.api.plugin_info.PluginResources" title="hansken_extraction_plugin.api.plugin_info.PluginResources"><span class="pre">PluginResources</span></a><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/plugin_info.html#PluginInfo"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginInfo" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>This information is used by Hansken to identify and run the plugin.</p>
<p>Note that the build_plugin.py build script is used to build a plugin docker image with PluginInfo docker labels.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginInfo.id">
<span class="sig-name descname"><span class="pre">id</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#hansken_extraction_plugin.api.plugin_info.PluginId" title="hansken_extraction_plugin.api.plugin_info.PluginId"><span class="pre">PluginId</span></a></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginInfo.id" title="Permalink to this definition"></a></dt>
<dd><p>a plugins unique identifier, see PluginId</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginInfo.version">
<span class="sig-name descname"><span class="pre">version</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginInfo.version" title="Permalink to this definition"></a></dt>
<dd><p>version of the plugin</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginInfo.description">
<span class="sig-name descname"><span class="pre">description</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginInfo.description" title="Permalink to this definition"></a></dt>
<dd><p>short description of the functionality of the plugin</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginInfo.author">
<span class="sig-name descname"><span class="pre">author</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#hansken_extraction_plugin.api.plugin_info.Author" title="hansken_extraction_plugin.api.plugin_info.Author"><span class="pre">Author</span></a></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginInfo.author" title="Permalink to this definition"></a></dt>
<dd><p>the plugins author, see Author</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginInfo.maturity">
<span class="sig-name descname"><span class="pre">maturity</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#hansken_extraction_plugin.api.plugin_info.MaturityLevel" title="hansken_extraction_plugin.api.plugin_info.MaturityLevel"><span class="pre">MaturityLevel</span></a></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginInfo.maturity" title="Permalink to this definition"></a></dt>
<dd><p>maturity level, see MaturityLevel</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginInfo.matcher">
<span class="sig-name descname"><span class="pre">matcher</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginInfo.matcher" title="Permalink to this definition"></a></dt>
<dd><p>this matcher selects the traces offered to the plugin</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginInfo.webpage_url">
<span class="sig-name descname"><span class="pre">webpage_url</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginInfo.webpage_url" title="Permalink to this definition"></a></dt>
<dd><p>plugin url</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginInfo.license">
<span class="sig-name descname"><span class="pre">license</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">None</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginInfo.license" title="Permalink to this definition"></a></dt>
<dd><p>license of this plugin</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginInfo.deferred_iterations">
<span class="sig-name descname"><span class="pre">deferred_iterations</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">int</span></em><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">1</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginInfo.deferred_iterations" title="Permalink to this definition"></a></dt>
<dd><p>number of deferred iterations (1 to 20), nly for deferred plugins (optional)</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.plugin_info.PluginInfo.resources">
<span class="sig-name descname"><span class="pre">resources</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#hansken_extraction_plugin.api.plugin_info.PluginResources" title="hansken_extraction_plugin.api.plugin_info.PluginResources"><span class="pre">PluginResources</span></a><span class="p"><span class="pre">]</span></span></em><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">None</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.plugin_info.PluginInfo.resources" title="Permalink to this definition"></a></dt>
<dd><p>resources to be reserved for a plugin (optional)</p>
</dd></dl>
</dd></dl>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="hansken_extraction_plugin.api.extraction_trace.html" class="btn btn-neutral float-left" title="hansken_extraction_plugin.api.extraction_trace" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="hansken_extraction_plugin.api.search_result.html" class="btn btn-neutral float-right" title="hansken_extraction_plugin.api.search_result" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
@@ -0,0 +1,222 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>hansken_extraction_plugin.api.search_result &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/underscore.js"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hansken_extraction_plugin.api.trace_searcher" href="hansken_extraction_plugin.api.trace_searcher.html" />
<link rel="prev" title="hansken_extraction_plugin.api.plugin_info" href="hansken_extraction_plugin.api.plugin_info.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2"><a class="reference internal" href="../prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="../getting_started.html">Getting started</a></li>
<li class="toctree-l2"><a class="reference internal" href="../packaging.html">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="../snippets.html">Python code snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="../hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="../debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../python.html#api-documentation">API Documentation</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.data_context.html">hansken_extraction_plugin.api.data_context</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_plugin.html">hansken_extraction_plugin.api.extraction_plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_trace.html">hansken_extraction_plugin.api.extraction_trace</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.plugin_info.html">hansken_extraction_plugin.api.plugin_info</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">hansken_extraction_plugin.api.search_result</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.trace_searcher.html">hansken_extraction_plugin.api.trace_searcher</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.tracelet.html">hansken_extraction_plugin.api.tracelet</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.transformation.html">hansken_extraction_plugin.api.transformation</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../../python.html">Python</a> &raquo;</li>
<li><a href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a> &raquo;</li>
<li>hansken_extraction_plugin.api.search_result</li>
<li class="wy-breadcrumbs-aside">
<a href="../../../_sources/dev/python/api/hansken_extraction_plugin.api.search_result.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="module-hansken_extraction_plugin.api.search_result">
<span id="hansken-extraction-plugin-api-search-result"></span><h1>hansken_extraction_plugin.api.search_result<a class="headerlink" href="#module-hansken_extraction_plugin.api.search_result" title="Permalink to this heading"></a></h1>
<p>This module contains a representation of a search result.</p>
<p class="rubric">Classes</p>
<table class="autosummary longtable docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.search_result.SearchResult" title="hansken_extraction_plugin.api.search_result.SearchResult"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SearchResult</span></code></a>(*args, **kwds)</p></td>
<td><p>Class representing a stream of traces, returned when performing a search request.</p></td>
</tr>
</tbody>
</table>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.search_result.SearchResult">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">SearchResult</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/search_result.html#SearchResult"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.search_result.SearchResult" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">ABC</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">Iterable</span></code></p>
<p>Class representing a stream of traces, returned when performing a search request.</p>
<p>This result can only be iterated once. Results can be retrieved in three ways:</p>
<p>Treating the result as an iterable:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">trace</span> <span class="ow">in</span> <span class="n">result</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="n">trace</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
</pre></div>
</div>
<p>Calling <cite>.take</cite> to process one or more batches of traces:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">first_100</span> <span class="o">=</span> <span class="n">result</span><span class="o">.</span><span class="n">take</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span>
<span class="n">process_batch</span><span class="p">(</span><span class="n">first_100</span><span class="p">)</span>
</pre></div>
</div>
<p>Calling <cite>.takeone</cite> to get a single trace:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">first</span> <span class="o">=</span> <span class="n">result</span><span class="o">.</span><span class="n">takeone</span><span class="p">()</span>
<span class="n">second</span> <span class="o">=</span> <span class="n">result</span><span class="o">.</span><span class="n">takeone</span><span class="p">()</span>
<span class="nb">print</span><span class="p">(</span><span class="n">first</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">second</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.search_result.SearchResult.total_results">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">total_results</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/search_result.html#SearchResult.total_results"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.search_result.SearchResult.total_results" title="Permalink to this definition"></a></dt>
<dd><p>Return the total number of hits.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Total number of hits</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.search_result.SearchResult.takeone">
<span class="sig-name descname"><span class="pre">takeone</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="hansken_extraction_plugin.api.extraction_trace.html#hansken_extraction_plugin.api.extraction_trace.SearchTrace" title="hansken_extraction_plugin.api.extraction_trace.SearchTrace"><span class="pre">SearchTrace</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/search_result.html#SearchResult.takeone"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.search_result.SearchResult.takeone" title="Permalink to this definition"></a></dt>
<dd><p>Return a single trace, if this stream is not exhausted.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>A searchtrace, or None if no trace is available</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.search_result.SearchResult.take">
<span class="sig-name descname"><span class="pre">take</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">num</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="hansken_extraction_plugin.api.extraction_trace.html#hansken_extraction_plugin.api.extraction_trace.SearchTrace" title="hansken_extraction_plugin.api.extraction_trace.SearchTrace"><span class="pre">SearchTrace</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/search_result.html#SearchResult.take"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.search_result.SearchResult.take" title="Permalink to this definition"></a></dt>
<dd><p>Return a list containing at most num number of traces, or less if they are not available.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>num</strong> Number of traces to take</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>List containing zero or more traces</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.search_result.SearchResult.close">
<span class="sig-name descname"><span class="pre">close</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/search_result.html#SearchResult.close"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.search_result.SearchResult.close" title="Permalink to this definition"></a></dt>
<dd><p>Close this SearchResult if no more traces are to be retrieved.</p>
<p>Required to keep compatibility with hansken.py.</p>
</dd></dl>
</dd></dl>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="hansken_extraction_plugin.api.plugin_info.html" class="btn btn-neutral float-left" title="hansken_extraction_plugin.api.plugin_info" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="hansken_extraction_plugin.api.trace_searcher.html" class="btn btn-neutral float-right" title="hansken_extraction_plugin.api.trace_searcher" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
@@ -0,0 +1,178 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>hansken_extraction_plugin.api.trace_searcher &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/underscore.js"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hansken_extraction_plugin.api.tracelet" href="hansken_extraction_plugin.api.tracelet.html" />
<link rel="prev" title="hansken_extraction_plugin.api.search_result" href="hansken_extraction_plugin.api.search_result.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2"><a class="reference internal" href="../prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="../getting_started.html">Getting started</a></li>
<li class="toctree-l2"><a class="reference internal" href="../packaging.html">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="../snippets.html">Python code snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="../hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="../debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../python.html#api-documentation">API Documentation</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.data_context.html">hansken_extraction_plugin.api.data_context</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_plugin.html">hansken_extraction_plugin.api.extraction_plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_trace.html">hansken_extraction_plugin.api.extraction_trace</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.plugin_info.html">hansken_extraction_plugin.api.plugin_info</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.search_result.html">hansken_extraction_plugin.api.search_result</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">hansken_extraction_plugin.api.trace_searcher</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.tracelet.html">hansken_extraction_plugin.api.tracelet</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.transformation.html">hansken_extraction_plugin.api.transformation</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../../python.html">Python</a> &raquo;</li>
<li><a href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a> &raquo;</li>
<li>hansken_extraction_plugin.api.trace_searcher</li>
<li class="wy-breadcrumbs-aside">
<a href="../../../_sources/dev/python/api/hansken_extraction_plugin.api.trace_searcher.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="module-hansken_extraction_plugin.api.trace_searcher">
<span id="hansken-extraction-plugin-api-trace-searcher"></span><h1>hansken_extraction_plugin.api.trace_searcher<a class="headerlink" href="#module-hansken_extraction_plugin.api.trace_searcher" title="Permalink to this heading"></a></h1>
<p>This module contains the definition of a trace searcher.</p>
<p class="rubric">Classes</p>
<table class="autosummary longtable docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.trace_searcher.TraceSearcher" title="hansken_extraction_plugin.api.trace_searcher.TraceSearcher"><code class="xref py py-obj docutils literal notranslate"><span class="pre">TraceSearcher</span></code></a>()</p></td>
<td><p>This class can be used to search for traces, using the search method.</p></td>
</tr>
</tbody>
</table>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.trace_searcher.TraceSearcher">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">TraceSearcher</span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/trace_searcher.html#TraceSearcher"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.trace_searcher.TraceSearcher" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>This class can be used to search for traces, using the search method.</p>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.trace_searcher.TraceSearcher.search">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">search</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">query</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">count</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="hansken_extraction_plugin.api.search_result.html#hansken_extraction_plugin.api.search_result.SearchResult" title="hansken_extraction_plugin.api.search_result.SearchResult"><span class="pre">SearchResult</span></a></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/trace_searcher.html#TraceSearcher.search"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.trace_searcher.TraceSearcher.search" title="Permalink to this definition"></a></dt>
<dd><p>Search for indexed traces in Hansken using provided query returning at most count results.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>query</strong> HQL-query used for searching</p></li>
<li><p><strong>count</strong> Maximum number of traces to return</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>SearchResult containing found traces</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="hansken_extraction_plugin.api.search_result.html" class="btn btn-neutral float-left" title="hansken_extraction_plugin.api.search_result" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="hansken_extraction_plugin.api.tracelet.html" class="btn btn-neutral float-right" title="hansken_extraction_plugin.api.tracelet" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
@@ -0,0 +1,169 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>hansken_extraction_plugin.api.tracelet &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/underscore.js"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="hansken_extraction_plugin.api.transformation" href="hansken_extraction_plugin.api.transformation.html" />
<link rel="prev" title="hansken_extraction_plugin.api.trace_searcher" href="hansken_extraction_plugin.api.trace_searcher.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2"><a class="reference internal" href="../prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="../getting_started.html">Getting started</a></li>
<li class="toctree-l2"><a class="reference internal" href="../packaging.html">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="../snippets.html">Python code snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="../hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="../debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../python.html#api-documentation">API Documentation</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.data_context.html">hansken_extraction_plugin.api.data_context</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_plugin.html">hansken_extraction_plugin.api.extraction_plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_trace.html">hansken_extraction_plugin.api.extraction_trace</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.plugin_info.html">hansken_extraction_plugin.api.plugin_info</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.search_result.html">hansken_extraction_plugin.api.search_result</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.trace_searcher.html">hansken_extraction_plugin.api.trace_searcher</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">hansken_extraction_plugin.api.tracelet</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.transformation.html">hansken_extraction_plugin.api.transformation</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../../python.html">Python</a> &raquo;</li>
<li><a href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a> &raquo;</li>
<li>hansken_extraction_plugin.api.tracelet</li>
<li class="wy-breadcrumbs-aside">
<a href="../../../_sources/dev/python/api/hansken_extraction_plugin.api.tracelet.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="module-hansken_extraction_plugin.api.tracelet">
<span id="hansken-extraction-plugin-api-tracelet"></span><h1>hansken_extraction_plugin.api.tracelet<a class="headerlink" href="#module-hansken_extraction_plugin.api.tracelet" title="Permalink to this heading"></a></h1>
<p>This module contains the definition of a Tracelet.</p>
<p class="rubric">Classes</p>
<table class="autosummary longtable docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.tracelet.Tracelet" title="hansken_extraction_plugin.api.tracelet.Tracelet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Tracelet</span></code></a>(name, value)</p></td>
<td><p>A tracelet contains the values of a single fvt (Few Valued Type).</p></td>
</tr>
</tbody>
</table>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.tracelet.Tracelet">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">Tracelet</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Mapping</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Any</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/tracelet.html#Tracelet"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.tracelet.Tracelet" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>A tracelet contains the values of a single fvt (Few Valued Type).</p>
<p>A few valued type is a trace property type that is a collection of tracelets. A trace can contain multiple few
valued types containing one or more tracelets. For example, the <cite>trace.identity`</cite> type may look like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span><span class="n">emailAddress</span><span class="p">:</span> <span class="s1">&#39;interesting@notreally.com&#39;</span><span class="p">},</span>
<span class="p">{</span><span class="n">firstName</span><span class="p">:</span> <span class="s1">&#39;piet&#39;</span><span class="p">},</span>
<span class="p">{</span><span class="n">emailAddress</span><span class="p">:</span> <span class="s1">&#39;anotheremail@notreally.com&#39;</span><span class="p">},</span>
</pre></div>
</div>
<p>The trace.identity few valued types contains three different tracelets.</p>
</dd></dl>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="hansken_extraction_plugin.api.trace_searcher.html" class="btn btn-neutral float-left" title="hansken_extraction_plugin.api.trace_searcher" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="hansken_extraction_plugin.api.transformation.html" class="btn btn-neutral float-right" title="hansken_extraction_plugin.api.transformation" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
@@ -0,0 +1,226 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>hansken_extraction_plugin.api.transformation &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/underscore.js"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="Examples" href="../../examples.html" />
<link rel="prev" title="hansken_extraction_plugin.api.tracelet" href="hansken_extraction_plugin.api.tracelet.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2"><a class="reference internal" href="../prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="../getting_started.html">Getting started</a></li>
<li class="toctree-l2"><a class="reference internal" href="../packaging.html">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="../snippets.html">Python code snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="../hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="../debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../python.html#api-documentation">API Documentation</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.data_context.html">hansken_extraction_plugin.api.data_context</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_plugin.html">hansken_extraction_plugin.api.extraction_plugin</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.extraction_trace.html">hansken_extraction_plugin.api.extraction_trace</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.plugin_info.html">hansken_extraction_plugin.api.plugin_info</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.search_result.html">hansken_extraction_plugin.api.search_result</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.trace_searcher.html">hansken_extraction_plugin.api.trace_searcher</a></li>
<li class="toctree-l4"><a class="reference internal" href="hansken_extraction_plugin.api.tracelet.html">hansken_extraction_plugin.api.tracelet</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">hansken_extraction_plugin.api.transformation</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../../python.html">Python</a> &raquo;</li>
<li><a href="hansken_extraction_plugin.api.html">hansken_extraction_plugin.api</a> &raquo;</li>
<li>hansken_extraction_plugin.api.transformation</li>
<li class="wy-breadcrumbs-aside">
<a href="../../../_sources/dev/python/api/hansken_extraction_plugin.api.transformation.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="module-hansken_extraction_plugin.api.transformation">
<span id="hansken-extraction-plugin-api-transformation"></span><h1>hansken_extraction_plugin.api.transformation<a class="headerlink" href="#module-hansken_extraction_plugin.api.transformation" title="Permalink to this heading"></a></h1>
<p>This module contains the definition of a Transformation.</p>
<p class="rubric">Classes</p>
<table class="autosummary longtable docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.transformation.Range" title="hansken_extraction_plugin.api.transformation.Range"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Range</span></code></a>(offset, length)</p></td>
<td><p>A Range describes a range of bytes with a offset and length.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.transformation.RangedTransformation" title="hansken_extraction_plugin.api.transformation.RangedTransformation"><code class="xref py py-obj docutils literal notranslate"><span class="pre">RangedTransformation</span></code></a>(ranges)</p></td>
<td><p>A :class:RangedTransformation describes a data transformation consisting of a list of :class:Range.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#hansken_extraction_plugin.api.transformation.Transformation" title="hansken_extraction_plugin.api.transformation.Transformation"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Transformation</span></code></a>()</p></td>
<td><p>A super class for data transformations.</p></td>
</tr>
</tbody>
</table>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.transformation.Transformation">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">Transformation</span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/transformation.html#Transformation"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.transformation.Transformation" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">ABC</span></code></p>
<p>A super class for data transformations. Currently only :class:RangedTransformation is supported.</p>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.transformation.Range">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">Range</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">offset</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">length</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/transformation.html#Range"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.transformation.Range" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>A Range describes a range of bytes with a offset and length.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.transformation.Range.offset">
<span class="sig-name descname"><span class="pre">offset</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">int</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.transformation.Range.offset" title="Permalink to this definition"></a></dt>
<dd><p>the starting point of the data</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.transformation.Range.length">
<span class="sig-name descname"><span class="pre">length</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">int</span></em><a class="headerlink" href="#hansken_extraction_plugin.api.transformation.Range.length" title="Permalink to this definition"></a></dt>
<dd><p>the size of the data</p>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.transformation.RangedTransformation">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">RangedTransformation</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ranges</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#hansken_extraction_plugin.api.transformation.Range" title="hansken_extraction_plugin.api.transformation.Range"><span class="pre">Range</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/transformation.html#RangedTransformation"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.transformation.RangedTransformation" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#hansken_extraction_plugin.api.transformation.Transformation" title="hansken_extraction_plugin.api.transformation.Transformation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Transformation</span></code></a></p>
<p>A :class:RangedTransformation describes a data transformation consisting of a list of :class:Range.</p>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.transformation.RangedTransformation.builder">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">builder</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/transformation.html#RangedTransformation.builder"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.transformation.RangedTransformation.builder" title="Permalink to this definition"></a></dt>
<dd><p>:return a Builder.</p>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.transformation.RangedTransformation.Builder">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">Builder</span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/transformation.html#RangedTransformation.Builder"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.transformation.RangedTransformation.Builder" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Helper class that implements a transformation builder.</p>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.transformation.RangedTransformation.Builder.add_range">
<span class="sig-name descname"><span class="pre">add_range</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">offset</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">length</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#hansken_extraction_plugin.api.transformation.RangedTransformation.Builder" title="hansken_extraction_plugin.api.transformation.RangedTransformation.Builder"><span class="pre">Builder</span></a></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/transformation.html#RangedTransformation.Builder.add_range"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.transformation.RangedTransformation.Builder.add_range" title="Permalink to this definition"></a></dt>
<dd><p>Add a range to a ranged transformation by providing the ranges offset and length.</p>
<p>:param offset the offset of the data transformation
:param length the length of the data transformation
:return: this <cite>.RangedTransformation.Builder</cite></p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="hansken_extraction_plugin.api.transformation.RangedTransformation.Builder.build">
<span class="sig-name descname"><span class="pre">build</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#hansken_extraction_plugin.api.transformation.RangedTransformation" title="hansken_extraction_plugin.api.transformation.RangedTransformation"><span class="pre">RangedTransformation</span></a></span></span><a class="reference internal" href="../../../_modules/hansken_extraction_plugin/api/transformation.html#RangedTransformation.Builder.build"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#hansken_extraction_plugin.api.transformation.RangedTransformation.Builder.build" title="Permalink to this definition"></a></dt>
<dd><p>Return a RangedTransformation.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>a :class:RangedTransformation</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
</dd></dl>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="hansken_extraction_plugin.api.tracelet.html" class="btn btn-neutral float-left" title="hansken_extraction_plugin.api.tracelet" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../../examples.html" class="btn btn-neutral float-right" title="Examples" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
+453
View File
@@ -0,0 +1,453 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Python API Changelog &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Prerequisites" href="prerequisites.html" />
<link rel="prev" title="Python" href="../python.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../python.html">Python</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="#">Python API Changelog</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#version">0.6.1
</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id1">0.6.0</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#build-pipeline-change">Build pipeline change</a></li>
<li class="toctree-l4"><a class="reference internal" href="#api-changes">API changes</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#id2">0.5.1</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id3">0.5.0</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id4">0.4.13</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id5">0.4.7</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id6">0.4.6</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id7">0.4.0</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id8">0.3.0</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id9">0.2.0</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="getting_started.html">Getting started</a></li>
<li class="toctree-l2"><a class="reference internal" href="packaging.html">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="snippets.html">Python code snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2"><a class="reference internal" href="../python.html#api-documentation">API Documentation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../python.html">Python</a> &raquo;</li>
<li>Python API Changelog</li>
<li class="wy-breadcrumbs-aside">
<a href="../../_sources/dev/python/api_changelog.md.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="python-api-changelog">
<h1>Python API Changelog<a class="headerlink" href="#python-api-changelog" title="Permalink to this heading"></a></h1>
<p>This document summarizes all important API changes in the Extraction Plugin API. This document only shows changes that
are important to plugin developers. For a full list of changes per version, please refer to the general
<a class="reference internal" href="../../changes.html#changelog"><span class="std std-ref">changelog</span></a>.</p>
<section id="version">
<h2>0.6.1
<a class="headerlink" href="#version" title="Permalink to this heading"></a></h2>
<p>The docker image build script <code class="docutils literal notranslate"><span class="pre">build_plugin.py</span></code> has been updated to allow for extension of the docker command.
This can be especially handy for specifying a proxy. You should build your plugin container image with the following
command:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>build_plugin PLUGIN_FILE DOCKER_FILE_DIRECTORY <span class="o">[</span>DOCKER_IMAGE_NAME<span class="o">]</span> <span class="o">[</span>DOCKER_ARGS<span class="o">]</span>
</pre></div>
</div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Note that the <cite>DOCKER_IMAGE_NAME</cite> argument no longer requires a <cite>-n</cite> parameter to be specified.</p>
</div>
<p>For usage read further in <a class="reference internal" href="packaging.html"><span class="doc">packaging</span></a>.</p>
</section>
<section id="id1">
<h2>0.6.0<a class="headerlink" href="#id1" title="Permalink to this heading"></a></h2>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>This is an API breaking change.
Upgrading your plugin to this version will require code changes.
Plugins built with previous versions of the SDK from <cite>0.3.0</cite> will still work with Hansken.</p>
</div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>It is strongly recommended to upgrade your plugins to this new version because it significantly improves
the start-up time of Hansken. See the migration steps below.</p>
</div>
<p>This release contains both build pipeline changes and API changes.
Please read all changes carefully.</p>
<section id="build-pipeline-change">
<h3>Build pipeline change<a class="headerlink" href="#build-pipeline-change" title="Permalink to this heading"></a></h3>
<ul>
<li><p>Extraction plugin container images are now labeled with PluginInfo. This
allows Hansken to efficiently load extraction plugins.
Migration steps from earlier versions:</p>
<ol class="arabic">
<li><p>Update the SDK version in your <code class="docutils literal notranslate"><span class="pre">setup.py</span></code> / <code class="docutils literal notranslate"><span class="pre">requirements.txt</span></code></p></li>
<li><p>If you come from a version prior to <code class="docutils literal notranslate"><span class="pre">0.4.0</span></code>, or if you use a plugin name
instead of a plugin id in your <code class="docutils literal notranslate"><span class="pre">pluginInfo()</span></code>, switch to the plugin id style
(read instructions for version <code class="docutils literal notranslate"><span class="pre">0.4.0</span></code>)</p></li>
<li><p>Update your build scripts to build your plugin (Docker) container image.
Be sure to <a class="reference internal" href="getting_started.html"><span class="doc">have the Extraction Plugins SDK installed</span></a>.
Then, you should build your plugin container image with the following command:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>build_plugin PLUGIN_FILE DOCKER_FILE_DIRECTORY -n <span class="o">[</span>DOCKER_IMAGE_NAME<span class="o">]</span>
</pre></div>
</div>
<p>For example:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>build_plugin plugin/chatplugin.py . -n extraction-plugins/chatplugin
</pre></div>
</div>
<p>This will generate a plugin image:</p>
<ul class="simple">
<li><p>The extraction plugin is added to your local image registry (<code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">images</span></code>),</p></li>
<li><p>Note that DOCKER_IMAGE_NAME is optional and will default to <code class="docutils literal notranslate"><span class="pre">extraction-plugin/PLUGINID</span></code>, e.g.
<code class="docutils literal notranslate"><span class="pre">extraction-plugin/nfi.nl/extract/chat/whatsapp</span></code>,</p></li>
<li><p>The image is tagged with two tags: <code class="docutils literal notranslate"><span class="pre">latest</span></code>, and your plugin version.</p></li>
</ul>
</li>
</ol>
</li>
</ul>
</section>
<section id="api-changes">
<h3>API changes<a class="headerlink" href="#api-changes" title="Permalink to this heading"></a></h3>
<ul>
<li><p>The field <code class="docutils literal notranslate"><span class="pre">plugin</span></code> has been removed from <code class="docutils literal notranslate"><span class="pre">PluginInfo</span></code>.</p></li>
<li><p>The field <code class="docutils literal notranslate"><span class="pre">pluginId</span></code> should now be the first argument of PluginInfo (when using unnamed arguments).</p>
<p>Old (unnamed arguments):</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">plugin_info</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="n">PluginInfo</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s1">&#39;1.0.0&#39;</span><span class="p">,</span> <span class="s1">&#39;description&#39;</span><span class="p">,</span> <span class="n">author</span><span class="p">,</span>
<span class="n">MaturityLevel</span><span class="o">.</span><span class="n">PROOF_OF_CONCEPT</span><span class="p">,</span> <span class="s1">&#39;*, &#39;</span><span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">hansken</span><span class="o">.</span><span class="n">org</span><span class="s1">&#39;,</span>
<span class="n">PluginId</span><span class="p">(</span><span class="o">...</span><span class="p">),</span> <span class="s1">&#39;Apache License 2.0&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>New (removed <code class="docutils literal notranslate"><span class="pre">self</span></code>, and moved <code class="docutils literal notranslate"><span class="pre">PluginId(...)</span></code> to first argument position):</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">plugin_info</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="n">PluginInfo</span><span class="p">(</span><span class="n">PluginId</span><span class="p">(</span><span class="o">...</span><span class="p">),</span> <span class="s1">&#39;1.0.0&#39;</span><span class="p">,</span> <span class="s1">&#39;description&#39;</span><span class="p">,</span>
<span class="n">author</span><span class="p">,</span> <span class="n">MaturityLevel</span><span class="o">.</span><span class="n">PROOF_OF_CONCEPT</span><span class="p">,</span>
<span class="s1">&#39;*&#39;</span><span class="p">,</span> <span class="s1">&#39;https://hansken.org&#39;</span><span class="p">,</span> <span class="s1">&#39;Apache License 2.0&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>Old (named arguments):</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">plugin_info</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="n">PluginInfo</span><span class="p">(</span><span class="n">plugin</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span>
<span class="n">version</span><span class="o">=</span><span class="s1">&#39;1.0.0&#39;</span><span class="p">,</span>
<span class="o">...</span><span class="p">)</span>
</pre></div>
</div>
<p>New (removed <code class="docutils literal notranslate"><span class="pre">plugin=self</span></code>):</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">plugin_info</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="n">PluginInfo</span><span class="p">(</span><span class="n">version</span><span class="o">=</span><span class="s1">&#39;1.0.0&#39;</span><span class="p">,</span>
<span class="o">...</span><span class="p">)</span>
</pre></div>
</div>
</li>
<li><p>Plugin <code class="docutils literal notranslate"><span class="pre">data_context.data_size</span></code> is now a variable instead of a method:</p>
<p>Old:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">trace</span><span class="p">:</span> <span class="n">ExtractionTrace</span><span class="p">,</span> <span class="n">data_context</span><span class="p">:</span> <span class="n">DataContext</span><span class="p">):</span>
<span class="n">size</span> <span class="o">=</span> <span class="n">data_context</span><span class="o">.</span><span class="n">data_size</span><span class="p">()</span>
</pre></div>
</div>
<p>New:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">trace</span><span class="p">:</span> <span class="n">ExtractionTrace</span><span class="p">,</span> <span class="n">data_context</span><span class="p">:</span> <span class="n">DataContext</span><span class="p">):</span>
<span class="n">size</span> <span class="o">=</span> <span class="n">data_context</span><span class="o">.</span><span class="n">data_size</span>
</pre></div>
</div>
</li>
<li><p>Simplify declaring required runtime resources in a plugins info.</p>
<p>Extraction plugin resources dont use the builder pattern anymore.</p>
<p>Old:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">return</span> <span class="n">PluginInfo</span><span class="p">(</span>
<span class="o">...</span><span class="p">,</span>
<span class="n">resources</span><span class="o">=</span><span class="n">PluginResources</span><span class="o">.</span><span class="n">builder</span><span class="p">()</span><span class="o">.</span><span class="n">maximum_cpu</span><span class="p">(</span><span class="mf">0.5</span><span class="p">)</span><span class="o">.</span><span class="n">maximum_memory</span><span class="p">(</span><span class="mi">1000</span><span class="p">)</span><span class="o">.</span><span class="n">build</span><span class="p">())</span>
<span class="p">)</span>
</pre></div>
</div>
<p>New:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># no need for a builder, declare resources by direct instantiation</span>
<span class="k">return</span> <span class="n">PluginInfo</span><span class="p">(</span>
<span class="o">...</span><span class="p">,</span>
<span class="n">resources</span><span class="o">=</span><span class="n">PluginResources</span><span class="p">(</span><span class="n">maximum_cpu</span><span class="o">=</span><span class="mf">2.0</span><span class="p">,</span> <span class="n">maximum_memory</span><span class="o">=</span><span class="mi">2048</span><span class="p">)</span>
<span class="p">)</span>
<span class="c1"># or, as before, specify just on resource</span>
<span class="k">return</span> <span class="n">PluginInfo</span><span class="p">(</span>
<span class="o">...</span><span class="p">,</span>
<span class="n">resources</span><span class="o">=</span><span class="n">PluginResources</span><span class="p">(</span><span class="n">maximum_memory</span><span class="o">=</span><span class="mi">4096</span><span class="p">)</span>
<span class="p">)</span>
</pre></div>
</div>
</li>
</ul>
</section>
</section>
<section id="id2">
<h2>0.5.1<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h2>
<ul>
<li><p>Simplify tracelet properties by making the tracelet type prefix optional.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># using a Tracelet object</span>
<span class="n">trace</span><span class="o">.</span><span class="n">add_tracelet</span><span class="p">(</span><span class="n">Tracelet</span><span class="p">(</span><span class="s2">&quot;prediction&quot;</span><span class="p">,</span> <span class="p">{</span>
<span class="s2">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;example&quot;</span><span class="p">,</span>
<span class="s2">&quot;confidence&quot;</span><span class="p">:</span> <span class="mf">0.8</span>
<span class="p">}))</span>
<span class="c1"># or without a Tracelet object</span>
<span class="n">trace</span><span class="o">.</span><span class="n">add_tracelet</span><span class="p">(</span><span class="s2">&quot;identity&quot;</span><span class="p">,</span> <span class="p">{</span><span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;John Doe&quot;</span><span class="p">,</span> <span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;online&quot;</span><span class="p">})</span>
</pre></div>
</div>
</li>
<li><p>Enabled <em>manual</em> plugin testing, as described on <a class="reference internal" href="testing.html#python-testing"><span class="std std-ref">advanced use of the test framework in Python</span></a>.</p></li>
</ul>
</section>
<section id="id3">
<h2>0.5.0<a class="headerlink" href="#id3" title="Permalink to this heading"></a></h2>
<ul>
<li><p>Support vector data type in trace properties.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">embedding</span> <span class="o">=</span> <span class="n">Vector</span><span class="o">.</span><span class="n">from_sequence</span><span class="p">((</span><span class="n">width</span><span class="p">,</span> <span class="n">height</span><span class="p">))</span>
<span class="n">tracelet</span> <span class="o">=</span> <span class="n">Tracelet</span><span class="p">(</span><span class="s2">&quot;prediction&quot;</span><span class="p">,</span> <span class="p">{</span>
<span class="s2">&quot;prediction.type&quot;</span><span class="p">:</span> <span class="s2">&quot;example-vector&quot;</span><span class="p">,</span>
<span class="s2">&quot;prediction.embedding&quot;</span><span class="p">:</span> <span class="n">embedding</span>
<span class="p">})</span>
<span class="n">trace</span><span class="o">.</span><span class="n">add_tracelet</span><span class="p">(</span><span class="n">tracelet</span><span class="p">)</span>
</pre></div>
</div>
</li>
</ul>
</section>
<section id="id4">
<h2>0.4.13<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h2>
<ul class="simple">
<li><p>When writing input search traces for tests, it is no longer required to explicitly set an <code class="docutils literal notranslate"><span class="pre">id</span></code> property.
These are automatically generated when executing tests.</p></li>
</ul>
</section>
<section id="id5">
<h2>0.4.7<a class="headerlink" href="#id5" title="Permalink to this heading"></a></h2>
<ul class="simple">
<li><p>More <code class="docutils literal notranslate"><span class="pre">$data</span></code> matchers are supported in Hansken.py plugin runner. Before this improvement it was only possible to match
on <code class="docutils literal notranslate"><span class="pre">$data.type</span></code>. Now it is also possible to match for example on <code class="docutils literal notranslate"><span class="pre">$data.mimeType</span></code> and <code class="docutils literal notranslate"><span class="pre">$data.mimeClass</span></code>. The <code class="docutils literal notranslate"><span class="pre">$data</span></code>
matcher should still be at the end of the query as before.</p></li>
</ul>
</section>
<section id="id6">
<h2>0.4.6<a class="headerlink" href="#id6" title="Permalink to this heading"></a></h2>
<ul>
<li><p>It is now possible to specify maximum system resources in the <code class="docutils literal notranslate"><span class="pre">PluginInfo</span></code>. To run a plugin with 0.5 cpu (= 0.5
vCPU/Core/hyperthread) and 1 gb memory, for example, the following configuration can be added to <code class="docutils literal notranslate"><span class="pre">PluginInfo</span></code>:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">plugin_info</span> <span class="o">=</span> <span class="n">PluginInfo</span><span class="p">(</span><span class="o">...</span><span class="p">,</span>
<span class="n">resources</span><span class="o">=</span><span class="n">PluginResources</span><span class="o">.</span><span class="n">builder</span><span class="p">()</span><span class="o">.</span><span class="n">maximum_cpu</span><span class="p">(</span><span class="mf">0.5</span><span class="p">)</span><span class="o">.</span><span class="n">maximum_memory</span><span class="p">(</span><span class="mi">1000</span><span class="p">)</span><span class="o">.</span><span class="n">build</span><span class="p">())</span>
</pre></div>
</div>
</li>
</ul>
</section>
<section id="id7">
<h2>0.4.0<a class="headerlink" href="#id7" title="Permalink to this heading"></a></h2>
<ul>
<li><p>Extraction Plugins are now identified with a <code class="docutils literal notranslate"><span class="pre">PluginInfo.PluginId</span></code> containing a domain, category and name. The
method <code class="docutils literal notranslate"><span class="pre">PluginInfo.name(pluginName)</span></code> has been replaced by <code class="docutils literal notranslate"><span class="pre">PluginInfo.id(new</span> <span class="pre">PluginId(domain,</span> <span class="pre">category,</span> <span class="pre">name)</span></code>. More
details on the plugin naming conventions can be found at the <a class="reference internal" href="../concepts/plugin_naming_convention.html"><span class="doc">Plugin naming convention</span></a> section.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">PluginInfo.name()</span></code> is now deprecated (but will still work for backwards compatibility).</p></li>
<li><p>A new license field <code class="docutils literal notranslate"><span class="pre">PluginInfo.license</span></code> has also been added in this release.</p></li>
<li><p>The following example creates a PluginInfo for a plugin with the name <code class="docutils literal notranslate"><span class="pre">TestPlugin</span></code>, licensed under
the <code class="docutils literal notranslate"><span class="pre">Apache</span> <span class="pre">License</span> <span class="pre">2.0</span></code> license:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">TestPlugin</span><span class="p">(</span><span class="n">ExtractionPlugin</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">plugin_info</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">PluginInfo</span><span class="p">:</span>
<span class="k">return</span> <span class="n">PluginInfo</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>
<span class="n">version</span><span class="o">=</span><span class="s1">&#39;1.0.0&#39;</span><span class="p">,</span>
<span class="n">description</span><span class="o">=</span><span class="s1">&#39;A plugin for testing.&#39;</span><span class="p">,</span>
<span class="n">author</span><span class="o">=</span><span class="n">Author</span><span class="p">(</span><span class="s1">&#39;The Externals&#39;</span><span class="p">,</span> <span class="s1">&#39;tester@holmes.nl&#39;</span><span class="p">,</span> <span class="s1">&#39;NFI&#39;</span><span class="p">),</span>
<span class="n">maturity</span><span class="o">=</span><span class="n">MaturityLevel</span><span class="o">.</span><span class="n">PROOF_OF_CONCEPT</span><span class="p">,</span>
<span class="n">webpage_url</span><span class="o">=</span><span class="s1">&#39;https://hansken.org&#39;</span><span class="p">,</span>
<span class="n">matcher</span><span class="o">=</span><span class="s1">&#39;file.extension=txt&#39;</span><span class="p">,</span>
<span class="nb">id</span><span class="o">=</span><span class="n">PluginId</span><span class="p">(</span><span class="n">domain</span><span class="o">=</span><span class="s1">&#39;nfi.nl&#39;</span><span class="p">,</span> <span class="n">category</span><span class="o">=</span><span class="s1">&#39;test&#39;</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;TestPlugin&#39;</span><span class="p">),</span>
<span class="n">license</span><span class="o">=</span><span class="s1">&#39;Apache License 2.0&#39;</span>
<span class="p">)</span>
</pre></div>
</div>
</li>
</ul>
</section>
<section id="id8">
<h2>0.3.0<a class="headerlink" href="#id8" title="Permalink to this heading"></a></h2>
<ul>
<li><p>Extraction Plugins can now create new datastreams on a Trace through data transformations. Data transformations
describe how data can be obtained from a source.</p>
<p>An example case is an extraction plugin that processes an archive file. The plugin creates a child trace per entry in
the archive file. Each child trace will have a datastream that is a transformation that marks the start and length of
the entry in the original archive data. By just describing the data instead of specifying the actual data, a lot of
space is saved.</p>
<p>Although Hansken supports various transformations, the Extraction Plugins SDK for now only supports ranged data
transformations. Ranged data transformations define data as a list of ranges, each range with an offset and length in
a bytearray.</p>
<p>The following example sets a new datastream with dataType <code class="docutils literal notranslate"><span class="pre">html</span></code> on a trace, by setting a ranged data transformation:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">trace</span><span class="o">.</span><span class="n">add_transformation</span><span class="p">(</span><span class="s1">&#39;html&#39;</span><span class="p">,</span> <span class="n">RangedTransformation</span><span class="p">(</span><span class="n">Range</span><span class="p">(</span><span class="n">offset</span><span class="p">,</span> <span class="n">length</span><span class="p">)))</span>
</pre></div>
</div>
<p>The following example creates a child trace and sets a new datastream with dataType <code class="docutils literal notranslate"><span class="pre">raw</span></code> on it, by setting a ranged
data transformation with two ranges:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">child</span> <span class="o">=</span> <span class="n">trace</span><span class="o">.</span><span class="n">child_builder</span><span class="p">(</span><span class="s1">&#39;new trace&#39;</span><span class="p">)</span>
<span class="n">child</span><span class="o">.</span><span class="n">add_transformation</span><span class="p">(</span><span class="s1">&#39;raw&#39;</span><span class="p">,</span> <span class="n">RangedTransformation</span><span class="o">.</span><span class="n">builder</span><span class="p">()</span>
<span class="o">.</span><span class="n">add_range</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
<span class="o">.</span><span class="n">add_range</span><span class="p">(</span><span class="mi">50</span><span class="p">,</span> <span class="mi">30</span><span class="p">)</span>
<span class="o">.</span><span class="n">build</span><span class="p">())</span>
<span class="p">});</span>
</pre></div>
</div>
<p>More detailed documentation will follow in an upcoming SDK release.</p>
</li>
</ul>
</section>
<section id="id9">
<h2>0.2.0<a class="headerlink" href="#id9" title="Permalink to this heading"></a></h2>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>This is an API breaking change.
Plugins created with an earlier version of the extraction plugin
SDK are not compatible with Hansken that uses <cite>0.2.0</cite> or later.</p>
</div>
<ul>
<li><p>Introduced a new extraction plugin type <code class="docutils literal notranslate"><span class="pre">api.extraction_plugin.DeferredExtractioPlugin</span></code>.
Deferred Extraction plugins can be run at a different extraction stage.
This type of plugin also allows accessing other traces using the searcher.</p></li>
<li><p>The class <code class="docutils literal notranslate"><span class="pre">api.extraction_context.ExtractionContext</span></code> has been renamed to <code class="docutils literal notranslate"><span class="pre">api.data_context.DataContext</span></code>.
The new name <code class="docutils literal notranslate"><span class="pre">DataContext</span></code> represents the class contents better.
Plugins have to update matching import statements accordingly.
Plugins should also update the named argument <code class="docutils literal notranslate"><span class="pre">context</span></code> to <code class="docutils literal notranslate"><span class="pre">data_context</span></code> of the plugin <code class="docutils literal notranslate"><span class="pre">process()</span></code> method.
This change has no functional changes.</p>
<p>Old:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">hansken_extraction_plugin.api.extraction_context</span> <span class="kn">import</span> <span class="n">ExtractionContext</span>
<span class="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">trace</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span>
<span class="k">pass</span>
</pre></div>
</div>
<p>New:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">hansken_extraction_plugin.api.data_context</span> <span class="kn">import</span> <span class="n">DataContext</span>
<span class="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">trace</span><span class="p">,</span> <span class="n">data_context</span><span class="p">):</span>
<span class="k">pass</span>
</pre></div>
</div>
</li>
<li><p>Moved <code class="docutils literal notranslate"><span class="pre">api.author.Author</span></code> to <code class="docutils literal notranslate"><span class="pre">api.plugin_info.Author</span></code>, and moved <code class="docutils literal notranslate"><span class="pre">api.maturity_level.MaturityLevel</span></code>
to <code class="docutils literal notranslate"><span class="pre">api.plugin_info.MaturityLevel</span></code>
This is a more <em>pythonic</em> way of grouping of classes into modules. This change has no functional side effects.</p>
<p>Plugins have to update matching import statements accordingly.</p>
<p>Old:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">hansken_extraction_plugin.api.author</span> <span class="kn">import</span> <span class="n">Author</span>
<span class="kn">from</span> <span class="nn">hansken_extraction_plugin.api.maturity_level</span> <span class="kn">import</span> <span class="n">MaturityLevel</span>
<span class="kn">from</span> <span class="nn">hansken_extraction_plugin.api.plugin_info</span> <span class="kn">import</span> <span class="n">PluginInfo</span>
</pre></div>
</div>
<p>New:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">hansken_extraction_plugin.api.plugin_info</span> <span class="kn">import</span> <span class="n">Author</span><span class="p">,</span> <span class="n">MaturityLevel</span><span class="p">,</span> <span class="n">PluginInfo</span>
</pre></div>
</div>
</li>
<li><p>Removed <code class="docutils literal notranslate"><span class="pre">DataContext.get_first_bytes()</span></code> from the public API.</p></li>
<li><p>Removed <code class="docutils literal notranslate"><span class="pre">api.extraction_trace.validate_update_arguments(..)</span></code> from the public API. This method is still invoked
implicitly when setting trace properties.</p></li>
</ul>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="../python.html" class="btn btn-neutral float-left" title="Python" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="prerequisites.html" class="btn btn-neutral float-right" title="Prerequisites" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
+302
View File
@@ -0,0 +1,302 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>How to debug an Extraction Plugin &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="hansken_extraction_plugin.api" href="api/hansken_extraction_plugin.api.html" />
<link rel="prev" title="Run plugins with Hansken.py" href="hanskenpy.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2"><a class="reference internal" href="prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="getting_started.html">Getting started</a></li>
<li class="toctree-l2"><a class="reference internal" href="packaging.html">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="snippets.html">Python code snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">How to debug an Extraction Plugin</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#locally">Locally</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#logging">Logging</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#locally-with-docker">Locally with Docker</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#install-debugpy">Install <code class="docutils literal notranslate"><span class="pre">debugpy</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#configuring-debugpy-in-python">Configuring <code class="docutils literal notranslate"><span class="pre">debugpy</span></code> in Python</a></li>
<li class="toctree-l4"><a class="reference internal" href="#build-a-docker-image">Build a Docker image</a></li>
<li class="toctree-l4"><a class="reference internal" href="#configuring-the-connection-to-the-docker-container">Configuring the connection to the Docker container</a></li>
<li class="toctree-l4"><a class="reference internal" href="#setting-breakpoints-in-the-code">Setting breakpoints in the code</a></li>
<li class="toctree-l4"><a class="reference internal" href="#logging-in-docker">Logging in Docker</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#kubernetes">Kubernetes</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#logging-in-kubernetes">Logging in Kubernetes</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#debug-hql">Debug HQL</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../python.html#api-documentation">API Documentation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../python.html">Python</a> &raquo;</li>
<li>How to debug an Extraction Plugin</li>
<li class="wy-breadcrumbs-aside">
<a href="../../_sources/dev/python/debugging.md.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="how-to-debug-an-extraction-plugin">
<h1>How to debug an Extraction Plugin<a class="headerlink" href="#how-to-debug-an-extraction-plugin" title="Permalink to this heading"></a></h1>
<p>Debugging is the art of removing bugs — hopefully quickly.</p>
<section id="locally">
<h2>Locally<a class="headerlink" href="#locally" title="Permalink to this heading"></a></h2>
<p>To debug a plugin locally, it is recommended to start the plugin via the IDE. This has the advantage that breakpoints
can easily be put in the code instead of printing log statements, for example. To start a plugin locally, a piece of
code must be added, see <a class="reference internal" href="testing.html"><span class="doc">Testing</span></a> for more information.</p>
<section id="logging">
<h3>Logging<a class="headerlink" href="#logging" title="Permalink to this heading"></a></h3>
<p>The logging of the extraction plugin is displayed in the console.</p>
</section>
</section>
<section id="locally-with-docker">
<h2>Locally with Docker<a class="headerlink" href="#locally-with-docker" title="Permalink to this heading"></a></h2>
<p>Debugging an extraction plugin via docker is a bit trickier. In order to debug in Python, a debugger must be added to
the extraction plugin. There are several debug modules for Python available, but one debug module that works well with
Visual Studio Code is <a class="reference external" href="https://github.com/microsoft/debugpy">debugpy</a>. This package is developed by Microsoft
specifically for use in Visual Studio Code with Python.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p><cite>debugpy</cite> implements the Debug Adapter Protocol (DAP), which is a standardised way for development tools to
communicate with debuggers.</p>
</div>
<p>Using <code class="docutils literal notranslate"><span class="pre">debugpy</span></code> with Docker containers requires 4 distinct steps:</p>
<ol class="arabic simple">
<li><p>Install <code class="docutils literal notranslate"><span class="pre">debugpy</span></code></p></li>
<li><p>Configuring <code class="docutils literal notranslate"><span class="pre">debugpy</span></code> in Python</p></li>
<li><p>Build a docker image</p></li>
<li><p>Configuring the connection to the Docker container</p></li>
<li><p>Setting breakpoints in your code</p></li>
</ol>
<section id="install-debugpy">
<h3>Install <code class="docutils literal notranslate"><span class="pre">debugpy</span></code><a class="headerlink" href="#install-debugpy" title="Permalink to this heading"></a></h3>
<p>First, add <code class="docutils literal notranslate"><span class="pre">debugpy</span></code> to your <code class="docutils literal notranslate"><span class="pre">setup.py</span></code>.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">setuptools</span> <span class="kn">import</span> <span class="n">setup</span>
<span class="n">setup</span><span class="p">(</span>
<span class="c1"># ...</span>
<span class="n">install_requires</span><span class="o">=</span><span class="p">[</span>
<span class="s2">&quot;hansken-extraction-plugin==0.4.7&quot;</span><span class="p">,</span> <span class="c1"># the plugin SDK</span>
<span class="s2">&quot;debugpy==1.5.1&quot;</span>
<span class="p">]</span>
<span class="p">)</span>
</pre></div>
</div>
</section>
<section id="configuring-debugpy-in-python">
<h3>Configuring <code class="docutils literal notranslate"><span class="pre">debugpy</span></code> in Python<a class="headerlink" href="#configuring-debugpy-in-python" title="Permalink to this heading"></a></h3>
<p>At the beginning of your script, import <code class="docutils literal notranslate"><span class="pre">debugpy</span></code>, and call <code class="docutils literal notranslate"><span class="pre">debugpy.listen()</span></code> to start the debug adapter, passing
a <code class="docutils literal notranslate"><span class="pre">(host,</span> <span class="pre">port)</span></code> tuple as the first argument. Use the <code class="docutils literal notranslate"><span class="pre">debugpy.wait_for_client()</span></code> function to block program execution
until the client is attached.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">debugpy</span>
<span class="n">debugpy</span><span class="o">.</span><span class="n">listen</span><span class="p">((</span><span class="s2">&quot;0.0.0.0&quot;</span><span class="p">,</span> <span class="mi">5678</span><span class="p">))</span>
<span class="n">debugpy</span><span class="o">.</span><span class="n">wait_for_client</span><span class="p">()</span> <span class="c1"># blocks execution until client is attached</span>
<span class="c1"># your extraction plugin code</span>
</pre></div>
</div>
</section>
<section id="build-a-docker-image">
<h3>Build a Docker image<a class="headerlink" href="#build-a-docker-image" title="Permalink to this heading"></a></h3>
<p>If the Docker image is not built, first build the image as described
<a class="reference internal" href="getting_started.html"><span class="doc">here</span></a>.</p>
</section>
<section id="configuring-the-connection-to-the-docker-container">
<h3>Configuring the connection to the Docker container<a class="headerlink" href="#configuring-the-connection-to-the-docker-container" title="Permalink to this heading"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">debugpy</span></code> is now set up to accept connections inside a Docker container. To connect to <code class="docutils literal notranslate"><span class="pre">debugpy</span></code> in the docker
container, port 5678 must be published. To make a port available to services outside of Docker, use the publish or -p
flag. This creates a firewall rule which maps a container port to a port on the Docker host to the outside world.</p>
<p>To run the extraction plugin with the published port the following command can be used:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker run -p <span class="m">5678</span>:5678 your_extraction_plugin_name
</pre></div>
</div>
<p>The next step is to configure Visual Studio Code. A <code class="docutils literal notranslate"><span class="pre">launch.json</span></code> file must be created in order for Visual Studio Code
to connect to the extraction plugin in Docker. This minimal <code class="docutils literal notranslate"><span class="pre">launch.json</span></code> example below tells the debugger to attach
to <code class="docutils literal notranslate"><span class="pre">localhost</span></code> on port <code class="docutils literal notranslate"><span class="pre">5678</span></code>.</p>
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="nt">&quot;version&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;0.2.0&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w"> </span><span class="nt">&quot;configurations&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w"></span>
<span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;Python: Remote Attach&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w"> </span><span class="nt">&quot;type&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;python&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w"> </span><span class="nt">&quot;request&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;attach&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w"> </span><span class="nt">&quot;connect&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="nt">&quot;host&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;localhost&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w"> </span><span class="nt">&quot;port&quot;</span><span class="p">:</span><span class="w"> </span><span class="mi">5678</span><span class="w"></span>
<span class="w"> </span><span class="p">},</span><span class="w"></span>
<span class="w"> </span><span class="nt">&quot;pathMappings&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w"></span>
<span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="nt">&quot;localRoot&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;${workspaceFolder}&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w"> </span><span class="nt">&quot;remoteRoot&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;.&quot;</span><span class="w"></span>
<span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w"> </span><span class="p">]</span><span class="w"></span>
<span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w"> </span><span class="p">]</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
</section>
<section id="setting-breakpoints-in-the-code">
<h3>Setting breakpoints in the code<a class="headerlink" href="#setting-breakpoints-in-the-code" title="Permalink to this heading"></a></h3>
<p>The last step is to add breakpoints in the code.</p>
</section>
<section id="logging-in-docker">
<h3>Logging in Docker<a class="headerlink" href="#logging-in-docker" title="Permalink to this heading"></a></h3>
<p>The logging of the extraction plugin is displayed in the console after running the <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">run</span></code> command. In addition,
the logging is also displayed in the Visual Studio Code console while debugging.</p>
</section>
</section>
<section id="kubernetes">
<h2>Kubernetes<a class="headerlink" href="#kubernetes" title="Permalink to this heading"></a></h2>
<p>In kubernetes it is currently <em>not</em> possible to debug via <code class="docutils literal notranslate"><span class="pre">debugpy</span></code> because no debug ports are published.</p>
<section id="logging-in-kubernetes">
<h3>Logging in Kubernetes<a class="headerlink" href="#logging-in-kubernetes" title="Permalink to this heading"></a></h3>
<p>If there is authorization to the kubernetes cluster, the logging can be viewed with the following command:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>kubectl logs -f hansken-extraction-plugins/your_extraction_plugin_pod
</pre></div>
</div>
</section>
</section>
<section id="debug-hql">
<h2>Debug HQL<a class="headerlink" href="#debug-hql" title="Permalink to this heading"></a></h2>
<p>An HQL query can be debugged by running the test framework with the <code class="docutils literal notranslate"><span class="pre">--verbose</span></code> option enabled. The found HQL matches
will then be displayed in the console. To test a plugin in python with the <code class="docutils literal notranslate"><span class="pre">--verbose</span></code> option enabled use the following
command:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>test_plugin --standalone plugin/your_plugin.py --regenerate --verbose
</pre></div>
</div>
<p>The following output will then be displayed in the console:</p>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>HQL match found for:
$data.type=jpg
With trace:
dataType=jpg
types={file, data}
properties={data.raw.mimeType=image/jpg, path=/test-input-trace, file.name=image.jpg, name=test-input-trace, id=0}
</pre></div>
</div>
<p>If the HQL query contains an error, it will be shown in the generated test results. An example of an invalid query
is <code class="docutils literal notranslate"><span class="pre">$data.mimeType=image/jpg</span></code> (slash not escaped). This query will produce an error like the one shown below.</p>
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="nt">&quot;class&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;org.hansken.plugin.extraction.hql_lite.lang.ParseException&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w"> </span><span class="nt">&quot;message&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;HqlLiteHumanQueryParser: line 1:20 token recognition error at: &#39;/jpg&#39;&quot;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The error is only shown in the generated trace, so to find out the <cite>ParseException</cite> run the <code class="docutils literal notranslate"><span class="pre">test_plugin</span></code>
command with the <code class="docutils literal notranslate"><span class="pre">--regenerate</span></code> option enabled.</p>
</div>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="hanskenpy.html" class="btn btn-neutral float-left" title="Run plugins with Hansken.py" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="api/hansken_extraction_plugin.api.html" class="btn btn-neutral float-right" title="hansken_extraction_plugin.api" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
+321
View File
@@ -0,0 +1,321 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Getting started &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Packaging" href="packaging.html" />
<link rel="prev" title="Prerequisites" href="prerequisites.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2"><a class="reference internal" href="prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Getting started</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#install-required-software-on-ubuntu">Install required software on Ubuntu</a></li>
<li class="toctree-l3"><a class="reference internal" href="#install-required-software-on-windows">Install required software on Windows.</a></li>
<li class="toctree-l3"><a class="reference internal" href="#install-docker-ubuntu-windows">Install Docker (Ubuntu, Windows)</a></li>
<li class="toctree-l3"><a class="reference internal" href="#set-up-your-ide-pycharm">Set up your IDE: PyCharm</a></li>
<li class="toctree-l3"><a class="reference internal" href="#download-an-extraction-plugin-template-empty-plugin">Download an extraction plugin template (empty plugin)</a></li>
<li class="toctree-l3"><a class="reference internal" href="#import-the-extraction-plugins-skeleton-in-pycharm">Import the Extraction Plugins Skeleton in PyCharm</a></li>
<li class="toctree-l3"><a class="reference internal" href="#verify-full-setup">Verify full setup</a></li>
<li class="toctree-l3"><a class="reference internal" href="#next-steps">Next steps</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="packaging.html">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="snippets.html">Python code snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2"><a class="reference internal" href="../python.html#api-documentation">API Documentation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../python.html">Python</a> &raquo;</li>
<li>Getting started</li>
<li class="wy-breadcrumbs-aside">
<a href="../../_sources/dev/python/getting_started.md.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="getting-started">
<h1>Getting started<a class="headerlink" href="#getting-started" title="Permalink to this heading"></a></h1>
<p>Set up a development environment: step by step.</p>
<p>The following section describes how to set up a fully working development environment for extraction plugins with Python.
This is written for those who are not comfortable setting up a working build environment.
This is <strong>optional</strong>; advanced users may choose a different development environment setup, and can skip this section completely.</p>
<p>If you fail to set up a development environment, feel free to ask for help at our Discord channel.</p>
<section id="install-required-software-on-ubuntu">
<h2>Install required software on Ubuntu<a class="headerlink" href="#install-required-software-on-ubuntu" title="Permalink to this heading"></a></h2>
<p>In order to be able to develop Hansken Extraction Plugins in Python on Ubuntu, the following build tools need be installed on your system: python, pip, tox, Java, Docker.</p>
<ul>
<li><p><strong>Python, pip, tox, Java</strong><span class="raw-html-m2r"><br></span>
To install, run the following commands in your terminal:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo apt update
sudo apt install python3.8 python3-pip tox default-jdk
</pre></div>
</div>
<p>You can check whether all versions are installed correctly by running the following commands (and validate the output):</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python --version
<span class="c1"># should return version 3.8.10 or higher</span>
pip3 --version
<span class="c1"># should return version 20.0.2 or higher</span>
tox --version
<span class="c1"># should return version 3.11.2 or higher</span>
java -version
<span class="c1"># should return version 11.0.4 or higher</span>
</pre></div>
</div>
</li>
</ul>
<p>If the above software is installed, you can continue with “Install Docker”,
or if you dont want to install Docker, continue with “Install your IDE: Pycharm”.</p>
</section>
<section id="install-required-software-on-windows">
<h2>Install required software on Windows.<a class="headerlink" href="#install-required-software-on-windows" title="Permalink to this heading"></a></h2>
<p>In order to be able to develop Hansken Extraction Plugins in Python on Windows, follow the next steps:</p>
<ul>
<li><p>For verification of the installation of each program we will use commands on the command prompt.
This can be opened by clicking the Windows Start button and typing:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>cmd
</pre></div>
</div>
<p>Then hit Enter . This will open the command prompt where you can enter the commands given in the following steps.</p>
</li>
<li><p><strong>Python 3.8 or higher &amp; pip</strong></p>
<p>Download the installer from <a class="reference external" href="https://www.python.org/downloads/">python.org/Downloads</a> (click the yellow “Download Python” button)
and run it to install Python and pip.
Pip is the standard package manager for Python.
It allows you to install and manage additional packages that are not part of the Python standard library, like the Extraction Plugins SDK.</p>
<p>Be sure to select the option “Add python to PATH”.</p>
<p>When the installation is complete, verify the installation by checking the Python and pip versions:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python --version
<span class="c1"># should return your downloaded Python version (&gt;3.8.5)</span>
pip3 --version
<span class="c1"># should return 20.2.3 or higher</span>
</pre></div>
</div>
</li>
<li><p><strong>tox</strong><span class="raw-html-m2r"><br></span>
Tox is used to automate and standardize testing in Python. Use Pip to install Tox with this command:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pip install tox
</pre></div>
</div>
<p>Verify that Tox is installed by running:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>tox --version
<span class="c1"># should return 3.23.0 or higher</span>
</pre></div>
</div>
</li>
<li><p><strong>Java JDK 11.0.4 (or higher)</strong><span class="raw-html-m2r"><br></span>
Java JDK 11.0.4 or higher is needed to run the test framework of the Extraction Plugins SDK.
This enables you to test without actually deploying the plugin in Hansken.
Installing Java on Windows can be done in many different way, but for now we can not recommend one method.
Please have a look at <a class="reference external" href="https://docs.microsoft.com/en-us/java/openjdk/install">Install the Microsoft Build of OpenJDK</a> for more details.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>java -version
<span class="c1"># should return 11.0.4 or higher</span>
</pre></div>
</div>
<p>N.b. Make sure to set the environment variable in case the installed JDK is not detected by the system.
You can follow the below-mentioned steps to set the environment variable:</p>
<ol class="arabic simple">
<li><p>Click the Windows start button</p></li>
<li><p>Type “advanced system settings”</p></li>
<li><p>Hit enter</p></li>
<li><p>Now click on Environment Variables, select Path under System Variables section and click on Edit. We need to add the path of installed JDK to system Path.</p></li>
<li><p>Click on New Button and add the path to installed JDK bin which is C:javajava-11jdk-11.0.4bin in our case.</p></li>
<li><p>Press OK Button 3 times to close all the windows. This sets the JDK 11 on system environment variables to access the same from the console.</p></li>
</ol>
</li>
</ul>
<p>If the above software is installed, you can continue with “Install Docker”,
or if you dont want to install Docker, continue with “Install your IDE: Pycharm”.</p>
</section>
<section id="install-docker-ubuntu-windows">
<h2>Install Docker (Ubuntu, Windows)<a class="headerlink" href="#install-docker-ubuntu-windows" title="Permalink to this heading"></a></h2>
<p>Installing Docker is a bit more complicated. The Docker website describes the installation instructions in detail.
Please follow the instructions on <a class="reference external" href="https://docs.docker.com/get-docker/">docs.docker.gom/get-docker/</a> to install docker.</p>
<ul>
<li><p>To check you have Docker installed correctly, run</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker --version
<span class="c1"># should return version 20.10.17 or higher</span>
</pre></div>
</div>
</li>
</ul>
<p>Note: if you run Docker inside a managed network, you might also need to configure proxies and/or certificates.
Please contact your system administrator if you need help with this.</p>
</section>
<section id="set-up-your-ide-pycharm">
<h2>Set up your IDE: PyCharm<a class="headerlink" href="#set-up-your-ide-pycharm" title="Permalink to this heading"></a></h2>
<p>We recommend that you use an IDE to aid you in your development of Extraction Plugins. PyCharm is a good choice.</p>
<ul class="simple">
<li><p>JetBrains has an excellent installation guide on their webpage: <a class="reference external" href="https://www.jetbrains.com/help/pycharm/installation-guide.html">Click here to go to the Pycharm Installation Guide</a></p></li>
</ul>
</section>
<section id="download-an-extraction-plugin-template-empty-plugin">
<h2>Download an extraction plugin template (empty plugin)<a class="headerlink" href="#download-an-extraction-plugin-template-empty-plugin" title="Permalink to this heading"></a></h2>
<p>You can download an extraction plugin template.
This is an empty plugin, from which you can rapidly start your plugin development.</p>
<ul>
<li><p>The template is hosted on GitHub: <a class="reference external" href="https://github.com/NetherlandsForensicInstitute/hansken-extraction-plugin-template-python">https://github.com/NetherlandsForensicInstitute/hansken-extraction-plugin-template-python</a>.
You can download a zip with the template from here. The below screenshot shows where the download button is located:</p>
<a class="reference external image-reference" href="getting_started/download_template.png"><img alt="" src="../../_images/download_template.png" /></a>
</li>
</ul>
</section>
<section id="import-the-extraction-plugins-skeleton-in-pycharm">
<h2>Import the Extraction Plugins Skeleton in PyCharm<a class="headerlink" href="#import-the-extraction-plugins-skeleton-in-pycharm" title="Permalink to this heading"></a></h2>
<ul>
<li><p>First unzip the skeleton plugin downloaded from the previous step.</p></li>
<li><p>Next, start PyCharm.</p></li>
<li><p>When PyCharm starts, choose “Open” and select the folder where you placed the Extraction Plugin Skeleton.</p>
<a class="reference external image-reference" href="getting_started/pycharm_open_project.png"><img alt="" src="../../_images/pycharm_open_project.png" /></a>
</li>
<li><p>The following popup will appear, click OK .</p>
<a class="reference external image-reference" href="getting_started/pycharm_open_project_venv.png"><img alt="" src="../../_images/pycharm_open_project_venv.png" /></a>
</li>
<li><p>The Extraction Plugins Skeleton is now loaded in PyCharm, which should look as follows:</p>
<a class="reference external image-reference" href="getting_started/pycharm_project_start_page.png"><img alt="" src="../../_images/pycharm_project_start_page.png" /></a>
</li>
<li><p>Be sure to give the <code class="docutils literal notranslate"><span class="pre">README.md</span></code> a read when you are done with the Prerequisites.</p></li>
</ul>
</section>
<section id="verify-full-setup">
<h2>Verify full setup<a class="headerlink" href="#verify-full-setup" title="Permalink to this heading"></a></h2>
<p>To verify that your system has been setup correctly, you can run the test suite in the Extraction Plugin Skeleton:</p>
<ul>
<li><p>First, press <code class="docutils literal notranslate"><span class="pre">alt-F12</span></code> at the same time to open a terminal in PyCharm in the project root folder.</p></li>
<li><p>To run the tests of the Skeleton, run this command in the terminal from the root folder:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>tox
</pre></div>
</div>
<p>The first time running tox may take a few minutes! Please be patient 😊</p>
<p>Tox will install all required plugin dependencies, and start your tests.
N.b. The plugin template demonstrates how to build a plugin with tox.
Some plugin developers choose a different tool than tox.</p>
</li>
<li><p>If your system has been set up correctly, the output should end with a summary like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">py38</span><span class="p">:</span> <span class="n">commands</span> <span class="n">succeeded</span>
<span class="n">congratulations</span> <span class="p">:)</span>
</pre></div>
</div>
<p>This means the setup is finished. You now have everything installed to start coding your own plugin!</p>
</li>
</ul>
</section>
<section id="next-steps">
<h2>Next steps<a class="headerlink" href="#next-steps" title="Permalink to this heading"></a></h2>
<p>Now that you have a working environment, you can start doing cool stuff.
Please have a look at the following pages for more information:</p>
<ul class="simple">
<li><p><a class="reference internal" href="packaging.html"><span class="doc">Packaging</span></a>: how to package your plugin and use it in Hansken</p></li>
<li><p><a class="reference internal" href="hanskenpy.html"><span class="doc">Run plugins with Hansken.py</span></a>: run your plugin on a case without uploading the plugin to Hansken, useful for quick prototyping</p></li>
<li><p><a class="reference internal" href="testing.html"><span class="doc">Testing</span></a>: how to write tests for your plugin</p></li>
<li><p><a class="reference internal" href="debugging.html"><span class="doc">Debugging</span></a>: if your plugin isnt working as expected, you can debug it</p></li>
<li><p><a class="reference internal" href="snippets.html"><span class="doc">Snippets</span></a>: code snippets to demonstrate common plugin usage patterns</p></li>
</ul>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="prerequisites.html" class="btn btn-neutral float-left" title="Prerequisites" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="packaging.html" class="btn btn-neutral float-right" title="Packaging" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
+222
View File
@@ -0,0 +1,222 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Run plugins with Hansken.py &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="How to debug an Extraction Plugin" href="debugging.html" />
<link rel="prev" title="Advanced use of the Test Framework in Python" href="testing.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2"><a class="reference internal" href="prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="getting_started.html">Getting started</a></li>
<li class="toctree-l2"><a class="reference internal" href="packaging.html">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="snippets.html">Python code snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Run plugins with Hansken.py</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#how-to-run-python-extraction-plugins-standalone-with-hansken-py">How to run python extraction plugins standalone with Hansken.py</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#create-a-runner-file">Create a runner file</a></li>
<li class="toctree-l4"><a class="reference internal" href="#preparing-for-the-command">Preparing for the command</a></li>
<li class="toctree-l4"><a class="reference internal" href="#running-your-plugin-with-hansken-py">Running your plugin with Hansken.py</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#compatibility">Compatibility</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2"><a class="reference internal" href="../python.html#api-documentation">API Documentation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../python.html">Python</a> &raquo;</li>
<li>Run plugins with Hansken.py</li>
<li class="wy-breadcrumbs-aside">
<a href="../../_sources/dev/python/hanskenpy.md.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="run-plugins-with-hansken-py">
<h1>Run plugins with Hansken.py<a class="headerlink" href="#run-plugins-with-hansken-py" title="Permalink to this heading"></a></h1>
<p>Hansken.py is a Python client to Hanskens REST API, developed and maintained by the Netherlands Forensic Institute.</p>
<p>With Hansken.py, you can run your Python plugin on a project on your Hansken installation that has already been
extracted. This way of running your plugin is useful during your plugin development. It is not required to upload your
plugin to Hansken and start an extraction, making the development cycle faster. However, please note that this is only
useful during the development stage of your plugin, as the execution of your plugin will be much slower compared to
running the plugin during a Hansken extraction.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The execution of your plugin will be much slower in Hansken.py compared to running the plugin during a Hansken
extraction.</p>
</div>
<section id="how-to-run-python-extraction-plugins-standalone-with-hansken-py">
<h2>How to run python extraction plugins standalone with Hansken.py<a class="headerlink" href="#how-to-run-python-extraction-plugins-standalone-with-hansken-py" title="Permalink to this heading"></a></h2>
<p>Running python extraction plugins standalone with Hansken.py is easy. It is just one command. This section explains how
to setup this command for your specific environment.</p>
<section id="create-a-runner-file">
<h3>Create a runner file<a class="headerlink" href="#create-a-runner-file" title="Permalink to this heading"></a></h3>
<p>Create a file <code class="docutils literal notranslate"><span class="pre">run_with_hansken.py</span></code> in the root folder of your plugin. This will aid you in running the plugin with
hansken.py.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">hansken_extraction_plugin.runtime.extraction_plugin_runner</span> <span class="kn">import</span> <span class="n">run_with_hanskenpy</span>
<span class="kn">from</span> <span class="nn">plugin.my_plugin</span> <span class="kn">import</span> <span class="n">MyPlugin</span>
<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s1">&#39;__main__&#39;</span><span class="p">:</span>
<span class="n">run_with_hanskenpy</span><span class="p">(</span><span class="n">MyPlugin</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="preparing-for-the-command">
<h3>Preparing for the command<a class="headerlink" href="#preparing-for-the-command" title="Permalink to this heading"></a></h3>
<p>Before you can enter the command that runs your extraction plugin with Hansken.py, you need to find three values:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">HANSKEN_PROJECT_ID</span></code> project id on which you want to run your plugin</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">YOUR_GATEKEEPER_URL</span></code> the URL to the Hansken gatekeeper</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">YOUR_KEYSTORE_URL</span></code> the URL to your keystore</p></li>
</ul>
<p>The correct values of these variables can be found in the Expert UI. Go to the search-page of your project in the
ExpertUI. Next to the search-bar hit the button “Save query”.</p>
<a class="reference external image-reference" href="hanskenpy_save_query.png"><img alt="hanskenpy_save_query.png" src="../../_images/hanskenpy_save_query.png" /></a>
<p>A new dialog shows up. At the bottom of this dialog, you will find your gatekeeper and keystore urls as well as the
project id.</p>
<a class="reference external image-reference" href="hanskenpy_gatekeeper_keystore.png"><img alt="hanskenpy_gatekeeper_keystore.png" src="../../_images/hanskenpy_gatekeeper_keystore.png" /></a>
</section>
<section id="running-your-plugin-with-hansken-py">
<h3>Running your plugin with Hansken.py<a class="headerlink" href="#running-your-plugin-with-hansken-py" title="Permalink to this heading"></a></h3>
<p>Next, open a terminal in the project root folder of your plugin and enter the following command. It will run your
extraction plugin with Hansken.py in Hansken. Replace the three variables with their respective values.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python3 ./run_with_hanskenpy.py -v -l - HANSKEN_PROJECT_ID --endpoint YOUR_GATEKEEPER_URL --keystore YOUR_KEYSTORE_URL
</pre></div>
</div>
<p>If your command runs well, you might be prompted for your username and password. There will be some output (note that
the output may vary depending on your system setup and project content):</p>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>[2021-03-16 12:59:45.344248+0000] INFO: hansken.auth: selected IDP ID (...) with SOAP endpoint (...)
[2021-03-16 12:59:45.344450+0000] WARNING: hansken.auth: IDP url known, user+pass auth required but no username supplied
username []: testaccount
[2021-03-16 12:59:48.423245+0000] INFO: hansken.auth: user acknowledged environment username or supplied custom username: testaccount
password for user testaccount:
[2021-03-16 12:59:53.799668+0000] INFO: hansken.auth: identity provider url and user+pass provided or known, using Keycloak SAML with Basic auth
[2021-03-16 12:59:53.805538+0000] INFO: hansken_extraction_plugin.runtime.extraction_plugin_runner: PluginRunner is running plugin class Plugin
[2021-03-16 12:59:53.859299+0000] INFO: hansken.auth: posting SAML request with authorization for user testaccount to IDP endpoint (...)
[2021-03-16 12:59:54.240290+0000] INFO: plugin.extraction_plugin: processing trace 54197e67-8135-40c3-93f1-3d73a5552693
[2021-03-16 12:59:54.240753+0000] INFO: plugin.extraction_plugin: processing trace OCRimage
[2021-03-16 12:59:54.240753+0000] INFO: plugin.extraction_plugin: processing trace (...)
</pre></div>
</div>
<p>Note that the arguments <code class="docutils literal notranslate"><span class="pre">-v</span></code> and <code class="docutils literal notranslate"><span class="pre">-l</span> <span class="pre">-</span></code> are passed to enable logging. To find out what other options can be passed to
this command, please have a look at the hansken.py documentation, or simply run the following command:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python3 ./run_with_hanskenpy.py --help
</pre></div>
</div>
</section>
</section>
<section id="compatibility">
<h2>Compatibility<a class="headerlink" href="#compatibility" title="Permalink to this heading"></a></h2>
<p>At this moment, running Extraction Plugins with Hansken.py has a few limitations. These are:</p>
<ul class="simple">
<li><p>When writing an Extraction Plugin for use with Hansken.py, the matcher must contain exactly one “$data.property =
value” expression.</p></li>
<li><p><a class="reference internal" href="../concepts/data_transformations.html"><span class="doc">Data transformations</span></a> are currently not supported by Hansken.py.</p></li>
<li><p><a class="reference internal" href="../concepts/traces.html#tracelets"><span class="std std-ref">Tracelets</span></a> are not yet supported by the SDK in use with Hansken.py.</p></li>
</ul>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="testing.html" class="btn btn-neutral float-left" title="Advanced use of the Test Framework in Python" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="debugging.html" class="btn btn-neutral float-right" title="How to debug an Extraction Plugin" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
+167
View File
@@ -0,0 +1,167 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Packaging &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Python code snippets" href="snippets.html" />
<link rel="prev" title="Getting started" href="getting_started.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2"><a class="reference internal" href="prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="getting_started.html">Getting started</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="snippets.html">Python code snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2"><a class="reference internal" href="../python.html#api-documentation">API Documentation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../python.html">Python</a> &raquo;</li>
<li>Packaging</li>
<li class="wy-breadcrumbs-aside">
<a href="../../_sources/dev/python/packaging.md.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="packaging">
<h1>Packaging<a class="headerlink" href="#packaging" title="Permalink to this heading"></a></h1>
<p>Extraction plugins are packaged as OCI images (also known as Docker images).
The OCI images are <em>labeled</em> with the PluginInfo.
To automate packaging of a Python plugin and labeling the OCI image,
the Extraction Plugin SDK comes with a utility application <code class="docutils literal notranslate"><span class="pre">build_plugin</span></code>.</p>
<p>Make sure that the Extraction Plugins SDK is <a class="reference internal" href="getting_started.html"><span class="doc">installed</span></a> as well as Docker.</p>
<p>Then, build your plugin container image using the following command:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>build_plugin PLUGIN_FILE DOCKER_FILE_DIRECTORY <span class="o">[</span>DOCKER_IMAGE_NAME<span class="o">]</span> <span class="o">[</span>DOCKER_ARGS<span class="o">]</span>
</pre></div>
</div>
<p>For example:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>build_plugin chatplugin.py . chatplugin --build-arg <span class="nv">http_proxy</span><span class="o">=</span><span class="s2">&quot;</span><span class="nv">$http_proxy</span><span class="s2">&quot;</span> --build-arg <span class="nv">https_proxy</span><span class="o">=</span><span class="s2">&quot;</span><span class="nv">$https_proxy</span><span class="s2">&quot;</span>
</pre></div>
</div>
<p>This will generate a plugin image:</p>
<ul class="simple">
<li><p>The extraction plugin is added to your local image registry (<code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">images</span></code>),</p></li>
<li><p>Note that the variables <code class="docutils literal notranslate"><span class="pre">$http_proxy</span></code> and <code class="docutils literal notranslate"><span class="pre">$https_proxy</span></code> are put in quotes, this is needed in case they contain
spaces,</p></li>
<li><p>The image is tagged with two tags: <code class="docutils literal notranslate"><span class="pre">latest</span></code>, and your plugin version.</p></li>
</ul>
<p>Arguments:</p>
<ul class="simple">
<li><p>PLUGIN_FILE: Path to the python file of the plugin.</p></li>
<li><p>DOCKER_FILE_DIRECTORY: Path to the directory containing the Dockerfile of the plugin.</p></li>
<li><p>(Optional) [DOCKER_IMAGE_NAME]: Name of the docker image without tag. Note that docker image names cannot start with
a period or dash. If it starts with a dash, it will be interpreted as an additional docker argument (see
DOCKER_ARGS). If no name is given the name defaults to <code class="docutils literal notranslate"><span class="pre">extraction-plugin/PLUGINID</span></code>, e.g.
<code class="docutils literal notranslate"><span class="pre">extraction-plugin/nfi.nl/extract/chat/whatsapp</span></code>.</p></li>
<li><p>(Optional) [DOCKER_ARGS]: Additional arguments for the docker command, which can be as many arguments as you like.</p></li>
</ul>
<p>To verify that the image has been built, type the following command to view all local images:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker images
</pre></div>
</div>
<p>Once your plugin is packaged, it can be published or uploaded to Hansken.
See “<a class="reference internal" href="../concepts/extraction_plugins.html#upload-plugin"><span class="std std-ref">Upload the plugin to Hansken</span></a>” for instructions.</p>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="getting_started.html" class="btn btn-neutral float-left" title="Getting started" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="snippets.html" class="btn btn-neutral float-right" title="Python code snippets" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
+138
View File
@@ -0,0 +1,138 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Prerequisites &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Getting started" href="getting_started.html" />
<link rel="prev" title="Python API Changelog" href="api_changelog.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="getting_started.html">Getting started</a></li>
<li class="toctree-l2"><a class="reference internal" href="packaging.html">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="snippets.html">Python code snippets</a></li>
<li class="toctree-l2"><a class="reference internal" href="testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2"><a class="reference internal" href="../python.html#api-documentation">API Documentation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../python.html">Python</a> &raquo;</li>
<li>Prerequisites</li>
<li class="wy-breadcrumbs-aside">
<a href="../../_sources/dev/python/prerequisites.md.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="prerequisites">
<h1>Prerequisites<a class="headerlink" href="#prerequisites" title="Permalink to this heading"></a></h1>
<p>All required project dependencies to build extraction plugins are published on the public <a class="reference external" href="https://pypi.org/project/hansken-extraction-plugin/">PyPI</a>.</p>
<p>Required:</p>
<ul class="simple">
<li><p>Python 3.8 or higher</p></li>
<li><p>Java 11 (for running the test-framework, which is implemented in Java)</p></li>
<li><p>Docker (for packaging and deploying extraction plugins in containers, can be omitted if you have an external build pipeline that provides Docker)</p></li>
</ul>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="api_changelog.html" class="btn btn-neutral float-left" title="Python API Changelog" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="getting_started.html" class="btn btn-neutral float-right" title="Getting started" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
+311
View File
@@ -0,0 +1,311 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Python code snippets &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Advanced use of the Test Framework in Python" href="testing.html" />
<link rel="prev" title="Packaging" href="packaging.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2"><a class="reference internal" href="prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="getting_started.html">Getting started</a></li>
<li class="toctree-l2"><a class="reference internal" href="packaging.html">Packaging</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Python code snippets</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#adding-properties-to-a-trace">Adding properties to a trace</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#date-properties">Date properties</a></li>
<li class="toctree-l4"><a class="reference internal" href="#category-for-extra-properties">Category for extra properties</a></li>
<li class="toctree-l4"><a class="reference internal" href="#adding-tracelets">Adding tracelets</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#adding-child-traces-to-a-trace">Adding child traces to a trace</a></li>
<li class="toctree-l3"><a class="reference internal" href="#adding-data-to-a-trace">Adding data to a trace</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#data-transformations">Data Transformations</a></li>
<li class="toctree-l4"><a class="reference internal" href="#blobs">Blobs</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#specifying-system-resources">Specifying system resources</a></li>
<li class="toctree-l3"><a class="reference internal" href="#deferred-plugins">Deferred Plugins</a></li>
<li class="toctree-l3"><a class="reference internal" href="#logging">Logging</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="testing.html">Advanced use of the Test Framework in Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2"><a class="reference internal" href="../python.html#api-documentation">API Documentation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../python.html">Python</a> &raquo;</li>
<li>Python code snippets</li>
<li class="wy-breadcrumbs-aside">
<a href="../../_sources/dev/python/snippets.md.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="python-code-snippets">
<h1>Python code snippets<a class="headerlink" href="#python-code-snippets" title="Permalink to this heading"></a></h1>
<section id="adding-properties-to-a-trace">
<h2>Adding properties to a trace<a class="headerlink" href="#adding-properties-to-a-trace" title="Permalink to this heading"></a></h2>
<p>Use <a class="reference internal" href="api/hansken_extraction_plugin.api.extraction_trace.html#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.update" title="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.update"><code class="xref py py-meth docutils literal notranslate"><span class="pre">update</span></code></a>
to add trace types and their properties to an
<a class="reference internal" href="api/hansken_extraction_plugin.api.extraction_trace.html#hansken_extraction_plugin.api.extraction_trace.ExtractionTrace" title="hansken_extraction_plugin.api.extraction_trace.ExtractionTrace"><code class="xref py py-class docutils literal notranslate"><span class="pre">ExtractionTrace</span></code></a>.
Example:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">trace</span><span class="p">,</span> <span class="n">data_context</span><span class="p">):</span>
<span class="c1"># get the name of the file</span>
<span class="n">file_name</span> <span class="o">=</span> <span class="n">trace</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;file.name&#39;</span><span class="p">)</span>
<span class="c1"># set the chat application property on the trace</span>
<span class="n">trace</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="s1">&#39;chatConversation.application&#39;</span><span class="p">,</span> <span class="sa">f</span><span class="s1">&#39;DemoApp </span><span class="si">{</span><span class="n">file_name</span><span class="si">}</span><span class="s1">&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>All types and properties that can be set are defined in the <a class="reference internal" href="../concepts/traces.html#hansken-trace-model"><span class="std std-ref">Hansken trace model</span></a>.</p>
<section id="date-properties">
<h3>Date properties<a class="headerlink" href="#date-properties" title="Permalink to this heading"></a></h3>
<p>When adding a property which holds a value of data-type Date, always define timezone as being UTC. Example:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">trace</span><span class="p">,</span> <span class="n">data_context</span><span class="p">):</span>
<span class="n">trace</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="s1">&#39;file.modifiedOn&#39;</span><span class="p">,</span>
<span class="n">datetime</span><span class="o">.</span><span class="n">fromtimestamp</span><span class="p">(</span><span class="mi">1630510809</span><span class="p">,</span> <span class="n">tz</span><span class="o">=</span><span class="n">timezone</span><span class="o">.</span><span class="n">utc</span><span class="p">))</span>
</pre></div>
</div>
</section>
<section id="category-for-extra-properties">
<h3>Category for extra properties<a class="headerlink" href="#category-for-extra-properties" title="Permalink to this heading"></a></h3>
<p>If the information, which must be added as a property, does not match any of the existing properties of Hansken trace
model, use the category “misc” (miscellaneous). When part of the category “misc”, any name can be given to a property.
The values of miscellaneous properties are expected to be of data-type string. Example:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">trace</span><span class="p">,</span> <span class="n">data_context</span><span class="p">):</span>
<span class="n">trace</span><span class="o">.</span><span class="n">update</span><span class="p">({</span>
<span class="s1">&#39;file.misc.notes&#39;</span><span class="p">:</span> <span class="s1">&#39;Some additional notes about the file trace.&#39;</span><span class="p">,</span>
<span class="s1">&#39;file.misc.anyName&#39;</span><span class="p">:</span> <span class="s1">&#39;Even more notes.&#39;</span>
<span class="p">})</span>
</pre></div>
</div>
</section>
<section id="adding-tracelets">
<span id="tracelets-python"></span><h3>Adding tracelets<a class="headerlink" href="#adding-tracelets" title="Permalink to this heading"></a></h3>
<p>In the following Python example, a “prediction” <a class="reference internal" href="../concepts/traces.html#tracelets"><span class="std std-ref">tracelet</span></a> is added to a trace. The tracelet consists
of a list of four properties, namely “class”, “confidence”, “modelName” and “modelVersion”.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">trace</span><span class="o">.</span><span class="n">add_tracelet</span><span class="p">(</span><span class="n">Tracelet</span><span class="p">(</span><span class="s1">&#39;prediction&#39;</span><span class="p">,</span> <span class="p">{</span><span class="s1">&#39;class&#39;</span><span class="p">:</span> <span class="s1">&#39;telephone&#39;</span><span class="p">,</span>
<span class="s1">&#39;confidence&#39;</span><span class="p">:</span> <span class="mf">0.8</span><span class="p">,</span>
<span class="s1">&#39;modelName&#39;</span><span class="p">:</span> <span class="s1">&#39;yolo&#39;</span><span class="p">,</span>
<span class="s1">&#39;modelVersion&#39;</span><span class="p">:</span> <span class="s1">&#39;2.0&#39;</span><span class="p">}))</span>
</pre></div>
</div>
</section>
</section>
<section id="adding-child-traces-to-a-trace">
<h2>Adding child traces to a trace<a class="headerlink" href="#adding-child-traces-to-a-trace" title="Permalink to this heading"></a></h2>
<p>Adding child traces to the trace can be done by creating a builder with
<a class="reference internal" href="api/hansken_extraction_plugin.api.extraction_trace.html#hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.child_builder" title="hansken_extraction_plugin.api.extraction_trace.ExtractionTraceBuilder.child_builder"><code class="xref py py-meth docutils literal notranslate"><span class="pre">child_builder</span></code></a>.
Example:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">trace</span><span class="p">,</span> <span class="n">data_context</span><span class="p">):</span>
<span class="n">child_builder</span> <span class="o">=</span> <span class="n">trace</span><span class="o">.</span><span class="n">child_builder</span><span class="p">(</span><span class="s1">&#39;childTrace-1&#39;</span><span class="p">)</span>
<span class="n">child_builder</span><span class="o">.</span><span class="n">update</span><span class="p">({</span>
<span class="s1">&#39;chatMessage.application&#39;</span><span class="p">:</span> <span class="s1">&#39;DemoApp&#39;</span><span class="p">,</span>
<span class="s1">&#39;chatMessage.from&#39;</span><span class="p">:</span> <span class="s1">&#39;Ann&#39;</span><span class="p">,</span>
<span class="s1">&#39;chatMessage.to&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;Mark&#39;</span><span class="p">],</span>
<span class="c1"># list, because there can be multiple receivers</span>
<span class="s1">&#39;chatMessage.message&#39;</span><span class="p">:</span> <span class="s1">&#39;Hello, are you there?&#39;</span><span class="p">,</span>
<span class="p">})</span><span class="o">.</span><span class="n">build</span><span class="p">()</span>
</pre></div>
</div>
<p>This adds a single child trace with name <code class="docutils literal notranslate"><span class="pre">childTrace-1</span></code> and four properties.</p>
</section>
<section id="adding-data-to-a-trace">
<span id="datastreams-python"></span><h2>Adding data to a trace<a class="headerlink" href="#adding-data-to-a-trace" title="Permalink to this heading"></a></h2>
<p>Traces can have data attached to them. See <a class="reference internal" href="../concepts/traces.html#datastreams"><span class="std std-ref">Data streams</span></a> for more information.
The following two snippets demonstrate how to add data to a trace.</p>
<p>It is currently not possible to verify that a specific data stream is already set or not.</p>
<section id="data-transformations">
<h3>Data Transformations<a class="headerlink" href="#data-transformations" title="Permalink to this heading"></a></h3>
<p>The most efficient way to add data to a trace is using data transformations.
See <a class="reference internal" href="../concepts/data_transformations.html"><span class="doc">Data Transformations</span></a> for more details.</p>
<p>The following example sets a new datastream with dataType <code class="docutils literal notranslate"><span class="pre">html</span></code> on a trace, by setting a ranged data transformation:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">trace</span><span class="o">.</span><span class="n">add_transformation</span><span class="p">(</span><span class="s1">&#39;html&#39;</span><span class="p">,</span> <span class="n">RangedTransformation</span><span class="p">(</span><span class="n">Range</span><span class="p">(</span><span class="n">offset</span><span class="p">,</span> <span class="n">length</span><span class="p">)))</span>
</pre></div>
</div>
<p>The following example creates a child trace and sets a new datastream with dataType <code class="docutils literal notranslate"><span class="pre">raw</span></code> on it, by setting a ranged
data transformation with two ranges:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">child</span> <span class="o">=</span> <span class="n">trace</span><span class="o">.</span><span class="n">child_builder</span><span class="p">(</span><span class="s1">&#39;new trace&#39;</span><span class="p">)</span>
<span class="n">child</span><span class="o">.</span><span class="n">add_transformation</span><span class="p">(</span><span class="s1">&#39;raw&#39;</span><span class="p">,</span> <span class="n">RangedTransformation</span><span class="o">.</span><span class="n">builder</span><span class="p">()</span>
<span class="o">.</span><span class="n">add_range</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
<span class="o">.</span><span class="n">add_range</span><span class="p">(</span><span class="mi">50</span><span class="p">,</span> <span class="mi">30</span><span class="p">)</span>
<span class="o">.</span><span class="n">build</span><span class="p">())</span>
<span class="p">});</span>
</pre></div>
</div>
</section>
<section id="blobs">
<h3>Blobs<a class="headerlink" href="#blobs" title="Permalink to this heading"></a></h3>
<p>It is not always possible to create a transformation for the data that has to be
added to a trace. For example, if the data is a result of a computation, and not
a direct subset of another data stream..</p>
<p>The following snippet shows how to create a new data stream of dataType <code class="docutils literal notranslate"><span class="pre">raw</span></code> on a trace from a blob stored in <code class="docutils literal notranslate"><span class="pre">bytes</span></code>:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">data</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;raw&#39;</span><span class="p">:</span> <span class="sa">b</span><span class="s1">&#39;...&#39;</span><span class="p">}</span>
<span class="n">trace</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">);</span>
</pre></div>
</div>
</section>
</section>
<section id="specifying-system-resources">
<h2>Specifying system resources<a class="headerlink" href="#specifying-system-resources" title="Permalink to this heading"></a></h2>
<p>It is possible to specify <strong>maximum</strong> system resources in the <code class="docutils literal notranslate"><span class="pre">PluginInfo</span></code>. To run a plugin with 0.5 cpu (= 0.5
vCPU/Core/hyperthread) and 1 gb memory, for example, the following configuration can be added to <code class="docutils literal notranslate"><span class="pre">PluginInfo</span></code>:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">plugin_info</span> <span class="o">=</span> <span class="n">PluginInfo</span><span class="p">(</span><span class="o">...</span><span class="p">,</span>
<span class="n">resources</span><span class="o">=</span><span class="n">PluginResources</span><span class="p">(</span><span class="n">maximum_cpu</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span> <span class="n">maximum_memory</span><span class="o">=</span><span class="mi">1000</span><span class="p">))</span>
</pre></div>
</div>
</section>
<section id="deferred-plugins">
<span id="python-snippets-deferred"></span><h2>Deferred Plugins<a class="headerlink" href="#deferred-plugins" title="Permalink to this heading"></a></h2>
<p>Implementing a deferred extraction plugin requires inheriting the
<a class="reference internal" href="api/hansken_extraction_plugin.api.extraction_plugin.html#hansken_extraction_plugin.api.extraction_plugin.DeferredExtractionPlugin" title="hansken_extraction_plugin.api.extraction_plugin.DeferredExtractionPlugin"><code class="xref py py-class docutils literal notranslate"><span class="pre">DeferredExtractionPlugin</span></code></a>
base class.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">DeferredPlugin</span><span class="p">(</span><span class="n">DeferredExtractionPlugin</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">trace</span><span class="p">,</span> <span class="n">context</span><span class="p">,</span> <span class="n">searcher</span><span class="p">):</span>
</pre></div>
</div>
<p>This allows accessing a third <a class="reference internal" href="api/hansken_extraction_plugin.api.trace_searcher.html#hansken_extraction_plugin.api.trace_searcher.TraceSearcher" title="hansken_extraction_plugin.api.trace_searcher.TraceSearcher"><code class="xref py py-class docutils literal notranslate"><span class="pre">TraceSearcher</span></code></a>
parameter in the process function. This can be used to search for traces:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">with</span> <span class="n">searcher</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="s1">&#39;file.extension:html&#39;</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span> <span class="k">as</span> <span class="n">searchresult</span><span class="p">:</span>
<span class="k">for</span> <span class="n">trace</span> <span class="ow">in</span> <span class="n">searchresult</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="sa">f</span><span class="s1">&#39;extension </span><span class="si">{</span><span class="n">trace</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;file.extension&quot;</span><span class="p">)</span><span class="si">}</span><span class="s1">&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>The search method accepts two arguments; a HQL query and the maximum number of traces the return. The <code class="docutils literal notranslate"><span class="pre">search</span></code> method
accepts an HQL query and a count, which represents the maximum number of traces to return.</p>
<p>It may be useful to specifically search for traces from the image being extracted. Add <code class="docutils literal notranslate"><span class="pre">&quot;image:&quot;</span> <span class="pre">+</span> <span class="pre">trace.get(&quot;image&quot;)</span></code>
to your query. The query of the provided example could be extended like
this: <code class="docutils literal notranslate"><span class="pre">&quot;file.extension:html</span> <span class="pre">AND</span> <span class="pre">image:&quot;</span> <span class="pre">+</span> <span class="pre">trace.get(&quot;image&quot;)</span></code>.</p>
<p>The returned <a class="reference internal" href="api/hansken_extraction_plugin.api.search_result.html#hansken_extraction_plugin.api.search_result.SearchResult" title="hansken_extraction_plugin.api.search_result.SearchResult"><code class="xref py py-class docutils literal notranslate"><span class="pre">SearchResult</span></code></a>
should be closed, for example by using <code class="docutils literal notranslate"><span class="pre">with</span></code>. The resulting search result is an iterable, which will be exhausted when
no more traces are available. The search result allows taking one or more traces by calling :py:
meth:<code class="docutils literal notranslate"><span class="pre">take</span> <span class="pre">&lt;hansken_extraction_plugin.api.search_result.SearchResult.take&gt;</span></code> or
<a class="reference internal" href="api/hansken_extraction_plugin.api.search_result.html#hansken_extraction_plugin.api.search_result.SearchResult.takeone" title="hansken_extraction_plugin.api.search_result.SearchResult.takeone"><code class="xref py py-meth docutils literal notranslate"><span class="pre">takeone</span></code></a>.</p>
</section>
<section id="logging">
<h2>Logging<a class="headerlink" href="#logging" title="Permalink to this heading"></a></h2>
<p>We use Logbook to log messages in Python. Logbook is a logging system for Python that replaces the standard librarys
logging module.</p>
<p>To enable logging in your plugin, add the following to the top of your plugin code:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">logbook</span> <span class="kn">import</span> <span class="n">Logger</span>
<span class="n">log</span> <span class="o">=</span> <span class="n">Logger</span><span class="p">(</span><span class="vm">__name__</span><span class="p">)</span>
</pre></div>
</div>
<p>From there on the logging is pretty straight forward:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="sa">f</span><span class="s1">&#39;Logging a variable: </span><span class="si">{</span><span class="n">my_variable</span><span class="si">}</span><span class="s1">&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>The default log level is WARNING. You can use the <code class="docutils literal notranslate"><span class="pre">-v</span></code> (or <code class="docutils literal notranslate"><span class="pre">-vv</span></code> or <code class="docutils literal notranslate"><span class="pre">-vvv</span></code>) option of <code class="docutils literal notranslate"><span class="pre">serve_plugin.py</span></code> to increase the
log level. This is typically done in the plugin <code class="docutils literal notranslate"><span class="pre">Dockerfile</span></code>.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Be careful with logging sensitive information.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Contact your Hansken administrator for more information on where to find logs for your Hansken environment.</p>
</div>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="packaging.html" class="btn btn-neutral float-left" title="Packaging" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="testing.html" class="btn btn-neutral float-right" title="Advanced use of the Test Framework in Python" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>
+228
View File
@@ -0,0 +1,228 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Advanced use of the Test Framework in Python &mdash; Hansken Extraction Plugins for plugin developers 0.6.1
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/wider_pages.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Run plugins with Hansken.py" href="hanskenpy.html" />
<link rel="prev" title="Python code snippets" href="snippets.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"> Hansken Extraction Plugins for plugin developers
</a>
<div class="version">
0.6.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="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 class="current">
<li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../concepts.html">General concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../spec.html">Extraction Plugin specifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../java.html">Java</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../python.html">Python</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="api_changelog.html">Python API Changelog</a></li>
<li class="toctree-l2"><a class="reference internal" href="prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="getting_started.html">Getting started</a></li>
<li class="toctree-l2"><a class="reference internal" href="packaging.html">Packaging</a></li>
<li class="toctree-l2"><a class="reference internal" href="snippets.html">Python code snippets</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Advanced use of the Test Framework in Python</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#regenerate-expected-test-results">Regenerate expected test results</a></li>
<li class="toctree-l3"><a class="reference internal" href="#standalone-testing">Standalone testing</a></li>
<li class="toctree-l3"><a class="reference internal" href="#testing-with-a-docker-image">Testing with a Docker image</a></li>
<li class="toctree-l3"><a class="reference internal" href="#manual-testing">Manual testing</a></li>
<li class="toctree-l3"><a class="reference internal" href="#tip-start-tests-in-your-ide">Tip: Start tests in your IDE</a></li>
<li class="toctree-l3"><a class="reference internal" href="#help">Help</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="hanskenpy.html">Run plugins with Hansken.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="debugging.html">How to debug an Extraction Plugin</a></li>
<li class="toctree-l2"><a class="reference internal" href="../python.html#api-documentation">API Documentation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../contact.html">Contact</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../changes.html">Changelog</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">Hansken Extraction Plugins for plugin developers</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"></a> &raquo;</li>
<li><a href="../python.html">Python</a> &raquo;</li>
<li>Advanced use of the Test Framework in Python</li>
<li class="wy-breadcrumbs-aside">
<a href="../../_sources/dev/python/testing.md.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="advanced-use-of-the-test-framework-in-python">
<h1>Advanced use of the Test Framework in Python<a class="headerlink" href="#advanced-use-of-the-test-framework-in-python" title="Permalink to this heading"></a></h1>
<p id="python-testing">This section assumes you use the same setup as is used in
the <a class="reference external" href="https://git.eminjenv.nl/hanskaton/hansken-extraction-plugin-sdk/examples">Extraction Plugin Examples</a>.</p>
<p>By default, the build scripts as described in the <a class="reference internal" href="getting_started.html"><span class="doc">Getting Started</span></a> section will automatically run
tests. The appropriate commands have been added to the tox.ini directly. This section gives a little more detail on the
test commands and options.</p>
<p>One can simply create unit tests for a plugin directly. However, we also provide a test-framework for testing them over
gRPC. The test-framework serves a running instance of a Python plugin, and feeds it input files and compares the results
against an expected result set.</p>
<p>Note that the test-framework is implemented in Java, hence the Java 11 requirement. A jar file is included in the Python
SDK which is called from a Python wrapper.</p>
<section id="regenerate-expected-test-results">
<h2>Regenerate expected test results<a class="headerlink" href="#regenerate-expected-test-results" title="Permalink to this heading"></a></h2>
<p>The build and test scripts run some integration tests. To update the expected test outcome, the following command can be
used:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>tox -e regenerate
</pre></div>
</div>
</section>
<section id="standalone-testing">
<h2>Standalone testing<a class="headerlink" href="#standalone-testing" title="Permalink to this heading"></a></h2>
<p>The test runner is a script called <code class="docutils literal notranslate"><span class="pre">test_plugin</span></code> which is available in the SDK.</p>
<p>To get started, <code class="docutils literal notranslate"><span class="pre">cd</span></code> into the directory of the plugin you want to test and run:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>test_plugin --standalone plugin/chat_plugin.py
</pre></div>
</div>
<p>Note that the argument provided to the option <code class="docutils literal notranslate"><span class="pre">--standalone</span></code> must be the relative path to the plugin <code class="docutils literal notranslate"><span class="pre">py</span></code> file which is
to be tested. This test accepts input files from the directory <code class="docutils literal notranslate"><span class="pre">testdata/input</span></code> and compares the results to the result
files in found in <code class="docutils literal notranslate"><span class="pre">testdata/results</span></code>. Use the optional argument <code class="docutils literal notranslate"><span class="pre">--regenerate</span></code> to regenerate the expected results for
the test when needed.</p>
<p>This standalone test is also used by the <code class="docutils literal notranslate"><span class="pre">tox.ini</span></code> file to validate the plugin. Simply calling <code class="docutils literal notranslate"><span class="pre">tox</span></code> should be enough to
install all dependencies and run the test.</p>
</section>
<section id="testing-with-a-docker-image">
<h2>Testing with a Docker image<a class="headerlink" href="#testing-with-a-docker-image" title="Permalink to this heading"></a></h2>
<p>If there is a docker image available for the plugin you can also test it by executing:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>test_plugin --docker extraction-plugin-examples-my-plugin
</pre></div>
</div>
<p>Replace the extraction-plugin-examples-chat with the docker image you want to test. Run the following command to see
which docker images are available:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker images
</pre></div>
</div>
</section>
<section id="manual-testing">
<h2>Manual testing<a class="headerlink" href="#manual-testing" title="Permalink to this heading"></a></h2>
<p>The third option for testing is a manually started plugin. Start the plugin service in a terminal by executing:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>serve_plugin -vvv plugin/my_plugin.py
</pre></div>
</div>
<p>This will spin up the chat plugin at port 8999. Here also the argument must be a path to the plugins <code class="docutils literal notranslate"><span class="pre">.py</span></code> file. In
another terminal window, run the test with:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>test_plugin --manual localhost <span class="m">8999</span>
</pre></div>
</div>
</section>
<section id="tip-start-tests-in-your-ide">
<h2>Tip: Start tests in your IDE<a class="headerlink" href="#tip-start-tests-in-your-ide" title="Permalink to this heading"></a></h2>
<p>To start the extraction plugin from code, create a <code class="docutils literal notranslate"><span class="pre">__main__</span></code> method which calls the <code class="docutils literal notranslate"><span class="pre">_test_validate_standalone</span></code>
method of the test framework (see the example below). This method causes the extraction plugin to be started and
supplied with data by the FLITS test framework. In this way the test can be started from the IDE, which has the
advantage that it is easier to debug.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">hansken_extraction_plugin.test_framework.test_plugin</span> <span class="kn">import</span> <span class="n">_test_validate_standalone</span>
<span class="kn">from</span> <span class="nn">hansken_extraction_plugin.api.extraction_plugin</span> <span class="kn">import</span> <span class="n">ExtractionPlugin</span>
<span class="k">class</span> <span class="nc">PluginToTest</span><span class="p">(</span><span class="n">ExtractionPlugin</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">plugin_info</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="c1"># return plugin info</span>
<span class="k">pass</span>
<span class="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">trace</span><span class="p">,</span> <span class="n">data_context</span><span class="p">):</span>
<span class="c1"># process the data/trace here</span>
<span class="k">pass</span>
<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s1">&#39;__main__&#39;</span><span class="p">:</span>
<span class="n">_test_validate_standalone</span><span class="p">(</span><span class="n">PluginToTest</span><span class="p">,</span> <span class="s1">&#39;testdata/input&#39;</span><span class="p">,</span> <span class="s1">&#39;testdata/result&#39;</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="help">
<h2>Help<a class="headerlink" href="#help" title="Permalink to this heading"></a></h2>
<p>Run the following for an overview of all the available options in the test script:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>test_plugin --help
</pre></div>
</div>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="snippets.html" class="btn btn-neutral float-left" title="Python code snippets" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="hanskenpy.html" class="btn btn-neutral float-right" title="Run plugins with Hansken.py" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2020-2022 Netherlands Forensic Institute.</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>