Skip to content

Commit 07be6ea

Browse files
committed
add render job wrapper
1 parent a6bae87 commit 07be6ea

File tree

12 files changed

+3742
-3303
lines changed

12 files changed

+3742
-3303
lines changed

coverage.txt

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
============================= test session starts ==============================
2-
platform darwin -- Python 3.9.7, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
2+
platform darwin -- Python 3.9.12, pytest-7.1.1, pluggy-1.0.0
33
rootdir: /Users/johnmount/Documents/work/wvpy/pkg
44
plugins: anyio-3.5.0, cov-3.0.0
55
collected 20 items
@@ -19,16 +19,26 @@ tests/test_stats1.py . [ 90%]
1919
tests/test_threshold_stats.py . [ 95%]
2020
tests/test_typs_in_frame.py . [100%]
2121

22-
---------- coverage: platform darwin, python 3.9.7-final-0 -----------
22+
=============================== warnings summary ===============================
23+
../../../../opt/anaconda3/envs/research_env/lib/python3.9/site-packages/seaborn/rcmod.py:82
24+
/Users/johnmount/opt/anaconda3/envs/research_env/lib/python3.9/site-packages/seaborn/rcmod.py:82: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
25+
if LooseVersion(mpl.__version__) >= "3.0":
26+
27+
../../../../opt/anaconda3/envs/research_env/lib/python3.9/site-packages/setuptools/_distutils/version.py:351
28+
/Users/johnmount/opt/anaconda3/envs/research_env/lib/python3.9/site-packages/setuptools/_distutils/version.py:351: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
29+
other = LooseVersion(other)
30+
31+
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
32+
33+
---------- coverage: platform darwin, python 3.9.12-final-0 ----------
2334
Name Stmts Miss Cover
2435
---------------------------------------------
2536
wvpy/__init__.py 3 0 100%
26-
wvpy/jtools.py 156 41 74%
37+
wvpy/jtools.py 178 58 67%
2738
wvpy/pysheet.py 89 89 0%
2839
wvpy/render_workbook.py 47 47 0%
2940
wvpy/util.py 321 7 98%
3041
---------------------------------------------
31-
TOTAL 616 184 70%
32-
42+
TOTAL 638 201 68%
3343

34-
============================= 20 passed in 13.17s ==============================
44+
======================= 20 passed, 2 warnings in 16.34s ========================

pkg/build/lib/wvpy/jtools.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,3 +276,44 @@ def render_as_html(
276276
raise caught
277277
if verbose:
278278
print(f'\tdone render_as_html "{html_name}" {datetime.datetime.now()}')
279+
280+
281+
class JTask:
282+
def __init__(
283+
self,
284+
sheet_name: str,
285+
output_suffix: Optional[str] = None,
286+
exclude_input: bool = True,
287+
init_code: Optional[str] = None,
288+
path_prefix: str = "",
289+
) -> None:
290+
assert isinstance(sheet_name, str)
291+
assert isinstance(output_suffix, (str, type(None)))
292+
assert isinstance(exclude_input, bool)
293+
assert isinstance(init_code, (str, type(None)))
294+
assert isinstance(path_prefix, str)
295+
self.sheet_name = sheet_name
296+
self.output_suffix = output_suffix
297+
self.exclude_input = exclude_input
298+
self.init_code = init_code
299+
self.path_prefix = path_prefix
300+
301+
def __str__(self) -> str:
302+
return f'JTask(sheet_name="{self.sheet_name}", output_suffix="{self.output_suffix}", exclude_input="{self.exclude_input}", init_code="""{self.init_code}""", path_prefix="{self.path_prefix}")'
303+
304+
def __repr__(self) -> str:
305+
return self.__str__()
306+
307+
308+
def job_fn(arg: JTask):
309+
assert isinstance(arg, JTask)
310+
# render notebook
311+
try:
312+
render_as_html(
313+
arg.path_prefix + arg.sheet_name,
314+
exclude_input=arg.exclude_input,
315+
output_suffix=arg.output_suffix,
316+
init_code=arg.init_code,
317+
)
318+
except Exception as e:
319+
print(f"{arg} caught {e}")
309 Bytes
Binary file not shown.

pkg/dist/wvpy-0.3.5.tar.gz

98.9 KB
Binary file not shown.

pkg/docs/search.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/docs/wvpy.html

Lines changed: 19 additions & 18 deletions
Large diffs are not rendered by default.

pkg/docs/wvpy/jtools.html

Lines changed: 824 additions & 626 deletions
Large diffs are not rendered by default.

pkg/docs/wvpy/pysheet.html

Lines changed: 226 additions & 225 deletions
Large diffs are not rendered by default.

pkg/docs/wvpy/render_workbook.html

Lines changed: 127 additions & 126 deletions
Large diffs are not rendered by default.

pkg/docs/wvpy/util.html

Lines changed: 2421 additions & 2301 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)