Skip to content

Commit

Permalink
v0.7.5 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed Aug 11, 2014
1 parent 2e09b02 commit 778a532
Show file tree
Hide file tree
Showing 42 changed files with 943 additions and 276 deletions.
2 changes: 1 addition & 1 deletion custodian/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__author__ = "Shyue Ping Ong, William Davidson Richards, Stephen Dacek, " \
"Xiaohui Qu"
__date__ = "Jul 14 2014"
__version__ = "0.7.4"
__version__ = "0.7.5"

from custodian import Custodian
1 change: 0 additions & 1 deletion custodian/vasp/tests/test_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ def tearDownClass(cls):

class BadVasprunXMLHandlerTest(unittest.TestCase):


def test_check_and_correct(self):
os.chdir(os.path.join(test_dir, "bad_vasprun"))
h = BadVasprunXMLHandler()
Expand Down
Binary file modified docs/_build/doctrees/custodian.ansible.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/custodian.nwchem.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/custodian.qchem.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/custodian.vasp.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/index.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/modules.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/_build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +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: ce604e9da68f63aa2c1f3752b4718248
config: 027556057d184ab38babdd14d30b0a67
tags: 645f666f9bcd5a90fca523b33c5a78b7
10 changes: 5 additions & 5 deletions docs/_build/html/_modules/custodian/ansible/actions.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>custodian.ansible.actions &mdash; custodian 0.7.4 documentation</title>
<title>custodian.ansible.actions &mdash; custodian 0.7.5 documentation</title>

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

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '0.7.4',
VERSION: '0.7.5',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
Expand All @@ -24,7 +24,7 @@
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
<link rel="top" title="custodian 0.7.4 documentation" href="../../../index.html" />
<link rel="top" title="custodian 0.7.5 documentation" href="../../../index.html" />
<link rel="up" title="Module code" href="../../index.html" />

<script type="text/javascript">
Expand All @@ -44,7 +44,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">custodian 0.7.4 documentation</a> &raquo;</li>
<li><a href="../../../index.html">custodian 0.7.5 documentation</a> &raquo;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &raquo;</li>
</ul>
</div>
Expand Down Expand Up @@ -310,7 +310,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">custodian 0.7.4 documentation</a> &raquo;</li>
<li><a href="../../../index.html">custodian 0.7.5 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
</ul>
</div>
Expand Down
10 changes: 5 additions & 5 deletions docs/_build/html/_modules/custodian/ansible/intepreter.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>custodian.ansible.intepreter &mdash; custodian 0.7.4 documentation</title>
<title>custodian.ansible.intepreter &mdash; custodian 0.7.5 documentation</title>

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

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '0.7.4',
VERSION: '0.7.5',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
Expand All @@ -24,7 +24,7 @@
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
<link rel="top" title="custodian 0.7.4 documentation" href="../../../index.html" />
<link rel="top" title="custodian 0.7.5 documentation" href="../../../index.html" />
<link rel="up" title="Module code" href="../../index.html" />

<script type="text/javascript">
Expand All @@ -44,7 +44,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">custodian 0.7.4 documentation</a> &raquo;</li>
<li><a href="../../../index.html">custodian 0.7.5 documentation</a> &raquo;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &raquo;</li>
</ul>
</div>
Expand Down Expand Up @@ -190,7 +190,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">custodian 0.7.4 documentation</a> &raquo;</li>
<li><a href="../../../index.html">custodian 0.7.5 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
</ul>
</div>
Expand Down
217 changes: 217 additions & 0 deletions docs/_build/html/_modules/custodian/ansible/interpreter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
<!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="Content-Type" content="text/html; charset=utf-8" />

<title>custodian.ansible.interpreter &mdash; custodian 0.7.5 documentation</title>

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

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '0.7.5',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</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="shortcut icon" href="../../../_static/favicon.ico"/>
<link rel="top" title="custodian 0.7.5 documentation" href="../../../index.html" />
<link rel="up" title="Module code" href="../../index.html" />

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-39574369-1']);
_gaq.push(['_trackPageview']);
</script>

</head>
<body>
<div class="related">
<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><a href="../../../index.html">custodian 0.7.5 documentation</a> &raquo;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &raquo;</li>
</ul>
</div>

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

<h1>Source code for custodian.ansible.interpreter</h1><div class="highlight"><pre>
<span class="c">#!/usr/bin/env python</span>

<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">This module implements a Modder class that performs modifications on objects</span>
<span class="sd">using support actions.</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">division</span>

<span class="n">__author__</span> <span class="o">=</span> <span class="s">&quot;Shyue Ping Ong&quot;</span>
<span class="n">__copyright__</span> <span class="o">=</span> <span class="s">&quot;Copyright 2012, The Materials Project&quot;</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="s">&quot;0.1&quot;</span>
<span class="n">__maintainer__</span> <span class="o">=</span> <span class="s">&quot;Shyue Ping Ong&quot;</span>
<span class="n">__email__</span> <span class="o">=</span> <span class="s">&quot;ongsp@ucsd.edu&quot;</span>
<span class="n">__date__</span> <span class="o">=</span> <span class="s">&quot;Jun 1, 2012&quot;</span>


<span class="kn">import</span> <span class="nn">re</span>

<span class="kn">from</span> <span class="nn">custodian.ansible.actions</span> <span class="kn">import</span> <span class="n">DictActions</span>


<div class="viewcode-block" id="Modder"><a class="viewcode-back" href="../../../custodian.ansible.html#custodian.ansible.interpreter.Modder">[docs]</a><span class="k">class</span> <span class="nc">Modder</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Class to modify a dict/file/any object using a mongo-like language.</span>
<span class="sd"> Keywords are mostly adopted from mongo&#39;s syntax, but instead of $, an</span>
<span class="sd"> underscore precedes action keywords. This is so that the modification can</span>
<span class="sd"> be inserted into a mongo db easily.</span>

<span class="sd"> Allowable actions are supplied as a list of classes as an argument. Refer</span>
<span class="sd"> to the action classes on what the actions do. Action classes are in</span>
<span class="sd"> pymatpro.ansible.actions.</span>

<span class="sd"> Examples:</span>
<span class="sd"> &gt;&gt;&gt; modder = Modder()</span>
<span class="sd"> &gt;&gt;&gt; d = {&quot;Hello&quot;: &quot;World&quot;}</span>
<span class="sd"> &gt;&gt;&gt; mod = {&#39;_set&#39;: {&#39;Hello&#39;:&#39;Universe&#39;, &#39;Bye&#39;: &#39;World&#39;}}</span>
<span class="sd"> &gt;&gt;&gt; modder.modify(mod, d)</span>
<span class="sd"> &gt;&gt;&gt; d[&#39;Bye&#39;]</span>
<span class="sd"> &#39;World&#39;</span>
<span class="sd"> &gt;&gt;&gt; d[&#39;Hello&#39;]</span>
<span class="sd"> &#39;Universe&#39;</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="n">actions</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">strict</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Initializes a Modder from a list of supported actions.</span>

<span class="sd"> Args:</span>
<span class="sd"> actions ([Action]): A sequence of supported actions. See</span>
<span class="sd"> :mod:`custodian.ansible.actions`. Default is None,</span>
<span class="sd"> which means only DictActions are supported.</span>
<span class="sd"> strict (bool): Indicating whether to use strict mode. In non-strict</span>
<span class="sd"> mode, unsupported actions are simply ignored without any</span>
<span class="sd"> errors raised. In strict mode, if an unsupported action is</span>
<span class="sd"> supplied, a ValueError is raised. Defaults to True.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">supported_actions</span> <span class="o">=</span> <span class="p">{}</span>
<span class="n">actions</span> <span class="o">=</span> <span class="n">actions</span> <span class="k">if</span> <span class="n">actions</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="k">else</span> <span class="p">[</span><span class="n">DictActions</span><span class="p">]</span>
<span class="k">for</span> <span class="n">action</span> <span class="ow">in</span> <span class="n">actions</span><span class="p">:</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">dir</span><span class="p">(</span><span class="n">action</span><span class="p">):</span>
<span class="k">if</span> <span class="p">(</span><span class="ow">not</span> <span class="n">re</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="s">&#39;__\w+__&#39;</span><span class="p">,</span> <span class="n">i</span><span class="p">))</span> <span class="ow">and</span> \
<span class="nb">callable</span><span class="p">(</span><span class="nb">getattr</span><span class="p">(</span><span class="n">action</span><span class="p">,</span> <span class="n">i</span><span class="p">)):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">supported_actions</span><span class="p">[</span><span class="s">&quot;_&quot;</span> <span class="o">+</span> <span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">action</span><span class="p">,</span> <span class="n">i</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">strict</span> <span class="o">=</span> <span class="n">strict</span>

<div class="viewcode-block" id="Modder.modify"><a class="viewcode-back" href="../../../custodian.ansible.html#custodian.ansible.interpreter.Modder.modify">[docs]</a> <span class="k">def</span> <span class="nf">modify</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">modification</span><span class="p">,</span> <span class="n">obj</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Note that modify makes actual in-place modifications. It does not</span>
<span class="sd"> return a copy.</span>

<span class="sd"> Args:</span>
<span class="sd"> modification (dict): Modification must be {action_keyword :</span>
<span class="sd"> settings}. E.g., {&#39;_set&#39;: {&#39;Hello&#39;:&#39;Universe&#39;, &#39;Bye&#39;: &#39;World&#39;}}</span>
<span class="sd"> obj (dict/str/object): Object to modify depending on actions. For</span>
<span class="sd"> example, for DictActions, obj will be a dict to be modified.</span>
<span class="sd"> For FileActions, obj will be a string with a full pathname to a</span>
<span class="sd"> file.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">for</span> <span class="n">action</span><span class="p">,</span> <span class="n">settings</span> <span class="ow">in</span> <span class="n">modification</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="k">if</span> <span class="n">action</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">supported_actions</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">supported_actions</span><span class="p">[</span><span class="n">action</span><span class="p">]</span><span class="o">.</span><span class="n">__call__</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">settings</span><span class="p">)</span>
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">strict</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;{} is not a supported action!&quot;</span>
<span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">action</span><span class="p">))</span>
</div>
<div class="viewcode-block" id="Modder.modify_object"><a class="viewcode-back" href="../../../custodian.ansible.html#custodian.ansible.interpreter.Modder.modify_object">[docs]</a> <span class="k">def</span> <span class="nf">modify_object</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">modification</span><span class="p">,</span> <span class="n">obj</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Modify an object that supports pymatgen&#39;s to_dict and from_dict API.</span>

<span class="sd"> Args:</span>
<span class="sd"> modification (dict): Modification must be {action_keyword :</span>
<span class="sd"> settings}. E.g., {&#39;_set&#39;: {&#39;Hello&#39;:&#39;Universe&#39;, &#39;Bye&#39;: &#39;World&#39;}}</span>
<span class="sd"> obj (object): Object to modify</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">d</span> <span class="o">=</span> <span class="n">obj</span><span class="o">.</span><span class="n">to_dict</span>
<span class="bp">self</span><span class="o">.</span><span class="n">modify</span><span class="p">(</span><span class="n">modification</span><span class="p">,</span> <span class="n">d</span><span class="p">)</span>
<span class="k">return</span> <span class="n">obj</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">d</span><span class="p">)</span>

</div></div>
<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span>
<span class="kn">import</span> <span class="nn">doctest</span>
<span class="n">doctest</span><span class="o">.</span><span class="n">testmod</span><span class="p">()</span>
</pre></div>

</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<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>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<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><a href="../../../index.html">custodian 0.7.5 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
</ul>
</div>

<div class="footer">
&copy; Copyright 2013, Shyue Ping Ong, William Davidson Richards, Stephen Dacek, Xiaohui Qu.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
<div class="footer">This page uses <a href="http://analytics.google.com/">
Google Analytics</a> to collect statistics. You can disable it by blocking
the JavaScript coming from www.google-analytics.com.
<script type="text/javascript">
(function() {
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ?
'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
document.documentElement.firstChild.appendChild(ga);
})();
</script>
</div>

</body>
</html>
Loading

0 comments on commit 778a532

Please sign in to comment.