Content
analora.content ¶
Contain HTML content generators.
analora.content.BaseContentGenerator ¶
Bases: ABC
Define the base class to implement a HTML Content Generator.
Example usage:
>>> from analora.content import ContentGenerator
>>> content = ContentGenerator("meow")
>>> content
ContentGenerator()
analora.content.BaseContentGenerator.compute
abstractmethod
¶
compute() -> BaseContentGenerator
Compute the content and return a new content generator.
Returns:
Type | Description |
---|---|
BaseContentGenerator
|
A new content generator with the computed content. |
Example usage:
>>> from analora.content import ContentGenerator
>>> content = ContentGenerator("meow")
>>> content
ContentGenerator()
>>> content2 = content.compute()
>>> content2
ContentGenerator()
analora.content.BaseContentGenerator.equal
abstractmethod
¶
equal(other: Any, equal_nan: bool = False) -> bool
Indicate if two content generators are equal or not.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other
|
Any
|
The other content generator to compare. |
required |
equal_nan
|
bool
|
Whether to compare NaN's as equal. If |
False
|
Returns:
Type | Description |
---|---|
bool
|
|
Example usage:
>>> from analora.content import ContentGenerator
>>> content1 = ContentGenerator("meow")
>>> content2 = ContentGenerator("meow")
>>> content3 = ContentGenerator("hello")
>>> content1.equal(content2)
True
>>> content1.equal(content3)
False
analora.content.BaseContentGenerator.generate_body
abstractmethod
¶
generate_body(
number: str = "",
tags: Sequence[str] = (),
depth: int = 0,
) -> str
Return the HTML body associated to the content.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
number
|
str
|
The section number, if any. |
''
|
tags
|
Sequence[str]
|
The tags associated to the content section, if any. |
()
|
depth
|
int
|
The depth in the content section, if any. |
0
|
Returns:
Type | Description |
---|---|
str
|
The HTML body associated to the content section. |
Example usage:
>>> from analora.content import ContentGenerator
>>> content = ContentGenerator("meow")
>>> content.generate_body()
analora.content.BaseContentGenerator.generate_toc
abstractmethod
¶
generate_toc(
number: str = "",
tags: Sequence[str] = (),
depth: int = 0,
max_depth: int = 1,
) -> str
Return the HTML table of content (TOC) associated to the section.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
number
|
str
|
The section number associated to the section, if any. |
''
|
tags
|
Sequence[str]
|
The tags associated to the section, if any. |
()
|
depth
|
int
|
The depth in the report, if any. |
0
|
max_depth
|
int
|
The maximum depth to generate in the TOC. |
1
|
Returns:
Type | Description |
---|---|
str
|
The HTML table of content associated to the section. |
Example usage:
>>> from analora.content import ContentGenerator
>>> content = ContentGenerator("meow")
>>> content.generate_toc()
analora.content.BaseSectionContentGenerator ¶
Bases: BaseContentGenerator
Define a base class to implement a section content generator.
Example usage:
>>> from analora.content import ContentGenerator
>>> generator = ContentGenerator("meow")
>>> generator
ContentGenerator()
>>> generator.generate_content()
'meow'
analora.content.BaseSectionContentGenerator.generate_content
abstractmethod
¶
generate_content() -> str
Return the section content without the tags.
Returns:
Type | Description |
---|---|
str
|
The content without the tags. |
analora.content.ContentGenerator ¶
Bases: BaseSectionContentGenerator
Implement a section that analyze accuracy states.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
content
|
str
|
The HTML content. |
''
|
Example usage:
>>> import numpy as np
>>> from analora.content import ContentGenerator
>>> generator = ContentGenerator("meow")
>>> generator
ContentGenerator()
>>> generator.generate_content()
'meow'