<commit_before>from __future__ import absolute_import, unicode_literals
import subprocess
import datetime
import os
from .models.fields import PrivateFileField
from .signals import pre_download

__author__ = 'vvangelovski'
default_app_config = 'private_files.apps.PrivateFilesConfig'

VERSION = __version__ = (1, 0, 0, 'final', 0)
NAME = 'django-private-files'


__all__ = ['PrivateFileField', 'pre_download']


def get_version(version=None):
    """Derives a PEP386-compliant version number from VERSION."""
    if version is None:
        version = VERSION
    assert len(version) == 5
    assert version[3] in ('alpha', 'beta', 'rc', 'final')

    parts = 2 if version[2] == 0 else 3
    main = '.'.join(str(x) for x in version[:parts])

    sub = ''
    if version[3] == 'alpha' and version[4] == 0:
        git_changeset = get_git_changeset()
        if git_changeset:
            sub = '.a%s' % git_changeset

    elif version[3] != 'final':
        mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
        sub = mapping[version[3]]
        if version[4] > 0:
            sub += str(version[4])<commit_msg>don't fail getting the version if django is not installed<commit_after>from __future__ import absolute_import, unicode_literals
import subprocess
import datetime
import os


__author__ = 'vvangelovski'
default_app_config = 'private_files.apps.PrivateFilesConfig'

VERSION = __version__ = (1, 0, 1, 'final', 0)
NAME = 'django-private-files'

# don't fail installing before django
try:
    from .models.fields import PrivateFileField
    from .signals import pre_download

    __all__ = ['PrivateFileField', 'pre_download']
except ImportError:
    pass

def get_version(version=None):
    """Derives a PEP386-compliant version number from VERSION."""
    if version is None:
        version = VERSION
    assert len(version) == 5
    assert version[3] in ('alpha', 'beta', 'rc', 'final')

    parts = 2 if version[2] == 0 else 3
    main = '.'.join(str(x) for x in version[:parts])

    sub = ''
    if version[3] == 'alpha' and version[4] == 0:
        git_changeset = get_git_changeset()
        if git_changeset:
            sub = '.a%s' % git_changeset

    elif version[3] != 'final':
        mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
        sub = mapping[version[3]]
        if version[4] > 0:
            sub += str(version[4])
{'fraction_non_alphanumeric': 0.133078231292517, 'fraction_numerical': 0.017857142857142856, 'mean_word_length': 3.3095238095238093, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6242301', 'n_tokens_mistral': 780, 'n_tokens_neox': 744, 'n_words': 225}