<commit_before>#!/usr/bin/env python
'''
# wiggle_mouse

Wiggles the mouse every set number of seconds.

Configureable via `wiggle_mouse_config.txt`.
'''
from __future__ import print_function
import win32api
import win32con
import time
import os.path

CONFIG_FILENAME = 'wiggle_mouse_config.txt'

DEFAULT_CONFIG_FILE = '''# Wiggle mouse config
# Any text following the hash mark is a comment and will be ignored.
# Blank lines are also ignored.
# If you make any changes to this config file, restart the program.

# All times are in seconds
time_between_mouse_movement = 300.0  # 5 minutes
time_mouse_spends_moving = 1.0
time_between_user_movement_check = 59.0  # Checks about once a minute to see if the mouse has moved.

# All distances are in pixels
distance_mouse_moves = 40
'''


class ParseException(Exception):
    '''An exception thrown whenever an error is encountered with the
    config file.'''
    pass


def ensure_file_exists(filename):
    '''If `filename` does not exists, creates a new config file at that
    location.'''
    if not os.path.isfile(filename):
        with open(filename, 'w') as stream:
            stream.write(DEFAULT_CONFIG_FILE)
            print('Error! Unable to find config file. '
                  'Creating new one at `{0}`'.format(filename))


def parse_config_file(filename):
    '''Parses the config file, return a dictionary mapping keys to values.'''<commit_msg>Decreased waiting time<commit_after>#!/usr/bin/env python
'''
# wiggle_mouse

Wiggles the mouse every set number of seconds.

Configureable via `wiggle_mouse_config.txt`.
'''
from __future__ import print_function
import win32api
import win32con
import time
import os.path

CONFIG_FILENAME = 'wiggle_mouse_config.txt'

DEFAULT_CONFIG_FILE = '''# Wiggle mouse config
# Any text following the hash mark is a comment and will be ignored.
# Blank lines are also ignored.
# If you make any changes to this config file, restart the program.

# All times are in seconds
time_between_mouse_movement = 5.0
time_mouse_spends_moving = 1.0
time_between_user_movement_check = 0.5  # Checks every half-second to see if 
                                        # the mouse has moved.

# All distances are in pixels
distance_mouse_moves = 40
'''


class ParseException(Exception):
    '''An exception thrown whenever an error is encountered with the
    config file.'''
    pass


def ensure_file_exists(filename):
    '''If `filename` does not exists, creates a new config file at that
    location.'''
    if not os.path.isfile(filename):
        with open(filename, 'w') as stream:
            stream.write(DEFAULT_CONFIG_FILE)
            print('Error! Unable to find config file. '
                  'Creating new one at `{0}`'.format(filename))


def parse_config_file(filename):
    '''Parses the config file, return a dictionary mapping keys to values.'''
{'fraction_non_alphanumeric': 0.08082575227431771, 'fraction_numerical': 0.010496850944716585, 'mean_word_length': 3.611290322580645, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6225238', 'n_tokens_mistral': 848, 'n_tokens_neox': 808, 'n_words': 311}