Skip to content

Commit

Permalink
Deploying to gh-pages from main @ 2893482 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
rugeli committed Feb 22, 2024
1 parent 7d2b7dc commit cef08a1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions _modules/cellpack/autopack/DBRecipeHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ <h3>Navigation</h3>

<h1>Source code for cellpack.autopack.DBRecipeHandler</h1><div class="highlight"><pre>
<span></span><span class="kn">import</span> <span class="nn">copy</span>
<span class="kn">from</span> <span class="nn">enum</span> <span class="kn">import</span> <span class="n">Enum</span>

<span class="kn">from</span> <span class="nn">deepdiff</span> <span class="kn">import</span> <span class="n">DeepDiff</span>

Expand Down Expand Up @@ -523,6 +524,9 @@ <h1>Source code for cellpack.autopack.DBRecipeHandler</h1><div class="highlight"
<span class="n">modified_data</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">unpacked_value</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">unpacked_value</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
<span class="n">modified_data</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">DBUploader</span><span class="o">.</span><span class="n">prep_data_for_db</span><span class="p">(</span><span class="n">unpacked_value</span><span class="p">)</span>
<span class="c1"># If the value is an enum, convert it to a string. e.g. during a version migration process where &quot;type&quot; in a v1 recipe is an enum</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Enum</span><span class="p">):</span>
<span class="n">modified_data</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">name</span>
<span class="c1"># If the value is a dictionary, recursively convert its nested lists to dictionaries</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
<span class="n">modified_data</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">DBUploader</span><span class="o">.</span><span class="n">prep_data_for_db</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
Expand Down

0 comments on commit cef08a1

Please sign in to comment.