<commit_before># vim:ts=4:sts=4:sw=4:expandtab

from   django.core.management.base import BaseCommand, CommandError
import os
from   sphinx.application import Sphinx
import sphinx.ext.autodoc
import shutil
import sys

from satori.ars.model import *

from docutils import nodes
from sphinx import addnodes
from sphinx.domains import Domain, ObjType, BUILTIN_DOMAINS 
from sphinx.directives import ObjectDescription
from sphinx.roles import XRefRole
from sphinx.util.nodes import make_refnode


atomic_type_names = {
    ArsBoolean: 'bool',
    ArsInt8:    'byte',
    ArsInt16:   'i16',
    ArsInt32:   'i32',
    ArsInt64:   'i64',
    ArsFloat:   'double',
    ArsString:  'string',
    ArsVoid:    'void',
}


def gen_type_node(node, type):
    if isinstance(type, ArsAtomicType):
        node += nodes.literal(atomic_type_names[type], atomic_type_names[type])
    elif isinstance(type, ArsList):
        node += nodes.literal('list', 'list')
        node += nodes.Text('<')
        gen_type_node(node, type.element_type)
        node += nodes.Text('>')
    elif isinstance(type, ArsMap):
        node += nodes.literal('map', 'map')
        node += nodes.Text('<')
        gen_type_node(node, type.key_type)
        node += nodes.Text(',')<commit_msg>Fixed gendoc.<commit_after># vim:ts=4:sts=4:sw=4:expandtab

from   django.core.management.base import BaseCommand, CommandError
import os
from   sphinx.application import Sphinx
import sphinx.ext.autodoc
import shutil
import sys

from satori.ars.model import *

from docutils import nodes
from sphinx import addnodes
from sphinx.domains import Domain, ObjType, BUILTIN_DOMAINS 
from sphinx.directives import ObjectDescription
from sphinx.roles import XRefRole
from sphinx.util.nodes import make_refnode


atomic_type_names = {
    ArsBinary:  'binary',
    ArsBoolean: 'bool',
    ArsInt8:    'byte',
    ArsInt16:   'i16',
    ArsInt32:   'i32',
    ArsInt64:   'i64',
    ArsFloat:   'double',
    ArsString:  'string',
    ArsVoid:    'void',
}


def gen_type_node(node, type):
    if isinstance(type, ArsAtomicType):
        node += nodes.literal(atomic_type_names[type], atomic_type_names[type])
    elif isinstance(type, ArsList):
        node += nodes.literal('list', 'list')
        node += nodes.Text('<')
        gen_type_node(node, type.element_type)
        node += nodes.Text('>')
    elif isinstance(type, ArsMap):
        node += nodes.literal('map', 'map')
        node += nodes.Text('<')
        gen_type_node(node, type.key_type)
        node += nodes.Text(',')
{'fraction_non_alphanumeric': 0.11966824644549763, 'fraction_numerical': 0.01263823064770932, 'mean_word_length': 3.555755395683453, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '5708460', 'n_tokens_mistral': 888, 'n_tokens_neox': 861, 'n_words': 198}