<commit_before>from collections import OrderedDict
import logging

from .renderer import Renderer
from great_expectations.render.types import (
    RenderedSectionContent,
    RenderedDocumentContent,
    RenderedHeaderContent, RenderedStringTemplateContent, RenderedTableContent, RenderedBulletListContent
)

from .call_to_action_renderer import CallToActionRenderer

logger = logging.getLogger(__name__)

# FIXME : This class needs to be rebuilt to accept SiteSectionIdentifiers as input.
# FIXME : This class needs tests.
class SiteIndexPageRenderer(Renderer):

    @classmethod
    def _generate_links_table_rows(cls, index_links_dict, link_list_keys_to_render):
        section_rows = []

        column_count = len(link_list_keys_to_render)
        profiling_links = index_links_dict.get("profiling_links")
        validations_links = index_links_dict.get("validations_links")
        expectations_links = index_links_dict.get("expectations_links")

        cell_width_pct = 100.0/(column_count)

        if "expectations_links" in link_list_keys_to_render:
            for expectation_suite_link_dict in expectations_links:
                expectation_suite_row = []
                expectation_suite_name = expectation_suite_link_dict["expectation_suite_name"]

                expectation_suite_link = RenderedStringTemplateContent(**{
                    "content_block_type": "string_template",
                    "string_template": {
                        "template": "$link_text",
                        "params": {
                            "link_text": expectation_suite_name
                        },
                        "tag": "a",
                        "styling": {
                            "attributes": {<commit_msg>Add conditional to prevent 0 division<commit_after>from collections import OrderedDict
import logging

from .renderer import Renderer
from great_expectations.render.types import (
    RenderedSectionContent,
    RenderedDocumentContent,
    RenderedHeaderContent, RenderedStringTemplateContent, RenderedTableContent, RenderedBulletListContent
)

from .call_to_action_renderer import CallToActionRenderer

logger = logging.getLogger(__name__)

# FIXME : This class needs to be rebuilt to accept SiteSectionIdentifiers as input.
# FIXME : This class needs tests.
class SiteIndexPageRenderer(Renderer):

    @classmethod
    def _generate_links_table_rows(cls, index_links_dict, link_list_keys_to_render):
        section_rows = []

        column_count = len(link_list_keys_to_render)
        profiling_links = index_links_dict.get("profiling_links")
        validations_links = index_links_dict.get("validations_links")
        expectations_links = index_links_dict.get("expectations_links")

        if column_count:
            cell_width_pct = 100.0/column_count

        if "expectations_links" in link_list_keys_to_render:
            for expectation_suite_link_dict in expectations_links:
                expectation_suite_row = []
                expectation_suite_name = expectation_suite_link_dict["expectation_suite_name"]

                expectation_suite_link = RenderedStringTemplateContent(**{
                    "content_block_type": "string_template",
                    "string_template": {
                        "template": "$link_text",
                        "params": {
                            "link_text": expectation_suite_name
                        },
                        "tag": "a",
                        "styling": {
                            "attributes": {
{'fraction_non_alphanumeric': 0.06666666666666667, 'fraction_numerical': 0.002531645569620253, 'mean_word_length': 2.6285714285714286, 'pattern_counts': {'":': 16, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '936258', 'n_tokens_mistral': 942, 'n_tokens_neox': 901, 'n_words': 177}