<commit_before># -*- coding: utf-8 -*-
import logging
import os
from mako.template import Template

from framework import request

from website.project.decorators import must_be_contributor_or_public
from website.project.decorators import must_have_addon

from ..api import GitHub, _build_github_urls, ref_to_params
from .util import _get_refs, _check_permissions
from website.util import rubeus


logger = logging.getLogger(__name__)

# TODO: Probably should just take a node object instead of having to pass
# in both url and api_url
def to_hgrid(data, node_url, node_api_url=None, branch=None, sha=None,
             can_edit=True, parent=None, **kwargs):
    """
    :param list data: The return value of Github's `contents` endpoint.
    """
    grid = []
    folders = {}

    for datum in data:
        if data[datum].type in ['file', 'blob']:
            item = {
                rubeus.KIND: rubeus.FILE,
                'urls': _build_github_urls(
                    data[datum], node_url, node_api_url, branch, sha
                )
            }
        elif data[datum].type in ['tree', 'dir']:
            item = {
                rubeus.KIND: rubeus.FOLDER,
                'children': [],
            }<commit_msg>Silence github logging<commit_after># -*- coding: utf-8 -*-
import logging
import os
from mako.template import Template

from framework import request

from website.project.decorators import must_be_contributor_or_public
from website.project.decorators import must_have_addon

from ..api import GitHub, _build_github_urls, ref_to_params
from .util import _get_refs, _check_permissions
from website.util import rubeus


logger = logging.getLogger(__name__)

logging.getLogger('github3').setLevel(logging.WARNING)
logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(logging.WARNING)

# TODO: Probably should just take a node object instead of having to pass
# in both url and api_url
def to_hgrid(data, node_url, node_api_url=None, branch=None, sha=None,
             can_edit=True, parent=None, **kwargs):
    """
    :param list data: The return value of Github's `contents` endpoint.
    """
    grid = []
    folders = {}

    for datum in data:
        if data[datum].type in ['file', 'blob']:
            item = {
                rubeus.KIND: rubeus.FILE,
                'urls': _build_github_urls(
                    data[datum], node_url, node_api_url, branch, sha
                )
            }
        elif data[datum].type in ['tree', 'dir']:
            item = {
                rubeus.KIND: rubeus.FOLDER,
                'children': [],
            }
{'fraction_non_alphanumeric': 0.09980879541108986, 'fraction_numerical': 0.0015296367112810707, 'mean_word_length': 2.6082758620689654, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1196411', 'n_tokens_mistral': 797, 'n_tokens_neox': 776, 'n_words': 218}