Skip to content

Commit

Permalink
Deploying to gh-pages from main @ 467d341 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
rugeli committed Mar 21, 2024
1 parent c999dca commit 00ff12f
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 14 deletions.
4 changes: 2 additions & 2 deletions _modules/cellpack/autopack.html
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,8 @@ <h1>Source code for cellpack.autopack</h1><div class="highlight"><pre>
<span class="c1"># command example: `pack -r firebase:recipes/[FIREBASE-RECIPE-ID] -c [CONFIG-FILE-PATH]`</span>
<span class="k">if</span> <span class="n">database_name</span> <span class="o">==</span> <span class="s2">&quot;firebase&quot;</span><span class="p">:</span>
<span class="n">db</span> <span class="o">=</span> <span class="n">DATABASE_IDS</span><span class="o">.</span><span class="n">handlers</span><span class="p">()</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">database_name</span><span class="p">)</span>
<span class="n">db_handler</span> <span class="o">=</span> <span class="n">DBRecipeLoader</span><span class="p">(</span><span class="n">db</span><span class="p">)</span>
<span class="n">db_handler</span><span class="o">.</span><span class="n">validate_input_recipe_path</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span>
<span class="n">initialize_db</span> <span class="o">=</span> <span class="n">db</span><span class="p">()</span>
<span class="n">db_handler</span> <span class="o">=</span> <span class="n">DBRecipeLoader</span><span class="p">(</span><span class="n">initialize_db</span><span class="p">)</span>
<span class="n">recipe_id</span> <span class="o">=</span> <span class="n">file_path</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;/&quot;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
<span class="n">db_doc</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">db_handler</span><span class="o">.</span><span class="n">collect_docs_by_id</span><span class="p">(</span>
<span class="n">collection</span><span class="o">=</span><span class="s2">&quot;recipes&quot;</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">recipe_id</span>
Expand Down
15 changes: 9 additions & 6 deletions _modules/cellpack/autopack/FirebaseHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ <h1>Source code for cellpack.autopack.FirebaseHandler</h1><div class="highlight"
<span class="n">_initialized</span> <span class="o">=</span> <span class="kc">False</span>
<span class="n">_db</span> <span class="o">=</span> <span class="kc">None</span>

<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="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">default_db</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="c1"># check if firebase is already initialized</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">FirebaseHandler</span><span class="o">.</span><span class="n">_initialized</span><span class="p">:</span>
<span class="n">db_choice</span> <span class="o">=</span> <span class="n">FirebaseHandler</span><span class="o">.</span><span class="n">which_db</span><span class="p">()</span>
<span class="n">db_choice</span> <span class="o">=</span> <span class="n">FirebaseHandler</span><span class="o">.</span><span class="n">which_db</span><span class="p">(</span><span class="n">default_db</span><span class="o">=</span><span class="n">default_db</span><span class="p">)</span>
<span class="k">if</span> <span class="n">db_choice</span> <span class="o">==</span> <span class="s2">&quot;staging&quot;</span><span class="p">:</span>
<span class="n">cred</span> <span class="o">=</span> <span class="n">FirebaseHandler</span><span class="o">.</span><span class="n">get_staging_creds</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
Expand All @@ -81,14 +81,16 @@ <h1>Source code for cellpack.autopack.FirebaseHandler</h1><div class="highlight"
<div class="viewcode-block" id="FirebaseHandler.which_db">
<a class="viewcode-back" href="../../../cellpack.autopack.html#cellpack.autopack.FirebaseHandler.FirebaseHandler.which_db">[docs]</a>
<span class="nd">@staticmethod</span>
<span class="k">def</span> <span class="nf">which_db</span><span class="p">():</span>
<span class="k">def</span> <span class="nf">which_db</span><span class="p">(</span><span class="n">default_db</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="n">options</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;1&quot;</span><span class="p">:</span> <span class="s2">&quot;dev&quot;</span><span class="p">,</span> <span class="s2">&quot;2&quot;</span><span class="p">:</span> <span class="s2">&quot;staging&quot;</span><span class="p">}</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Choose database:&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">default_db</span> <span class="ow">in</span> <span class="n">options</span><span class="o">.</span><span class="n">values</span><span class="p">():</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Using </span><span class="si">{</span><span class="n">default_db</span><span class="si">}</span><span class="s2"> database -------------&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">default_db</span>
<span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">options</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;[</span><span class="si">{</span><span class="n">key</span><span class="si">}</span><span class="s2">] </span><span class="si">{</span><span class="n">value</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="n">choice</span> <span class="o">=</span> <span class="nb">input</span><span class="p">(</span><span class="s2">&quot;Enter number: &quot;</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Using </span><span class="si">{</span><span class="n">options</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">choice</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;dev&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2"> database -------------&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">options</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">choice</span><span class="p">,</span> <span class="s2">&quot;dev&quot;</span><span class="p">)</span> <span class="c1"># default to dev db</span></div>
<span class="k">return</span> <span class="n">options</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">choice</span><span class="p">,</span> <span class="s2">&quot;dev&quot;</span><span class="p">)</span> <span class="c1"># default to dev db for recipe uploads</span></div>


<div class="viewcode-block" id="FirebaseHandler.doc_to_dict">
Expand Down Expand Up @@ -186,12 +188,13 @@ <h1>Source code for cellpack.autopack.FirebaseHandler</h1><div class="highlight"
<span class="c1"># set override=True to refresh the .env file if softwares or tokens updated</span>
<span class="n">load_dotenv</span><span class="p">(</span><span class="n">dotenv_path</span><span class="o">=</span><span class="s2">&quot;./.env&quot;</span><span class="p">,</span> <span class="n">override</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="n">FIREBASE_TOKEN</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getenv</span><span class="p">(</span><span class="s2">&quot;FIREBASE_TOKEN&quot;</span><span class="p">)</span>
<span class="n">firebase_key</span> <span class="o">=</span> <span class="n">FIREBASE_TOKEN</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">&quot;</span><span class="se">\\</span><span class="s2">n&quot;</span><span class="p">,</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="n">FIREBASE_EMAIL</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getenv</span><span class="p">(</span><span class="s2">&quot;FIREBASE_EMAIL&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="p">{</span>
<span class="s2">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;service_account&quot;</span><span class="p">,</span>
<span class="s2">&quot;project_id&quot;</span><span class="p">:</span> <span class="s2">&quot;cell-pack-database&quot;</span><span class="p">,</span>
<span class="s2">&quot;client_email&quot;</span><span class="p">:</span> <span class="n">FIREBASE_EMAIL</span><span class="p">,</span>
<span class="s2">&quot;private_key&quot;</span><span class="p">:</span> <span class="n">FIREBASE_TOKEN</span><span class="p">,</span>
<span class="s2">&quot;private_key&quot;</span><span class="p">:</span> <span class="n">firebase_key</span><span class="p">,</span>
<span class="s2">&quot;token_uri&quot;</span><span class="p">:</span> <span class="s2">&quot;https://oauth2.googleapis.com/token&quot;</span><span class="p">,</span>
<span class="p">}</span></div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ <h1>Source code for cellpack.autopack.interface_objects.database_ids</h1><div cl
<span class="n">region_name</span><span class="o">=</span><span class="n">region_name</span><span class="p">,</span>
<span class="p">)</span>

<span class="k">def</span> <span class="nf">create_firebase_handler</span><span class="p">(</span><span class="n">default_db</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="k">return</span> <span class="n">FirebaseHandler</span><span class="p">(</span><span class="n">default_db</span><span class="o">=</span><span class="n">default_db</span><span class="p">)</span>

<span class="n">handlers_dict</span> <span class="o">=</span> <span class="p">{</span>
<span class="bp">cls</span><span class="o">.</span><span class="n">FIREBASE</span><span class="p">:</span> <span class="n">FirebaseHandler</span><span class="p">(),</span>
<span class="bp">cls</span><span class="o">.</span><span class="n">FIREBASE</span><span class="p">:</span> <span class="n">create_firebase_handler</span><span class="p">,</span>
<span class="bp">cls</span><span class="o">.</span><span class="n">AWS</span><span class="p">:</span> <span class="n">create_aws_handler</span><span class="p">,</span>
<span class="p">}</span>
<span class="k">return</span> <span class="n">handlers_dict</span></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1807,8 +1807,12 @@ <h1>Source code for cellpack.autopack.upy.simularium.simularium_helper</h1><div
<span class="nd">@staticmethod</span>
<span class="k">def</span> <span class="nf">store_metadata</span><span class="p">(</span><span class="n">file_name</span><span class="p">,</span> <span class="n">url</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="k">if</span> <span class="n">db</span> <span class="o">==</span> <span class="s2">&quot;firebase&quot;</span><span class="p">:</span>
<span class="n">db_handler</span> <span class="o">=</span> <span class="n">DBUploader</span><span class="p">(</span><span class="n">DATABASE_IDS</span><span class="o">.</span><span class="n">handlers</span><span class="p">()</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">db</span><span class="p">))</span>
<span class="n">db_handler</span><span class="o">.</span><span class="n">upload_result_metadata</span><span class="p">(</span><span class="n">file_name</span><span class="p">,</span> <span class="n">url</span><span class="p">)</span></div>
<span class="n">handler</span> <span class="o">=</span> <span class="n">DATABASE_IDS</span><span class="o">.</span><span class="n">handlers</span><span class="p">()</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">db</span><span class="p">)</span>
<span class="n">initialized_db</span> <span class="o">=</span> <span class="n">handler</span><span class="p">(</span>
<span class="n">default_db</span><span class="o">=</span><span class="s2">&quot;staging&quot;</span>
<span class="p">)</span> <span class="c1"># default to staging for metadata uploads</span>
<span class="n">db_uploader</span> <span class="o">=</span> <span class="n">DBUploader</span><span class="p">(</span><span class="n">initialized_db</span><span class="p">)</span>
<span class="n">db_uploader</span><span class="o">.</span><span class="n">upload_result_metadata</span><span class="p">(</span><span class="n">file_name</span><span class="p">,</span> <span class="n">url</span><span class="p">)</span></div>


<div class="viewcode-block" id="simulariumHelper.open_in_simularium">
Expand Down
4 changes: 2 additions & 2 deletions cellpack.autopack.html
Original file line number Diff line number Diff line change
Expand Up @@ -2975,7 +2975,7 @@ <h3>The Environment class<a class="headerlink" href="#the-environment-class" tit
<span id="cellpack-autopack-firebasehandler-module"></span><h2>cellpack.autopack.FirebaseHandler module<a class="headerlink" href="#module-cellpack.autopack.FirebaseHandler" title="Link to this heading">¶</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="cellpack.autopack.FirebaseHandler.FirebaseHandler">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cellpack.autopack.FirebaseHandler.</span></span><span class="sig-name descname"><span class="pre">FirebaseHandler</span></span><a class="reference internal" href="_modules/cellpack/autopack/FirebaseHandler.html#FirebaseHandler"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cellpack.autopack.FirebaseHandler.FirebaseHandler" title="Link to this definition">¶</a></dt>
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cellpack.autopack.FirebaseHandler.</span></span><span class="sig-name descname"><span class="pre">FirebaseHandler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">default_db</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cellpack/autopack/FirebaseHandler.html#FirebaseHandler"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cellpack.autopack.FirebaseHandler.FirebaseHandler" title="Link to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Retrieve data and perform common tasks when working with firebase.</p>
<dl class="py method">
Expand Down Expand Up @@ -3091,7 +3091,7 @@ <h3>The Environment class<a class="headerlink" href="#the-environment-class" tit

<dl class="py method">
<dt class="sig sig-object py" id="cellpack.autopack.FirebaseHandler.FirebaseHandler.which_db">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">which_db</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/cellpack/autopack/FirebaseHandler.html#FirebaseHandler.which_db"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cellpack.autopack.FirebaseHandler.FirebaseHandler.which_db" title="Link to this definition">¶</a></dt>
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">which_db</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">default_db</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cellpack/autopack/FirebaseHandler.html#FirebaseHandler.which_db"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cellpack.autopack.FirebaseHandler.FirebaseHandler.which_db" title="Link to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py method">
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 00ff12f

Please sign in to comment.