<commit_before>#
# Copyright (c) 2004-2006 rPath, Inc.
#
# All Rights Reserved
#
import os
import re

from mint import constants
from mint import mint_error

from conary import versions
from conary.conaryclient.cmdline import parseTroveSpec

DEFAULT_BASEPATH = os.path.join(os.path.sep, 'srv', 'mint', 'jobserver')

def getVersionsOnDisk(basePath = None):
    if basePath is None:
        basePath = DEFAULT_BASEPATH
    ret = sorted([x for x in os.listdir(basePath) \
                   if re.match('\d*(\.\d*)+.*', x) \
                   and os.path.isdir(os.path.join(basePath, x))])
    return ret and ret or [constants.mintVersion]

def getVersions(basePath = None):
    if basePath is None:
        basePath = DEFAULT_BASEPATH
    try:
        f = open(os.path.join(basePath, 'versions'))
    except:
        return getVersionsOnDisk(basePath)
    try:
        vers = [versions.VersionFromString(parseTroveSpec(x.strip())[1]) for x in f.readlines()]
        ret = [str(x.trailingRevision()).split('-')[0] for x in vers]
        return ret and ret or [constants.mintVersion]<commit_msg>fix vestigial /srv/mint holdover<commit_after>#
# Copyright (c) 2004-2006 rPath, Inc.
#
# All Rights Reserved
#
import os
import re

from mint import constants
from mint import mint_error

from conary import versions
from conary.conaryclient.cmdline import parseTroveSpec

DEFAULT_BASEPATH = os.path.join(os.path.sep, 'srv', 'rbuilder', 'jobserver')

def getVersionsOnDisk(basePath = None):
    if basePath is None:
        basePath = DEFAULT_BASEPATH
    ret = sorted([x for x in os.listdir(basePath) \
                   if re.match('\d*(\.\d*)+.*', x) \
                   and os.path.isdir(os.path.join(basePath, x))])
    return ret and ret or [constants.mintVersion]

def getVersions(basePath = None):
    if basePath is None:
        basePath = DEFAULT_BASEPATH
    try:
        f = open(os.path.join(basePath, 'versions'))
    except:
        return getVersionsOnDisk(basePath)
    try:
        vers = [versions.VersionFromString(parseTroveSpec(x.strip())[1]) for x in f.readlines()]
        ret = [str(x.trailingRevision()).split('-')[0] for x in vers]
        return ret and ret or [constants.mintVersion]
{'fraction_non_alphanumeric': 0.12052560036248301, 'fraction_numerical': 0.009062075215224286, 'mean_word_length': 3.07380073800738, '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': '1517938', 'n_tokens_mistral': 737, 'n_tokens_neox': 718, 'n_words': 194}