<commit_before>from os.path import abspath, join as path_join
from random import choice
from string import ascii_lowercase

import pyautogui as ag
from robot.libraries.BuiltIn import BuiltIn, RobotNotRunningError


class _Screenshot(object):

    def _make_up_filename(self):
        try:
            path = BuiltIn().get_variable_value('${SUITE NAME}')
        except RobotNotRunningError:
            rand_str = ''.join(choice(ascii_lowercase) for _ in range(7))
            path = 'ImageHorizon-%s-screenshot' % rand_str
        return '%s-%d.png' % (path, self.screenshot_counter)

    def take_a_screenshot(self):
        target_dir = self.screenshot_folder if self.screenshot_folder else ''
        path = self._make_up_filename()
        path = abspath(path_join(target_dir, path))
        ag.screenshot(path)
<commit_msg>make the screenshot file name better when inside RF<commit_after>from os.path import abspath, join as path_join
from random import choice
from string import ascii_lowercase

import pyautogui as ag
from robot.libraries.BuiltIn import BuiltIn, RobotNotRunningError


class _Screenshot(object):

    def _make_up_filename(self):
        try:
            path = BuiltIn().get_variable_value('${SUITE NAME}')
            path = '%s-screenshot' % path.replace(' ', '')
        except RobotNotRunningError:
            rand_str = ''.join(choice(ascii_lowercase) for _ in range(7))
            path = 'ImageHorizon-%s-screenshot' % rand_str
        return '%s-%d.png' % (path, self.screenshot_counter)

    def take_a_screenshot(self):
        target_dir = self.screenshot_folder if self.screenshot_folder else ''
        path = self._make_up_filename()
        path = abspath(path_join(target_dir, path))
        ag.screenshot(path)

{'fraction_non_alphanumeric': 0.0945868945868946, 'fraction_numerical': 0.0011396011396011395, 'mean_word_length': 3.3251231527093594, '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': '7000', 'n_tokens_mistral': 560, 'n_tokens_neox': 544, 'n_words': 129}