Skip to content

Commit

Permalink
Update docs build
Browse files Browse the repository at this point in the history
  • Loading branch information
eriknyquist committed Oct 10, 2022
1 parent a124591 commit 00e9143
Show file tree
Hide file tree
Showing 14 changed files with 142 additions and 56 deletions.
2 changes: 1 addition & 1 deletion docs/.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: 969a7c1f82f77cb00372609822dff72a
config: 75c02117e52037ae864e08b1ed0d2f3e
tags: 645f666f9bcd5a90fca523b33c5a78b7
4 changes: 2 additions & 2 deletions docs/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Overview: module code &mdash; versionedobj v1.0.2 documentation</title>
<title>Overview: module code &mdash; versionedobj v1.1.0 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand All @@ -27,7 +27,7 @@
<a href="../index.html" class="icon icon-home"> versionedobj
</a>
<div class="version">
v1.0.2
v1.1.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
Expand Down
4 changes: 2 additions & 2 deletions docs/_modules/versionedobj/exceptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>versionedobj.exceptions &mdash; versionedobj v1.0.2 documentation</title>
<title>versionedobj.exceptions &mdash; versionedobj v1.1.0 documentation</title>
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand All @@ -27,7 +27,7 @@
<a href="../../index.html" class="icon icon-home"> versionedobj
</a>
<div class="version">
v1.0.2
v1.1.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down
13 changes: 10 additions & 3 deletions docs/_modules/versionedobj/object.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>versionedobj.object &mdash; versionedobj v1.0.2 documentation</title>
<title>versionedobj.object &mdash; versionedobj v1.1.0 documentation</title>
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand All @@ -27,7 +27,7 @@
<a href="../../index.html" class="icon icon-home"> versionedobj
</a>
<div class="version">
v1.0.2
v1.1.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down Expand Up @@ -175,6 +175,7 @@ <h1>Source code for versionedobj.object</h1><div class="highlight"><pre>
<span class="sd"> :param dict: map of initial values. Keys are the field name, and values are\</span>
<span class="sd"> the initial values to set.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_vobj__field_count</span> <span class="o">=</span> <span class="mi">0</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_vobj__populate_instance</span><span class="p">()</span>

<span class="c1"># Set alternate initial values, if any</span>
Expand Down Expand Up @@ -234,6 +235,9 @@ <h1>Source code for versionedobj.object</h1><div class="highlight"><pre>
<span class="k">def</span> <span class="fm">__hash__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="nb">hash</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">_obj_to_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">)))</span>

<span class="k">def</span> <span class="fm">__len__</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">_vobj__field_count</span>

<span class="k">def</span> <span class="nf">_vobj__populate_instance</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">_iter_obj_attrs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">):</span>
<span class="n">val</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span>
Expand All @@ -250,6 +254,9 @@ <h1>Source code for versionedobj.object</h1><div class="highlight"><pre>
<span class="s2">&quot;Only the top-level object can have a version attribute.&quot;</span><span class="p">)</span>

<span class="n">val</span> <span class="o">=</span> <span class="n">vobj_class</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_vobj__field_count</span> <span class="o">+=</span> <span class="n">val</span><span class="o">.</span><span class="n">_vobj__field_count</span>
<span class="k">else</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_vobj__field_count</span> <span class="o">+=</span> <span class="mi">1</span>

<span class="nb">setattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">n</span><span class="p">,</span> <span class="n">val</span><span class="p">)</span>

Expand Down Expand Up @@ -297,7 +304,7 @@ <h1>Source code for versionedobj.object</h1><div class="highlight"><pre>

<span class="k">def</span> <span class="fm">__iter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">for</span> <span class="n">field</span> <span class="ow">in</span> <span class="n">_walk_obj_attrs</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">yield</span> <span class="p">(</span><span class="n">field</span><span class="o">.</span><span class="n">dot_name</span><span class="p">(),</span> <span class="n">field</span><span class="o">.</span><span class="n">get_obj_field</span><span class="p">(</span><span class="bp">self</span><span class="p">))</span></div>
<span class="k">yield</span> <span class="n">field</span><span class="o">.</span><span class="n">dot_name</span><span class="p">()</span></div>

<span class="n">_ObjField</span><span class="o">.</span><span class="n">set_obj_class</span><span class="p">(</span><span class="n">VersionedObject</span><span class="p">)</span>

Expand Down
35 changes: 32 additions & 3 deletions docs/_modules/versionedobj/serializer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>versionedobj.serializer &mdash; versionedobj v1.0.2 documentation</title>
<title>versionedobj.serializer &mdash; versionedobj v1.1.0 documentation</title>
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand All @@ -27,7 +27,7 @@
<a href="../../index.html" class="icon icon-home"> versionedobj
</a>
<div class="version">
v1.0.2
v1.1.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down Expand Up @@ -67,7 +67,9 @@
<div itemprop="articleBody">

<h1>Source code for versionedobj.serializer</h1><div class="highlight"><pre>
<span></span><span class="kn">import</span> <span class="nn">json</span>
<span></span><span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">inspect</span>
<span class="kn">import</span> <span class="nn">json</span>
<span class="kn">from</span> <span class="nn">json.decoder</span> <span class="kn">import</span> <span class="n">JSONDecodeError</span>

<span class="kn">from</span> <span class="nn">versionedobj.object</span> <span class="kn">import</span> <span class="n">VersionedObject</span><span class="p">,</span> <span class="n">CustomValue</span>
Expand Down Expand Up @@ -305,6 +307,33 @@ <h1>Source code for versionedobj.serializer</h1><div class="highlight"><pre>
<span class="sd"> :param obj: VersionedObject instance to reset</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">obj</span><span class="o">.</span><span class="n">_vobj__populate_instance</span><span class="p">()</span></div></div>


<div class="viewcode-block" id="FileLoader"><a class="viewcode-back" href="../../versionedobj.html#versionedobj.serializer.FileLoader">[docs]</a><span class="k">class</span> <span class="nc">FileLoader</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Context manager for modifying object data saved to a JSON file. Deserializes</span>
<span class="sd"> the object on entry, if it exists, allowing you to modify the deserialized object, and</span>
<span class="sd"> serializes the changed object data back to the same file on exit.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<div class="viewcode-block" id="FileLoader.__init__"><a class="viewcode-back" href="../../versionedobj.html#versionedobj.serializer.FileLoader.__init__">[docs]</a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">instance_or_class</span><span class="p">,</span> <span class="n">filename</span><span class="p">):</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">instance_or_class</span><span class="p">,</span> <span class="n">VersionedObject</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">obj</span> <span class="o">=</span> <span class="n">instance_or_class</span>
<span class="k">elif</span> <span class="n">inspect</span><span class="o">.</span><span class="n">isclass</span><span class="p">(</span><span class="n">instance_or_class</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">instance_or_class</span><span class="p">,</span> <span class="n">VersionedObject</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">obj</span> <span class="o">=</span> <span class="n">instance_or_class</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;First argument must be a VersionedObject instance or class object&quot;</span><span class="p">)</span>

<span class="bp">self</span><span class="o">.</span><span class="n">filename</span> <span class="o">=</span> <span class="n">filename</span>
<span class="bp">self</span><span class="o">.</span><span class="n">serializer</span> <span class="o">=</span> <span class="n">Serializer</span><span class="p">()</span></div>

<span class="k">def</span> <span class="fm">__enter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">filename</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">serializer</span><span class="o">.</span><span class="n">from_file</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">filename</span><span class="p">)</span>

<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span>

<span class="k">def</span> <span class="fm">__exit__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exc_type</span><span class="p">,</span> <span class="n">exc_value</span><span class="p">,</span> <span class="n">exc_traceback</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">serializer</span><span class="o">.</span><span class="n">to_file</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">filename</span><span class="p">)</span></div>
</pre></div>

</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: 'v1.0.2',
VERSION: 'v1.1.0',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
8 changes: 6 additions & 2 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index &mdash; versionedobj v1.0.2 documentation</title>
<title>Index &mdash; versionedobj v1.1.0 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand All @@ -27,7 +27,7 @@
<a href="index.html" class="icon icon-home"> versionedobj
</a>
<div class="version">
v1.0.2
v1.1.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
Expand Down Expand Up @@ -89,6 +89,8 @@ <h2 id="_">_</h2>

<ul>
<li><a href="versionedobj.html#versionedobj.object.VersionedObject.__init__">(versionedobj.object.VersionedObject method)</a>
</li>
<li><a href="versionedobj.html#versionedobj.serializer.FileLoader.__init__">(versionedobj.serializer.FileLoader method)</a>
</li>
<li><a href="versionedobj.html#versionedobj.serializer.Serializer.__init__">(versionedobj.serializer.Serializer method)</a>
</li>
Expand All @@ -115,6 +117,8 @@ <h2 id="C">C</h2>
<h2 id="F">F</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="versionedobj.html#versionedobj.serializer.FileLoader">FileLoader (class in versionedobj.serializer)</a>
</li>
<li><a href="versionedobj.html#versionedobj.object.CustomValue.from_dict">from_dict() (versionedobj.object.CustomValue method)</a>

<ul>
Expand Down
Loading

0 comments on commit 00e9143

Please sign in to comment.