Skip to content

Commit

Permalink
Merge pull request #2785 from rajuljha/feat/nomos/add_byte_info_to_no…
Browse files Browse the repository at this point in the history
…mos_json_output

feat(nomos): Add start, end, len to nomos JSON output.

Reviewed-by: [email protected]
Tested-by: [email protected]
  • Loading branch information
github-actions[bot] committed Aug 2, 2024
0 parents commit ee08110
Show file tree
Hide file tree
Showing 11,752 changed files with 1,067,463 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Empty file added .nojekyll
Empty file.
339 changes: 339 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# FOSSology API
A static website to host API documents for [FOSSology](https://github.com/fossology/fossology)
generated using [Doxygen](https://www.stack.nl/~dimitri/doxygen/).
1,034 changes: 1,034 additions & 0 deletions annotated.html

Large diffs are not rendered by default.

1,031 changes: 1,031 additions & 0 deletions annotated_dup.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions atarashi/.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: 7bbb3f9dd87df593f38fc90425bdc0a0
tags: 645f666f9bcd5a90fca523b33c5a78b7
Empty file added atarashi/.nojekyll
Empty file.
153 changes: 153 additions & 0 deletions atarashi/_modules/atarashi/agents/atarashiAgent.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@

<!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>atarashi.agents.atarashiAgent &#8212; atarashi 0.0.9 documentation</title>
<link rel="stylesheet" href="../../../_static/nature.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" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">atarashi 0.0.9 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>

<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">

<h1>Source code for atarashi.agents.atarashiAgent</h1><div class="highlight"><pre>
<span class="ch">#!/usr/bin/python</span>
<span class="c1"># -*- coding: utf-8 -*-</span>

<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Copyright 2018 Gaurav Mishra &lt;[email protected]&gt;</span>

<span class="sd">This program is free software; you can redistribute it and/or</span>
<span class="sd">modify it under the terms of the GNU General Public License</span>
<span class="sd">version 2 as published by the Free Software Foundation.</span>
<span class="sd">This program is distributed in the hope that it will be useful,</span>
<span class="sd">but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span class="sd">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<span class="sd">GNU General Public License for more details.</span>

<span class="sd">You should have received a copy of the GNU General Public License along</span>
<span class="sd">with this program; if not, write to the Free Software Foundation, Inc.,</span>
<span class="sd">51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="n">__author__</span> <span class="o">=</span> <span class="s2">&quot;Gaurav Mishra&quot;</span>
<span class="n">__email__</span> <span class="o">=</span> <span class="s2">&quot;[email protected]&quot;</span>

<span class="kn">from</span> <span class="nn">abc</span> <span class="k">import</span> <span class="n">ABCMeta</span><span class="p">,</span> <span class="n">abstractmethod</span>

<span class="kn">from</span> <span class="nn">atarashi.libs.commentPreprocessor</span> <span class="k">import</span> <span class="n">CommentPreprocessor</span>
<span class="kn">from</span> <span class="nn">atarashi.license.licenseLoader</span> <span class="k">import</span> <span class="n">LicenseLoader</span>


<div class="viewcode-block" id="AtarashiAgent"><a class="viewcode-back" href="../../../source/atarashi.agents.atarashiAgent.html#atarashi.agents.atarashiAgent.AtarashiAgent">[docs]</a><span class="k">class</span> <span class="nc">AtarashiAgent</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="n">__metaclass__</span> <span class="o">=</span> <span class="n">ABCMeta</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="n">licenseList</span><span class="p">,</span> <span class="n">verbose</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">licenseList</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">licenseList</span> <span class="o">=</span> <span class="n">LicenseLoader</span><span class="o">.</span><span class="n">fetch_licenses</span><span class="p">(</span><span class="n">licenseList</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">licenseList</span> <span class="o">=</span> <span class="n">licenseList</span>
<span class="k">if</span> <span class="s1">&#39;processed_text&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">licenseList</span><span class="o">.</span><span class="n">columns</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;The license list does not contain processed_text column.&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">verbose</span> <span class="o">=</span> <span class="n">verbose</span>

<div class="viewcode-block" id="AtarashiAgent.loadFile"><a class="viewcode-back" href="../../../source/atarashi.agents.atarashiAgent.html#atarashi.agents.atarashiAgent.AtarashiAgent.loadFile">[docs]</a> <span class="k">def</span> <span class="nf">loadFile</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filePath</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">commentFile</span> <span class="o">=</span> <span class="n">CommentPreprocessor</span><span class="o">.</span><span class="n">extract</span><span class="p">(</span><span class="n">filePath</span><span class="p">)</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">commentFile</span><span class="p">)</span> <span class="k">as</span> <span class="n">file</span><span class="p">:</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">file</span><span class="o">.</span><span class="n">read</span><span class="p">()</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">&#39;</span><span class="p">,</span> <span class="s1">&#39; &#39;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">CommentPreprocessor</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span><span class="n">data</span><span class="p">)</span></div>

<div class="viewcode-block" id="AtarashiAgent.getVerbose"><a class="viewcode-back" href="../../../source/atarashi.agents.atarashiAgent.html#atarashi.agents.atarashiAgent.AtarashiAgent.getVerbose">[docs]</a> <span class="k">def</span> <span class="nf">getVerbose</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">verbose</span></div>

<div class="viewcode-block" id="AtarashiAgent.setVerbose"><a class="viewcode-back" href="../../../source/atarashi.agents.atarashiAgent.html#atarashi.agents.atarashiAgent.AtarashiAgent.setVerbose">[docs]</a> <span class="k">def</span> <span class="nf">setVerbose</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">verbose</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">verbose</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">verbose</span><span class="p">)</span></div>

<div class="viewcode-block" id="AtarashiAgent.scan"><a class="viewcode-back" href="../../../source/atarashi.agents.atarashiAgent.html#atarashi.agents.atarashiAgent.AtarashiAgent.scan">[docs]</a> <span class="nd">@abstractmethod</span>
<span class="k">def</span> <span class="nf">scan</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filePath</span><span class="p">):</span>
<span class="k">pass</span></div></div>


<div class="viewcode-block" id="exactMatcher"><a class="viewcode-back" href="../../../source/atarashi.agents.atarashiAgent.html#atarashi.agents.atarashiAgent.exactMatcher">[docs]</a><span class="k">def</span> <span class="nf">exactMatcher</span><span class="p">(</span><span class="n">licenseText</span><span class="p">,</span> <span class="n">licenses</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> :param licenseText: Processed and extracted input text</span>
<span class="sd"> :param licenses: Processed licenses pandas data frame</span>
<span class="sd"> :return: License short name if exact match is found else -1 if no match</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="n">output</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">if</span> <span class="s1">&#39;processed_text&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">licenses</span><span class="o">.</span><span class="n">columns</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;The license list does not contain processed_text column.&#39;</span><span class="p">)</span>

<span class="k">for</span> <span class="n">idx</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">licenses</span><span class="p">)):</span>
<span class="k">if</span> <span class="n">licenses</span><span class="o">.</span><span class="n">iloc</span><span class="p">[</span><span class="n">idx</span><span class="p">][</span><span class="s1">&#39;processed_text&#39;</span><span class="p">]</span> <span class="ow">in</span> <span class="n">licenseText</span> <span class="ow">and</span> <span class="n">licenses</span><span class="o">.</span><span class="n">iloc</span><span class="p">[</span><span class="n">idx</span><span class="p">][</span><span class="s1">&#39;shortname&#39;</span><span class="p">]</span> <span class="o">!=</span> <span class="s1">&#39;Void&#39;</span><span class="p">:</span>
<span class="n">output</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">licenses</span><span class="o">.</span><span class="n">iloc</span><span class="p">[</span><span class="n">idx</span><span class="p">][</span><span class="s1">&#39;shortname&#39;</span><span class="p">])</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">output</span><span class="p">:</span>
<span class="k">return</span> <span class="o">-</span><span class="mi">1</span>
<span class="k">return</span> <span class="n">output</span></div>
</pre></div>

</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<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="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">atarashi 0.0.9 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2018, Aman Jain.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.6.
</div>
</body>
</html>
Loading

0 comments on commit ee08110

Please sign in to comment.