Skip to content

Commit

Permalink
deploy: 7091038
Browse files Browse the repository at this point in the history
  • Loading branch information
aatmunbaxi committed Dec 25, 2023
1 parent 6707942 commit 922244a
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions _modules/orgroamtools/data.html
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,9 @@ <h1>Source code for orgroamtools.data</h1><div class="highlight"><pre>
<span class="n">data</span>
<span class="k">for</span> <span class="n">idx</span><span class="p">,</span> <span class="n">data</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span>
<span class="nb">zip</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">fnames</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">titles</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">IDs</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">titles</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">fnames</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_tags</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_links_to</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">misc_link_index</span><span class="o">.</span><span class="n">values</span><span class="p">(),</span>
Expand All @@ -519,21 +519,8 @@ <h1>Source code for orgroamtools.data</h1><div class="highlight"><pre>
<span class="n">new_node_index</span> <span class="o">=</span> <span class="p">{</span>
<span class="n">j</span><span class="p">[</span><span class="mi">2</span><span class="p">]:</span> <span class="n">RoamNode</span><span class="p">(</span><span class="n">j</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">j</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">j</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span> <span class="n">j</span><span class="p">[</span><span class="mi">3</span><span class="p">],</span> <span class="n">j</span><span class="p">[</span><span class="mi">4</span><span class="p">],</span> <span class="n">j</span><span class="p">[</span><span class="mi">5</span><span class="p">])</span> <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="n">new_node_data</span>
<span class="p">}</span>
<span class="c1"># _fnames = [j[0] for j in new_node_data]</span>
<span class="c1"># _titles = [j[1] for j in new_node_data]</span>
<span class="c1"># _ids = [j[2] for j in new_node_data]</span>
<span class="c1"># _tags = [j[3] for j in new_node_data]</span>
<span class="c1"># _links_to = [j[4] for j in new_node_data]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_node_index</span> <span class="o">=</span> <span class="n">new_node_index</span>
<span class="c1"># Should be true by definition...</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_orphans</span> <span class="o">=</span> <span class="p">[]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_is_connected</span> <span class="o">=</span> <span class="kc">True</span>

<span class="bp">self</span><span class="o">.</span><span class="n">db_path</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">db_path</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_graph</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">MultiDiGraph</span><span class="p">(</span>
<span class="p">{</span><span class="bp">self</span><span class="o">.</span><span class="n">IDs</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">_links_to</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="k">for</span> <span class="n">i</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="bp">self</span><span class="o">.</span><span class="n">IDs</span><span class="p">))}</span>
<span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_id_title_map</span> <span class="o">=</span> <span class="p">{</span><span class="bp">self</span><span class="o">.</span><span class="n">IDs</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">titles</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="k">for</span> <span class="n">i</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="bp">self</span><span class="o">.</span><span class="n">IDs</span><span class="p">))}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">refresh</span><span class="p">()</span>
<span class="k">return</span> <span class="bp">self</span></div>


Expand Down Expand Up @@ -939,9 +926,7 @@ <h1>Source code for orgroamtools.data</h1><div class="highlight"><pre>

<span class="bp">self</span><span class="o">.</span><span class="n">_id_title_map</span> <span class="o">=</span> <span class="p">{</span><span class="bp">self</span><span class="o">.</span><span class="n">IDs</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">titles</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="k">for</span> <span class="n">i</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="bp">self</span><span class="o">.</span><span class="n">IDs</span><span class="p">))}</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_graph</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">MultiDiGraph</span><span class="p">(</span>
<span class="p">{</span><span class="bp">self</span><span class="o">.</span><span class="n">IDs</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">backlink_index</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="k">for</span> <span class="n">i</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="bp">self</span><span class="o">.</span><span class="n">IDs</span><span class="p">))}</span>
<span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_graph</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">MultiDiGraph</span><span class="p">({</span><span class="n">node</span><span class="o">.</span><span class="n">id</span><span class="p">:</span> <span class="n">node</span><span class="o">.</span><span class="n">backlinks</span> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="p">})</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_orphans</span> <span class="o">=</span> <span class="p">[</span>
<span class="n">node</span>
Expand All @@ -954,6 +939,11 @@ <h1>Source code for orgroamtools.data</h1><div class="highlight"><pre>
<span class="p">]</span>
<span class="p">)</span>
<span class="p">]</span>

<span class="c1"># Refresh backlinks to exclude those that were removed</span>
<span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_node_index</span><span class="o">.</span><span class="n">values</span><span class="p">():</span>
<span class="n">node</span><span class="o">.</span><span class="n">backlinks</span> <span class="o">=</span> <span class="p">[</span><span class="n">ID</span> <span class="k">for</span> <span class="n">ID</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">backlinks</span> <span class="k">if</span> <span class="n">ID</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">IDs</span><span class="p">]</span>

<span class="bp">self</span><span class="o">.</span><span class="n">_is_connected</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_orphans</span> <span class="o">==</span> <span class="p">[]</span></div>


Expand Down

0 comments on commit 922244a

Please sign in to comment.