-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2518 from dushimsam/mutate-license-std-comment
feat(api): Add, Edit & toggle standard-license comment Reviewed-by: [email protected] Tested-by: [email protected]
- Loading branch information
0 parents
commit 1636286
Showing
11,357 changed files
with
1,029,000 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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/). |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 — 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> »</li> | ||
<li class="nav-item nav-item-1"><a href="../../index.html" accesskey="U">Module code</a> »</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">"""</span> | ||
<span class="sd">Copyright 2018 Gaurav Mishra <[email protected]></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">"""</span> | ||
|
||
<span class="n">__author__</span> <span class="o">=</span> <span class="s2">"Gaurav Mishra"</span> | ||
<span class="n">__email__</span> <span class="o">=</span> <span class="s2">"[email protected]"</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">'processed_text'</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">'The license list does not contain processed_text column.'</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">'</span><span class="se">\n</span><span class="s1">'</span><span class="p">,</span> <span class="s1">' '</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">'''</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"> '''</span> | ||
<span class="n">output</span> <span class="o">=</span> <span class="p">[]</span> | ||
<span class="k">if</span> <span class="s1">'processed_text'</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">'The license list does not contain processed_text column.'</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">'processed_text'</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">'shortname'</span><span class="p">]</span> <span class="o">!=</span> <span class="s1">'Void'</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">'shortname'</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> »</li> | ||
<li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> »</li> | ||
</ul> | ||
</div> | ||
<div class="footer" role="contentinfo"> | ||
© Copyright 2018, Aman Jain. | ||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.6. | ||
</div> | ||
</body> | ||
</html> |
Oops, something went wrong.