<commit_before># -*- coding: utf-8 -*-
import logging
import httplib as http
import datetime

import framework
from framework import Q, request, redirect, get_current_user
from framework.exceptions import HTTPError
from framework.auth import must_have_session_auth
from framework.forms import utils
from framework.auth.forms import (RegistrationForm, SignInForm,
                                  ForgotPasswordForm, ResetPasswordForm)

from website.models import Guid, Node, MetaData
from website.project.forms import NewProjectForm
from website.project import model
from website import settings

logger = logging.getLogger(__name__)


def _rescale_ratio(nodes):
    """

    :param nodes:
    :return:
    """
    if not nodes:
        return 0
    return float(max([
        len(node.logs)
        for node in nodes if node.can_view(get_current_user())
    ]))


def _render_node(node):
    """

    :param node:
    :return:
    """
    return {'id': node._primary_key,
        'url': node.url,
        'api_url': node.api_url
        }



def _render_nodes(nodes):
    """

    :param nodes:
    :return:
    """
    ret = {
        'nodes': [
            _render_node(node)
            for node in nodes
        ],
        'rescale_ratio': _rescale_ratio(nodes),<commit_msg>Add docstring<commit_after># -*- coding: utf-8 -*-
import logging
import httplib as http
import datetime

import framework
from framework import Q, request, redirect, get_current_user
from framework.exceptions import HTTPError
from framework.auth import must_have_session_auth
from framework.forms import utils
from framework.auth.forms import (RegistrationForm, SignInForm,
                                  ForgotPasswordForm, ResetPasswordForm)

from website.models import Guid, Node, MetaData
from website.project.forms import NewProjectForm
from website.project import model
from website import settings

logger = logging.getLogger(__name__)


def _rescale_ratio(nodes):
    """Get scaling denominator for log lists across a sequence of nodes.

    :param nodes: Nodes
    :return: Max number of logs

    """
    if not nodes:
        return 0
    user = get_current_user()
    return float(max([
        len(node.logs)
        for node in nodes if node.can_view(user)
    ]))


def _render_node(node):
    """

    :param node:
    :return:
    """
    return {'id': node._primary_key,
        'url': node.url,
        'api_url': node.api_url
        }



def _render_nodes(nodes):
    """

    :param nodes:
    :return:
    """
    ret = {
        'nodes': [
            _render_node(node)
            for node in nodes
        ],
        'rescale_ratio': _rescale_ratio(nodes),
{'fraction_non_alphanumeric': 0.09148856392950881, 'fraction_numerical': 0.0014998125234345708, 'mean_word_length': 2.685082872928177, 'pattern_counts': {'":': 0, '<': 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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4578783', 'n_tokens_mistral': 775, 'n_tokens_neox': 754, 'n_words': 226}