Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pending] pyDKB: common/hdfs.py documentation #178

Open
wants to merge 6 commits into
base: pyDKB-master-merge
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source/pyDKB
build/latex
build/doctrees
38 changes: 38 additions & 0 deletions Docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = pyDKB
SOURCEDIR = source
BUILDDIR = build
APIDOC = sphinx-apidoc

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

all: pdf html ;

clean:
rm -rf build/
rm -rf source/pyDKB

pdf: latexpdf
mkdir -p build/pdf
cp build/latex/*.pdf build/pdf

source/pyDKB:
$(APIDOC) -T -f -M -e -o source/pyDKB ../Utils/Dataflow/pyDKB
for f in $$(ls source/pyDKB/*.rst); do \
refline=".. _$$(basename $${f%.rst}):" ;\
sed -i "1i$${refline}\n" $$f; \
done

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile source/pyDKB
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
4 changes: 4 additions & 0 deletions Docs/build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 2137cffcda4c730a4628593761b93693
tags: 645f666f9bcd5a90fca523b33c5a78b7
Empty file added Docs/build/html/.nojekyll
Empty file.
119 changes: 119 additions & 0 deletions Docs/build/html/_modules/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Overview: module code &#8212; Data Knowledge Base documentation</title>
<link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />

<link rel="stylesheet" href="../_static/custom.css" type="text/css" />


<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

</head><body>


<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">


<div class="body" role="main">

<h1>All modules for which code is available</h1>
<ul><li><a href="pyDKB/common/Type.html">pyDKB.common.Type</a></li>
<li><a href="pyDKB/common/custom_readline.html">pyDKB.common.custom_readline</a></li>
<li><a href="pyDKB/common/exceptions.html">pyDKB.common.exceptions</a></li>
<li><a href="pyDKB/common/hdfs.html">pyDKB.common.hdfs</a></li>
<li><a href="pyDKB/common/json_utils.html">pyDKB.common.json_utils</a></li>
<li><a href="pyDKB/dataflow/communication/consumer.html">pyDKB.dataflow.communication.consumer</a></li>
<ul><li><a href="pyDKB/dataflow/communication/consumer/Consumer.html">pyDKB.dataflow.communication.consumer.Consumer</a></li>
<li><a href="pyDKB/dataflow/communication/consumer/FileConsumer.html">pyDKB.dataflow.communication.consumer.FileConsumer</a></li>
<li><a href="pyDKB/dataflow/communication/consumer/HDFSConsumer.html">pyDKB.dataflow.communication.consumer.HDFSConsumer</a></li>
<li><a href="pyDKB/dataflow/communication/consumer/StreamConsumer.html">pyDKB.dataflow.communication.consumer.StreamConsumer</a></li>
</ul><li><a href="pyDKB/dataflow/communication/messages.html">pyDKB.dataflow.communication.messages</a></li>
<li><a href="pyDKB/dataflow/communication/producer.html">pyDKB.dataflow.communication.producer</a></li>
<ul><li><a href="pyDKB/dataflow/communication/producer/FileProducer.html">pyDKB.dataflow.communication.producer.FileProducer</a></li>
<li><a href="pyDKB/dataflow/communication/producer/HDFSProducer.html">pyDKB.dataflow.communication.producer.HDFSProducer</a></li>
<li><a href="pyDKB/dataflow/communication/producer/Producer.html">pyDKB.dataflow.communication.producer.Producer</a></li>
<li><a href="pyDKB/dataflow/communication/producer/StreamProducer.html">pyDKB.dataflow.communication.producer.StreamProducer</a></li>
</ul><li><a href="pyDKB/dataflow/communication/stream.html">pyDKB.dataflow.communication.stream</a></li>
<ul><li><a href="pyDKB/dataflow/communication/stream/InputStream.html">pyDKB.dataflow.communication.stream.InputStream</a></li>
<li><a href="pyDKB/dataflow/communication/stream/OutputStream.html">pyDKB.dataflow.communication.stream.OutputStream</a></li>
<li><a href="pyDKB/dataflow/communication/stream/Stream.html">pyDKB.dataflow.communication.stream.Stream</a></li>
<li><a href="pyDKB/dataflow/communication/stream/exceptions.html">pyDKB.dataflow.communication.stream.exceptions</a></li>
</ul><li><a href="pyDKB/dataflow/dkbID.html">pyDKB.dataflow.dkbID</a></li>
<li><a href="pyDKB/dataflow/exceptions.html">pyDKB.dataflow.exceptions</a></li>
<li><a href="pyDKB/dataflow/stage/AbstractStage.html">pyDKB.dataflow.stage.AbstractStage</a></li>
<li><a href="pyDKB/dataflow/stage/ProcessorStage.html">pyDKB.dataflow.stage.ProcessorStage</a></li>
</ul>

</div>

</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="../index.html">Data Knowledge Base</a></h1>








<h3>Navigation</h3>
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../pyDKB/pyDKB.html">pyDKB package</a></li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="../index.html">Documentation overview</a><ul>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2018, DKB team.

|
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.7.6</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.11</a>

</div>




</body>
</html>
172 changes: 172 additions & 0 deletions Docs/build/html/_modules/pyDKB/common/Type.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pyDKB.common.Type &#8212; Data Knowledge Base documentation</title>
<link rel="stylesheet" href="../../../_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />

<link rel="stylesheet" href="../../../_static/custom.css" type="text/css" />


<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

</head><body>


<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">


<div class="body" role="main">

<h1>Source code for pyDKB.common.Type</h1><div class="highlight"><pre>
<span></span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Abstract class for type definitions.</span>

<span class="sd">:Example:</span>

<span class="sd">&gt;&gt;&gt; myType = Type(&quot;Orange&quot;, &quot;Apple&quot;)</span>
<span class="sd">&gt;&gt;&gt; myType.add(&quot;Plum&quot;)</span>
<span class="sd">&gt;&gt;&gt; t = myType.Orange</span>
<span class="sd">&gt;&gt;&gt; if t == myType.Orange:</span>
<span class="sd">... print &quot;Orange!&quot;</span>
<span class="sd">... elif t == myType.member(&quot;Apple&quot;):</span>
<span class="sd">... print &quot;Apple!&quot;</span>
<span class="sd">...</span>
<span class="sd">Orange!</span>
<span class="sd">&gt;&gt;&gt; if not myType.member(&quot;Walnut&quot;):</span>
<span class="sd">... print &quot;Wrong type!&quot;</span>
<span class="sd">...</span>
<span class="sd">Wrong type!</span>
<span class="sd">&quot;&quot;&quot;</span>


<div class="viewcode-block" id="Type"><a class="viewcode-back" href="../../../pyDKB/pyDKB.common.Type.html#pyDKB.common.Type.Type">[docs]</a><span class="k">class</span> <span class="nc">Type</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Abstract class for type definitions.</span>

<span class="sd"> Member names (*str*) are passed to the constructor as positional arguments.</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Initialize Type object. &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ind</span> <span class="o">=</span> <span class="mi">1</span>
<span class="bp">self</span><span class="o">.</span><span class="n">hash</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span>

<div class="viewcode-block" id="Type.add"><a class="viewcode-back" href="../../../pyDKB/pyDKB.common.Type.html#pyDKB.common.Type.Type.add">[docs]</a> <span class="k">def</span> <span class="nf">add</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Add member.</span>

<span class="sd"> :param name: name of the member to be added</span>
<span class="sd"> :type name: str</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">ind</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">hash</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">ind</span><span class="p">]</span> <span class="o">=</span> <span class="n">name</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ind</span> <span class="o">+=</span> <span class="mi">1</span></div>

<div class="viewcode-block" id="Type.member"><a class="viewcode-back" href="../../../pyDKB/pyDKB.common.Type.html#pyDKB.common.Type.Type.member">[docs]</a> <span class="k">def</span> <span class="nf">member</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Check if the member exists (by name).</span>

<span class="sd"> :param name: name to be checked</span>
<span class="sd"> :type name: str</span>

<span class="sd"> :return: member value or False if member does not exist</span>
<span class="sd"> :rtype: int, bool</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span></div>

<div class="viewcode-block" id="Type.hasMember"><a class="viewcode-back" href="../../../pyDKB/pyDKB.common.Type.html#pyDKB.common.Type.Type.hasMember">[docs]</a> <span class="k">def</span> <span class="nf">hasMember</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">val</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Check if the member exists (by value).</span>

<span class="sd"> :param val: member to be checked</span>
<span class="sd"> :type val: int</span>

<span class="sd"> :return: True/False</span>
<span class="sd"> :rtype: bool</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">memberName</span><span class="p">(</span><span class="n">val</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">False</span></div>

<div class="viewcode-block" id="Type.memberName"><a class="viewcode-back" href="../../../pyDKB/pyDKB.common.Type.html#pyDKB.common.Type.Type.memberName">[docs]</a> <span class="k">def</span> <span class="nf">memberName</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">val</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Return string name of the member.</span>

<span class="sd"> :param val: member to retrieve name for</span>
<span class="sd"> :type val: int</span>

<span class="sd"> :return: member name of False if member does not exist</span>
<span class="sd"> :rtype: str, bool</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">hash</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">val</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span></div></div>
</pre></div>

</div>

</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="../../../index.html">Data Knowledge Base</a></h1>








<h3>Navigation</h3>
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../pyDKB/pyDKB.html">pyDKB package</a></li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="../../../index.html">Documentation overview</a><ul>
<li><a href="../../index.html">Module code</a><ul>
</ul></li>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2018, DKB team.

|
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.7.6</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.11</a>

</div>




</body>
</html>
Loading