Skip to content

Commit

Permalink
AlCatt91 published a site update
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCatt91 committed Sep 28, 2023
1 parent 7183d9b commit fad9f88
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion _modules/besskge/dataset.html
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,8 @@ <h1>Source code for besskge.dataset</h1><div class="highlight"><pre>
<span class="sd"> Path to output file.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">out_file</span><span class="p">,</span> <span class="s2">&quot;wb&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="n">pickle</span><span class="o">.</span><span class="n">dump</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">f</span><span class="p">)</span></div>
<span class="n">pickle</span><span class="o">.</span><span class="n">dump</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">f</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;KGDataset saved to </span><span class="si">{</span><span class="n">out_file</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span></div>

<div class="viewcode-block" id="KGDataset.load"><a class="viewcode-back" href="../../generated/besskge.dataset.KGDataset.html#besskge.dataset.KGDataset.load">[docs]</a> <span class="nd">@classmethod</span>
<span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="n">Path</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="s2">&quot;KGDataset&quot;</span><span class="p">:</span>
Expand All @@ -540,6 +541,7 @@ <h1>Source code for besskge.dataset</h1><div class="highlight"><pre>
<span class="n">kg_dataset</span> <span class="o">=</span> <span class="n">pickle</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">kg_dataset</span><span class="p">,</span> <span class="n">KGDataset</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;File at path </span><span class="si">{</span><span class="n">path</span><span class="si">}</span><span class="s2"> is not a KGDataset&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Loaded KGDataset at </span><span class="si">{</span><span class="n">path</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>

<span class="k">return</span> <span class="n">kg_dataset</span></div></div>
</pre></div>
Expand Down

0 comments on commit fad9f88

Please sign in to comment.