simple report automatic rendering
Project description
okreport: simple report automatic rendering
Installation
pip install python-okreport
Usage
from okreport import Var, Paragraph, Report
class ResultX(Var):
def parse(self, result, conf, env): # noqa
return result['x']
class ResultY(Var):
def parse(self, result, conf, env): # noqa
return result['y']
class ResultSum(Var):
def parse(self, result, conf, env): # noqa
return result['x'] + result['y']
class ConfX(Var):
def parse(self, result, conf, env): # noqa
return conf['x']
class ConfY(Var):
def parse(self, result, conf, env): # noqa
return conf['y']
class ConfSum(Var):
def parse(self, result, conf, env): # noqa
return conf['x'] + conf['y']
class ResultParagraph(Paragraph):
"""
In result, x = {{ x }}, y = {{ y }}, sum is {{ sum }}.
"""
x = ResultX()
y = ResultY()
sum = ResultSum()
def get_template_text(self, result, conf, env): # noqa
return self.__doc__
class ConfParagraph(Paragraph):
"""
In conf, x = {{ x }}, y = {{ y }}, sum is {{ sum }}.
"""
x = ConfX()
y = ConfY()
sum = ConfSum()
def get_template_text(self, result, conf, env): # noqa
return self.__doc__
class MyReport(Report):
"""
{{ p1 }}
{{ p2 }}
"""
p1 = ResultParagraph()
p2 = ConfParagraph()
def get_template_text(self, result, conf, env): # noqa
return self.__doc__
result = {'x': 1, 'y': 2}
conf = {'x': 3, 'y': 4}
my_report = MyReport()
text = my_report.render(result, conf, None)
print(text)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python-okreport-1.0.1.tar.gz
(3.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python-okreport-1.0.1.tar.gz.
File metadata
- Download URL: python-okreport-1.0.1.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
761f36548981d5669009df299e1c80ba5511ad00371aa149ff888d9d86664bc3
|
|
| MD5 |
68cf9365cfbeef81916578a764b5034e
|
|
| BLAKE2b-256 |
9555355d2edb4cd896e6658a73ae4e9c6ad2b286889f89e8a0ee30d4cb9c43f2
|
File details
Details for the file python_okreport-1.0.1-py2.py3-none-any.whl.
File metadata
- Download URL: python_okreport-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0137243282d3d28c9f3ebea619cfec8052b910feb172fe4110339846c21c98e8
|
|
| MD5 |
d0164781d5dbd45034f4edbf459b3054
|
|
| BLAKE2b-256 |
228b3fbf9afc1b116de84a4679f538563b18b2ea4907133773a93b05668c25ce
|