Skip to content

Commit 8fdcc50

Browse files
committed
Regenerate documentation
1 parent d53655b commit 8fdcc50

File tree

3 files changed

+50
-46
lines changed

3 files changed

+50
-46
lines changed

docs/logrun/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,8 @@ <h1 class="title">Package <code>logrun</code></h1>
4545
`logrun.utils`.
4646
&#34;&#34;&#34;
4747

48-
from logrun import utils
49-
from logrun import internals
5048

51-
52-
__version__ = &#39;0.1.1&#39;</code></pre>
49+
__version__ = &#39;0.1.3&#39;</code></pre>
5350
</details>
5451
</section>
5552
<section>

docs/logrun/internals.html

Lines changed: 43 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,6 @@ <h1 class="title">Module <code>logrun.internals</code></h1>
149149

150150
uuid: str
151151
&#34;&#34;&#34; The experiment&#39;s ID. &#34;&#34;&#34;
152-
rootpath: str
153-
&#34;&#34;&#34; Path where the experiment will be written to.
154-
155-
This is acquired via the `MICRLOG_ROOT` environment variable. &#34;&#34;&#34;
156152

157153
has_content: bool
158154
&#34;&#34;&#34; A member variable that tracks whether there is anything to log. &#34;&#34;&#34;
@@ -168,9 +164,6 @@ <h1 class="title">Module <code>logrun.internals</code></h1>
168164

169165
def __init__(self):
170166
self.uuid = str(uuid.uuid4())
171-
self.rootpath = os.environ.get(&#39;LOGRUN_ROOT&#39;)
172-
if self.rootpath is None:
173-
raise OSError(&#34;Environment variable &#39;LOGRUN_ROOT&#39; is not defined!&#34;)
174167

175168
self.has_content = False
176169
self.output_files = []
@@ -238,7 +231,7 @@ <h1 class="title">Module <code>logrun.internals</code></h1>
238231

239232
def save_experiment(self) -&gt; None:
240233
&#34;&#34;&#34;
241-
Save the experiment.
234+
Save the experiment to the path given by the `$LOGRUN_ROOT` environment variable.
242235
&#34;&#34;&#34;
243236

244237
from logrun import __version__
@@ -247,22 +240,31 @@ <h1 class="title">Module <code>logrun.internals</code></h1>
247240
self._cleanup()
248241
return
249242

243+
rootpath = os.environ.get(&#39;LOGRUN_ROOT&#39;)
244+
if rootpath is None:
245+
raise OSError(&#34;Environment variable &#39;LOGRUN_ROOT&#39; is not defined! Cannot save experiment.&#34;)
246+
250247
print(&#34;[Saving experiment: %s]&#34; % self.uuid)
251248

252249
experiment_path = \
253-
ensure_dir_exists(os.path.join(self.rootpath, &#39;all_experiments&#39;, self.uuid))
250+
ensure_dir_exists(os.path.join(rootpath, &#39;all_experiments&#39;, self.uuid))
254251
experiment_path_targz = experiment_path + &#39;.tar.gz&#39;
255252
experiment_by_outfile_path = \
256-
ensure_dir_exists(os.path.join(self.rootpath, &#39;experiments_by_output_file&#39;))
253+
ensure_dir_exists(os.path.join(rootpath, &#39;experiments_by_output_file&#39;))
257254
experiment_by_infile_path = \
258-
ensure_dir_exists(os.path.join(self.rootpath, &#39;experiments_by_input_file&#39;))
255+
ensure_dir_exists(os.path.join(rootpath, &#39;experiments_by_input_file&#39;))
259256
experiment_source_directory = ensure_dir_exists(os.path.join(experiment_path, &#39;source&#39;))
260257

261258
for module in sys.modules.values():
262259
if not module.__name__.startswith(&#39;src.&#39;):
263260
continue
264261

265-
source_file = inspect.getsourcefile(module)
262+
try:
263+
source_file = inspect.getsourcefile(module)
264+
except TypeError:
265+
# If we are here then this module doesn&#39;t have a corresponding source file
266+
# (or it&#39;s compiled).
267+
continue
266268

267269
if os.path.getmtime(source_file) &gt; start_timestamp:
268270
print(&#34;Warning: source file [%s] modified since start of program execution!&#34;)
@@ -482,10 +484,6 @@ <h3>Methods</h3>
482484

483485
uuid: str
484486
&#34;&#34;&#34; The experiment&#39;s ID. &#34;&#34;&#34;
485-
rootpath: str
486-
&#34;&#34;&#34; Path where the experiment will be written to.
487-
488-
This is acquired via the `MICRLOG_ROOT` environment variable. &#34;&#34;&#34;
489487

490488
has_content: bool
491489
&#34;&#34;&#34; A member variable that tracks whether there is anything to log. &#34;&#34;&#34;
@@ -501,9 +499,6 @@ <h3>Methods</h3>
501499

502500
def __init__(self):
503501
self.uuid = str(uuid.uuid4())
504-
self.rootpath = os.environ.get(&#39;LOGRUN_ROOT&#39;)
505-
if self.rootpath is None:
506-
raise OSError(&#34;Environment variable &#39;LOGRUN_ROOT&#39; is not defined!&#34;)
507502

508503
self.has_content = False
509504
self.output_files = []
@@ -571,7 +566,7 @@ <h3>Methods</h3>
571566

572567
def save_experiment(self) -&gt; None:
573568
&#34;&#34;&#34;
574-
Save the experiment.
569+
Save the experiment to the path given by the `$LOGRUN_ROOT` environment variable.
575570
&#34;&#34;&#34;
576571

577572
from logrun import __version__
@@ -580,22 +575,31 @@ <h3>Methods</h3>
580575
self._cleanup()
581576
return
582577

578+
rootpath = os.environ.get(&#39;LOGRUN_ROOT&#39;)
579+
if rootpath is None:
580+
raise OSError(&#34;Environment variable &#39;LOGRUN_ROOT&#39; is not defined! Cannot save experiment.&#34;)
581+
583582
print(&#34;[Saving experiment: %s]&#34; % self.uuid)
584583

585584
experiment_path = \
586-
ensure_dir_exists(os.path.join(self.rootpath, &#39;all_experiments&#39;, self.uuid))
585+
ensure_dir_exists(os.path.join(rootpath, &#39;all_experiments&#39;, self.uuid))
587586
experiment_path_targz = experiment_path + &#39;.tar.gz&#39;
588587
experiment_by_outfile_path = \
589-
ensure_dir_exists(os.path.join(self.rootpath, &#39;experiments_by_output_file&#39;))
588+
ensure_dir_exists(os.path.join(rootpath, &#39;experiments_by_output_file&#39;))
590589
experiment_by_infile_path = \
591-
ensure_dir_exists(os.path.join(self.rootpath, &#39;experiments_by_input_file&#39;))
590+
ensure_dir_exists(os.path.join(rootpath, &#39;experiments_by_input_file&#39;))
592591
experiment_source_directory = ensure_dir_exists(os.path.join(experiment_path, &#39;source&#39;))
593592

594593
for module in sys.modules.values():
595594
if not module.__name__.startswith(&#39;src.&#39;):
596595
continue
597596

598-
source_file = inspect.getsourcefile(module)
597+
try:
598+
source_file = inspect.getsourcefile(module)
599+
except TypeError:
600+
# If we are here then this module doesn&#39;t have a corresponding source file
601+
# (or it&#39;s compiled).
602+
continue
599603

600604
if os.path.getmtime(source_file) &gt; start_timestamp:
601605
print(&#34;Warning: source file [%s] modified since start of program execution!&#34;)
@@ -706,11 +710,6 @@ <h3>Class variables</h3>
706710
<dd>
707711
<div class="desc"><p>A list of files that the running script has produced as output.</p></div>
708712
</dd>
709-
<dt id="logrun.internals.Experiment.rootpath"><code class="name">var <span class="ident">rootpath</span> : str</code></dt>
710-
<dd>
711-
<div class="desc"><p>Path where the experiment will be written to.</p>
712-
<p>This is acquired via the <code>MICRLOG_ROOT</code> environment variable.</p></div>
713-
</dd>
714713
<dt id="logrun.internals.Experiment.uuid"><code class="name">var <span class="ident">uuid</span> : str</code></dt>
715714
<dd>
716715
<div class="desc"><p>The experiment's ID.</p></div>
@@ -796,14 +795,14 @@ <h3>Methods</h3>
796795
<span>def <span class="ident">save_experiment</span></span>(<span>self) ‑> NoneType</span>
797796
</code></dt>
798797
<dd>
799-
<div class="desc"><p>Save the experiment.</p></div>
798+
<div class="desc"><p>Save the experiment to the path given by the <code>$LOGRUN_ROOT</code> environment variable.</p></div>
800799
<details class="source">
801800
<summary>
802801
<span>Expand source code</span>
803802
</summary>
804803
<pre><code class="python">def save_experiment(self) -&gt; None:
805804
&#34;&#34;&#34;
806-
Save the experiment.
805+
Save the experiment to the path given by the `$LOGRUN_ROOT` environment variable.
807806
&#34;&#34;&#34;
808807

809808
from logrun import __version__
@@ -812,22 +811,31 @@ <h3>Methods</h3>
812811
self._cleanup()
813812
return
814813

814+
rootpath = os.environ.get(&#39;LOGRUN_ROOT&#39;)
815+
if rootpath is None:
816+
raise OSError(&#34;Environment variable &#39;LOGRUN_ROOT&#39; is not defined! Cannot save experiment.&#34;)
817+
815818
print(&#34;[Saving experiment: %s]&#34; % self.uuid)
816819

817820
experiment_path = \
818-
ensure_dir_exists(os.path.join(self.rootpath, &#39;all_experiments&#39;, self.uuid))
821+
ensure_dir_exists(os.path.join(rootpath, &#39;all_experiments&#39;, self.uuid))
819822
experiment_path_targz = experiment_path + &#39;.tar.gz&#39;
820823
experiment_by_outfile_path = \
821-
ensure_dir_exists(os.path.join(self.rootpath, &#39;experiments_by_output_file&#39;))
824+
ensure_dir_exists(os.path.join(rootpath, &#39;experiments_by_output_file&#39;))
822825
experiment_by_infile_path = \
823-
ensure_dir_exists(os.path.join(self.rootpath, &#39;experiments_by_input_file&#39;))
826+
ensure_dir_exists(os.path.join(rootpath, &#39;experiments_by_input_file&#39;))
824827
experiment_source_directory = ensure_dir_exists(os.path.join(experiment_path, &#39;source&#39;))
825828

826829
for module in sys.modules.values():
827830
if not module.__name__.startswith(&#39;src.&#39;):
828831
continue
829832

830-
source_file = inspect.getsourcefile(module)
833+
try:
834+
source_file = inspect.getsourcefile(module)
835+
except TypeError:
836+
# If we are here then this module doesn&#39;t have a corresponding source file
837+
# (or it&#39;s compiled).
838+
continue
831839

832840
if os.path.getmtime(source_file) &gt; start_timestamp:
833841
print(&#34;Warning: source file [%s] modified since start of program execution!&#34;)
@@ -957,7 +965,6 @@ <h4><code><a title="logrun.internals.Experiment" href="#logrun.internals.Experim
957965
<li><code><a title="logrun.internals.Experiment.input_files" href="#logrun.internals.Experiment.input_files">input_files</a></code></li>
958966
<li><code><a title="logrun.internals.Experiment.multiple" href="#logrun.internals.Experiment.multiple">multiple</a></code></li>
959967
<li><code><a title="logrun.internals.Experiment.output_files" href="#logrun.internals.Experiment.output_files">output_files</a></code></li>
960-
<li><code><a title="logrun.internals.Experiment.rootpath" href="#logrun.internals.Experiment.rootpath">rootpath</a></code></li>
961968
<li><code><a title="logrun.internals.Experiment.save_experiment" href="#logrun.internals.Experiment.save_experiment">save_experiment</a></code></li>
962969
<li><code><a title="logrun.internals.Experiment.uuid" href="#logrun.internals.Experiment.uuid">uuid</a></code></li>
963970
</ul>

docs/logrun/utils/general.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ <h1 class="title">Module <code>logrun.utils.general</code></h1>
9090

9191
path = os.path.abspath(path)
9292

93-
add_input_file(path)
93+
log_input_file(path)
9494

9595
return path
9696

@@ -107,9 +107,9 @@ <h1 class="title">Module <code>logrun.utils.general</code></h1>
107107
path = os.path.abspath(path)
108108

109109
if ensure_dir_exists:
110-
_ensure_dir_exists(path)
110+
_ensure_dir_exists(os.path.dirname(path))
111111

112-
add_output_file(path)
112+
log_output_file(path)
113113

114114
return path</code></pre>
115115
</details>
@@ -140,7 +140,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
140140

141141
path = os.path.abspath(path)
142142

143-
add_input_file(path)
143+
log_input_file(path)
144144

145145
return path</code></pre>
146146
</details>
@@ -227,9 +227,9 @@ <h2 class="section-title" id="header-functions">Functions</h2>
227227
path = os.path.abspath(path)
228228

229229
if ensure_dir_exists:
230-
_ensure_dir_exists(path)
230+
_ensure_dir_exists(os.path.dirname(path))
231231

232-
add_output_file(path)
232+
log_output_file(path)
233233

234234
return path</code></pre>
235235
</details>

0 commit comments

Comments
 (0)