<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: <EMAIL>
# 


import ssl

import os.path
import settings


def create_certs():
    import subprocess

    if not os.path.exists(settings.SSL_PUBLIC_FILE):
        os.makedirs(os.path.dirname(settings.SSL_PUBLIC_FILE), 400, exist_ok=True)
        os.makedirs(os.path.dirname(settings.SSL_RPIVATE_FILE), 400, exist_ok=True)

        subprocess.check_output('openssl req -x509 -nodes -days 3650 -newkey rsa:2048  '
                                '-subj "/C=US/ST=Oregon/L=Portland/CN={DOMAIN_NAME}" '
                                '-keyout {DEST_PRIVATE_PEM} '
                                '-out {DEST_PUB_PEM}'.format(DOMAIN_NAME='example.org',
                                                             DEST_PRIVATE_PEM=settings.SSL_RPIVATE_FILE,
                                                             DEST_PUB_PEM=settings.SSL_PUBLIC_FILE),
                                shell=True)


def create_client_ssl_context():
    # The certificate is created with pymotw.com as the hostname,
    # which will not match when the example code runs
    # elsewhere, so disable hostname verification.
    ssl_context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH)
    ssl_context.check_hostname = False
    ssl_context.verify_mode = ssl.CERT_NONE


def create_server_ssl_context():
    # The certificate is created with pymotw.com as the hostname,
    # which will not match when the example code runs elsewhere,
    # so disable hostname verification.

    create_certs()
    ssl_context = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH)
    ssl_context.check_hostname = False
    ssl_context.load_cert_chain(settings.SSL_PUBLIC_FILE, settings.SSL_RPIVATE_FILE)
<commit_msg>rename<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: <EMAIL>.com
# 


import ssl

import os.path
import settings


def create_self_signed_certs():
    import subprocess

    if not os.path.exists(settings.SSL_PUBLIC_FILE):
        os.makedirs(os.path.dirname(settings.SSL_PUBLIC_FILE), 400, exist_ok=True)
        os.makedirs(os.path.dirname(settings.SSL_RPIVATE_FILE), 400, exist_ok=True)

        subprocess.check_output('openssl req -x509 -nodes -days 3650 -newkey rsa:2048  '
                                '-subj "/C=US/ST=Oregon/L=Portland/CN={DOMAIN_NAME}" '
                                '-keyout {DEST_PRIVATE_PEM} '
                                '-out {DEST_PUB_PEM}'.format(DOMAIN_NAME='example.org',
                                                             DEST_PRIVATE_PEM=settings.SSL_RPIVATE_FILE,
                                                             DEST_PUB_PEM=settings.SSL_PUBLIC_FILE),
                                shell=True)


def create_client_ssl_context():
    # The certificate is created with pymotw.com as the hostname,
    # which will not match when the example code runs
    # elsewhere, so disable hostname verification.
    ssl_context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH)
    ssl_context.check_hostname = False
    ssl_context.verify_mode = ssl.CERT_NONE


def create_server_ssl_context():
    # The certificate is created with pymotw.com as the hostname,
    # which will not match when the example code runs elsewhere,
    # so disable hostname verification.

    create_self_signed_certs()
    ssl_context = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH)
    ssl_context.check_hostname = False
    ssl_context.load_cert_chain(settings.SSL_PUBLIC_FILE, settings.SSL_RPIVATE_FILE)

{'fraction_non_alphanumeric': 0.0863852390271177, 'fraction_numerical': 0.010064299692479732, 'mean_word_length': 2.3946869070208727, 'pattern_counts': {'":': 0, '<': 5, '<?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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3303788', 'n_tokens_mistral': 1160, 'n_tokens_neox': 1072, 'n_words': 210}