<commit_before># See LICENSE file for copyright and license details.

"""
Lockfile functions
"""

from time import time
from os import remove
from os.path import isfile
import sys

from lib.log import info

def check_lock():
    """
    Checks if a lockfile is active, and creates one if not.
    """
    if isfile('/tmp/amprolla.lock'):
        info('Lockfile found. Defering operation.')
        sys.exit(1)

    with open('/tmp/amprolla.lock', 'w') as lock:
        lock.write(int(time()))


def free_lock():
    """
    Frees an active lockfile.
    """
    remove('/tmp/amprolla.lock')<commit_msg>fixup! implement basic lockfile functions<commit_after># See LICENSE file for copyright and license details.

"""
Lockfile functions
"""

from time import time
from os import remove
from os.path import isfile
import sys

from lib.log import info

def check_lock():
    """
    Checks if a lockfile is active, and creates one if not.
    """
    if isfile('/tmp/amprolla.lock'):
        info('Lockfile found. Defering operation.')
        sys.exit(1)

    with open('/tmp/amprolla.lock', 'w') as lock:
        lock.write(str(int(time())))


def free_lock():
    """
    Frees an active lockfile.
    """
    remove('/tmp/amprolla.lock')
{'fraction_non_alphanumeric': 0.12530315278900567, 'fraction_numerical': 0.0016168148746968471, 'mean_word_length': 3.0064724919093853, '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': '1395689', 'n_tokens_mistral': 387, 'n_tokens_neox': 380, 'n_words': 127}