<commit_before>import os
import re
import json
from copy import copy
import yaml
import logging
import tornado
import filelock
from uuid import uuid4

from datetime import datetime

from pipelines.pipeline.exceptions import PipelineError
from schema import SchemaError
from yaml import YAMLError
from concurrent.futures import ThreadPoolExecutor
from tornado import gen
from tornado.ioloop import IOLoop
from tornado import concurrent, ioloop
from tornado.web import (
    RequestHandler,
    Application,
    url,
    HTTPError,
    authenticated,
    StaticFileHandler
)
from pipelines import PipelinesError
from pipelines.api import PIPELINES_EXT, WEB_HOOK_CONFIG
from pipelines.api.ghauth import GithubOAuth2LoginHandler
from pipelines.api.slackbot import SlackbotHandler
from pipelines.api.utils import _get_pipeline_filepath, _file_iterator, _slugify_file, _run_id_iterator, \
    AsyncRunner, _run_pipeline
from pipelines.plugin.exceptions import PluginError
from pipelines.utils import conf_logging
from pipelines.pipeline.pipeline import Pipeline

log = logging.getLogger('pipelines')


class PipelinesRequestHandler(RequestHandler):
    def get_current_user(self):
        log.debug('Get current user')
        log.debug(self.settings)
        if not self.settings.get('auth'):
            log.debug('noauth')
            # No authentication required
            return 'guest'
        user_cookie = self.get_secure_cookie("user")
        if user_cookie:
            log.debug('user cookie %s' % user_cookie)
            return json.loads(user_cookie)
        log.debug('none')
        return None

    def set_default_headers(self):
        self.set_header("Access-Control-Allow-Origin", "*")
        self.set_header("Access-Control-Allow-Headers", "x-requested-with")
        self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')


def _get_webhook_id(trigger_identifier, wh_config):
    for k, v in wh_config.items():
        if trigger_identifier == v:
            return k<commit_msg>Remove the secret info in logs<commit_after>import os
import re
import json
from copy import copy
import yaml
import logging
import tornado
import filelock
from uuid import uuid4

from datetime import datetime

from pipelines.pipeline.exceptions import PipelineError
from schema import SchemaError
from yaml import YAMLError
from concurrent.futures import ThreadPoolExecutor
from tornado import gen
from tornado.ioloop import IOLoop
from tornado import concurrent, ioloop
from tornado.web import (
    RequestHandler,
    Application,
    url,
    HTTPError,
    authenticated,
    StaticFileHandler
)
from pipelines import PipelinesError
from pipelines.api import PIPELINES_EXT, WEB_HOOK_CONFIG
from pipelines.api.ghauth import GithubOAuth2LoginHandler
from pipelines.api.slackbot import SlackbotHandler
from pipelines.api.utils import _get_pipeline_filepath, _file_iterator, _slugify_file, _run_id_iterator, \
    AsyncRunner, _run_pipeline
from pipelines.plugin.exceptions import PluginError
from pipelines.utils import conf_logging
from pipelines.pipeline.pipeline import Pipeline

log = logging.getLogger('pipelines')


class PipelinesRequestHandler(RequestHandler):
    def get_current_user(self):
        log.debug('Get current user')
        # TODO remove the secret or password in settings before print it out
        #log.debug(self.settings)
        if not self.settings.get('auth'):
            log.debug('noauth')
            # No authentication required
            return 'guest'
        user_cookie = self.get_secure_cookie("user")
        if user_cookie:
            log.debug('user cookie %s' % user_cookie)
            return json.loads(user_cookie)
        log.debug('none')
        return None

    def set_default_headers(self):
        self.set_header("Access-Control-Allow-Origin", "*")
        self.set_header("Access-Control-Allow-Headers", "x-requested-with")
        self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')


def _get_webhook_id(trigger_identifier, wh_config):
    for k, v in wh_config.items():
        if trigger_identifier == v:
            return k
{'fraction_non_alphanumeric': 0.07127272727272728, 'fraction_numerical': 0.0009696969696969697, 'mean_word_length': 3.8032596041909197, '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': '479347', 'n_tokens_mistral': 1178, 'n_tokens_neox': 1143, 'n_words': 328}