<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Scriptharness version.

Attributes:
  __version__ (tuple): semver version - three integers and an optional string.
  __version_string__ (str): semver version in string format.
"""
from __future__ import absolute_import, division, print_function, \
                       unicode_literals
from scriptharness.exceptions import ScriptHarnessException


def get_version_string(version):
    """Translate a version tuple into a string.

    Specify the __version__ as a tuple for more precise comparisons, and
    translate it to __version_string__ for when that's needed.

    This function exists primarily for easier unit testing.

    Args:
      version (tuple): three ints and an optional string.

    Returns:
      version_string (str): the tuple translated into a string per semver.org
    """
    version_len = len(version)
    if version_len == 3:
        version_string = '%d.%d.%d' % version
    elif version_len == 4:
        version_string = '%d.%d.%d-%s' % version
    else:
        raise ScriptHarnessException(
            'Version tuple is non-semver-compliant {} length!'.format(version_len)<commit_msg>version.py shouldn't import other scriptharness modules<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Scriptharness version.

Attributes:
  __version__ (tuple): semver version - three integers and an optional string.
  __version_string__ (str): semver version in string format.
"""
from __future__ import absolute_import, division, print_function, \
                       unicode_literals


def get_version_string(version):
    """Translate a version tuple into a string.

    Specify the __version__ as a tuple for more precise comparisons, and
    translate it to __version_string__ for when that's needed.

    This function exists primarily for easier unit testing.

    Args:
      version (tuple): three ints and an optional string.

    Returns:
      version_string (str): the tuple translated into a string per semver.org
    """
    version_len = len(version)
    if version_len == 3:
        version_string = '%d.%d.%d' % version
    elif version_len == 4:
        version_string = '%d.%d.%d-%s' % version
    else:
        raise Exception(
            'Version tuple is non-semver-compliant {} length!'.format(version_len)
{'fraction_non_alphanumeric': 0.08958422631804544, 'fraction_numerical': 0.002571795970852979, 'mean_word_length': 3.1530249110320283, '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': '3916202', 'n_tokens_mistral': 670, 'n_tokens_neox': 633, 'n_words': 226}