<commit_before># !/usr/bin/python3
# coding: utf-8

# Copyright 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


""" Perform benchmarks and tests on your PC. """

import getpass
import os
import random
import sys

from hal.files.models import Document
from hal.maths import maths
from time import time


class EightQueenTest(object):
    """ Test CPU by solving eight-queen problem """

    def __init__(self, size):
        object.__init__(self)

        self.size = size
        self.benchmark = ""

    @staticmethod
    def welcome():
        """
        :return: string
            Welcomes user to this test sessions
        """

        user = getpass.getuser()
        os_name = os.name

        output = "\nHello! You are " + str(user) + " running " + str(
            os_name) + " right?\n"
        output += "I\'ll test your CPU and RAM usage while executing this " \
                  "script, is it ok?\n "
        return output

    @staticmethod
    def introduction():
        """ :return: string
            Welcomes user to this test sessions
        """

        output = "So, let\'s get into the details.. I\'m going to solve the " \
                 "classic Eight Queens Puzzle: it\'s the problem of placing " \
                 "eight chess queens on an 8×8 chessboard so that no two " \
                 "queens threaten each other.\nFinding all solutions to the " \
                 "eight queens puzzle is a good example of a nontrivial " \
                 "problem. For this reason, it is often used as an example " \
                 "problem for various programming techniques, including " \
                 "non-traditional approaches such as constraint programming, " \
                 "logic programming or genetic algorithms. Most often, " \
                 "it is used as an example of a problem that can be solved " \
                 "with a recursive algorithm (read more here: " \
                 "https://en.wikipedia.org/wiki/Eight_queens_puzzle) ... and " \
                 "since recursion involves both RAM storage and CPU use of " \
                 "your machine, this problem is a good tester to test your " \
                 "PC speed! Now let\'s get started.. "
        return output

    @staticmethod
    def run_test_with_size(size):
        """
        :param size: int
            Number of rows in grid
        :return: int
            Time to solve problem with given size
        """

        timing = time()<commit_msg>flake8-ed profile.performance<commit_after># !/usr/bin/python3
# coding: utf-8

# Copyright 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


""" Perform benchmarks and tests on your PC. """

import getpass
import os
import random
import sys

from hal.files.models import Document
from hal.maths import maths
from time import time


class EightQueenTest(object):
    """ Test CPU by solving eight-queen problem """

    def __init__(self, size):
        object.__init__(self)

        self.size = size
        self.benchmark = ""

    @staticmethod
    def welcome():
        """
        :return: string
            Welcomes user to this test sessions
        """

        user = getpass.getuser()
        os_name = os.name

        output = "\nHello! You are " + str(user) + " running " + str(
            os_name) + " right?\n"
        output += "I\'ll test your CPU and RAM usage while executing this " \
                  "script, is it ok?\n "
        return output

    @staticmethod
    def introduction():
        """ :return: string
            Welcomes user to this test sessions
        """

        output = "So, let\'s get into the details.. I\'m going to solve the " \
                 "classic Eight Queens Puzzle: it\'s the problem of placing " \
                 "eight chess queens on an 8×8 chessboard so that no two " \
                 "queens threaten each other.\nFinding all solutions to the " \
                 "eight queens puzzle is a good example of a nontrivial " \
                 "problem. For this reason, it is often used as an example " \
                 "problem for various programming techniques, including " \
                 "non-traditional approaches such as constraint programming," \
                 " logic programming or genetic algorithms. Most often, " \
                 "it is used as an example of a problem that can be solved " \
                 "with a recursive algorithm (read more here: " \
                 "https://en.wikipedia.org/wiki/Eight_queens_puzzle) ... and" \
                 " since recursion involves both RAM storage and CPU use of " \
                 "your machine, this problem is a good tester to test your " \
                 "PC speed! Now let\'s get started.. "
        return output

    @staticmethod
    def run_test_with_size(size):
        """
        :param size: int
            Number of rows in grid
        :return: int
            Time to solve problem with given size
        """

        timing = time()
{'fraction_non_alphanumeric': 0.08205470313542361, 'fraction_numerical': 0.004169446297531688, 'mean_word_length': 2.0045090180360723, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '3485104', 'n_tokens_mistral': 1559, 'n_tokens_neox': 1488, 'n_words': 664}