# Path: telethon_generator/utils.py
# def snake_to_camel_case(name, suffix=None):
#     # Courtesy of http://stackoverflow.com/a/31531797/4759433
#     result = re.sub(r'_([a-z])', lambda m: m.group(1).upper(), name)
#     result = result[:1].upper() + result[1:].replace('_', '')
#     return result + suffix if suffix else result


import functools
import os
import pathlib
import re
import shutil
from collections import defaultdict
from pathlib import Path
from ..docswriter import DocsWriter
from ..parsers import TLObject, Usability
from ..utils import snake_to_camel_case
                    docs.write('</details>')

            depth = '../' * (2 if tlobject.namespace else 1)
            docs.add_script(src='prependPath = "{}";'.format(depth))
            docs.add_script(path=paths['search.js'])
            docs.end_body()

    # Find all the available types (which are not the same as the constructors)
    # Each type has a list of constructors associated to it, hence is a map
    for t, cs in type_to_constructors.items():
        filename = _get_path_for_type(t)
        out_dir = filename.parent
        if out_dir:
            out_dir.mkdir(parents=True, exist_ok=True)

        # Since we don't have access to the full TLObject, split the type
        if '.' in t:
            namespace, name = t.split('.')
        else:
            namespace, name = None, t

        with DocsWriter(filename, _get_path_for_type) as docs:
            docs.write_head(title=snake_to_camel_case(name),
                            css_path=paths['css'],
                            default_css=paths['default_css'])

            docs.set_menu_separator(paths['arrow'])
            _build_menu(docs)

            # Main file title

# Path: telethon_generator/utils.py
# def snake_to_camel_case(name, suffix=None):
#     # Courtesy of http://stackoverflow.com/a/31531797/4759433
#     result = re.sub(r'_([a-z])', lambda m: m.group(1).upper(), name)
#     result = result[:1].upper() + result[1:].replace('_', '')
#     return result + suffix if suffix else result


# Path: telethon_generator/generators/docs.py
import functools
import os
import pathlib
import re
import shutil
from collections import defaultdict
from pathlib import Path
from ..docswriter import DocsWriter
from ..parsers import TLObject, Usability
from ..utils import snake_to_camel_case

                    docs.write('</details>')

            depth = '../' * (2 if tlobject.namespace else 1)
            docs.add_script(src='prependPath = "{}";'.format(depth))
            docs.add_script(path=paths['search.js'])
            docs.end_body()

    # Find all the available types (which are not the same as the constructors)
    # Each type has a list of constructors associated to it, hence is a map
    for t, cs in type_to_constructors.items():
        filename = _get_path_for_type(t)
        out_dir = filename.parent
        if out_dir:
            out_dir.mkdir(parents=True, exist_ok=True)

        # Since we don't have access to the full TLObject, split the type
        if '.' in t:
            namespace, name = t.split('.')
        else:
            namespace, name = None, t

        with DocsWriter(filename, _get_path_for_type) as docs:
            docs.write_head(title=snake_to_camel_case(name),
                            css_path=paths['css'],
                            default_css=paths['default_css'])

            docs.set_menu_separator(paths['arrow'])
            _build_menu(docs)

            # Main file title

            docs.write_title(snake_to_camel_case(name))