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

"""
$Id$

Copyright (c) 2006-2011 sqlmap developers (http://www.sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""

import os
import re

from subprocess import PIPE
from subprocess import Popen as execute

def getRevisionNumber():
    curDir = os.path.dirname(os.path.realpath(__file__))
    retVal = None

    try:
        import pysvn

        client = pysvn.Client()
        if client.info(curDir):
            retVal = client.info(curDir).revision.number
    except ImportError, _:
        process = execute("svn info %s" % curDir, shell=True, stdout=PIPE, stderr=PIPE)
        svnStdout, svnStderr = process.communicate()

        if svnStdout:
            revision = re.search("Revision:\s+([\d]+)", svnStdout)

            if revision:
                retVal = revision.group(1)

    if not retVal:
        # Reference: http://stackoverflow.com/questions/242295/how-does-one-add-a-svn-repository-build-number-to-python-code
        entriesPath = '%s/.svn/entries' % curDir

        if os.path.exists(entriesPath):
            entries = open(entriesPath, 'r').read()
            # Versions >= 7 of the entries file are flat text.  The first line is
            # the version number. The next set of digits after 'dir' is the revision.
            if re.match('(\d+)', entries):
                match = re.search('\d+\s+dir\s+(\d+)', entries)
                if match:
                    retVal = match.groups()[0]
            # Older XML versions of the file specify revision as an attribute of
            # the first entries node.
            else:
                from xml.dom import minidom
                dom = minidom.parse(entriesPath)
                retVal = dom.getElementsByTagName('entry')[0].getAttribute('revision')

    if retVal:
        try:
            retVal = int(retVal)
        except ValueError:
            retVal = None

    return retVal<commit_msg>minor update<commit_after>#!/usr/bin/env python

"""
$Id$

Copyright (c) 2006-2011 sqlmap developers (http://www.sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""

import os
import re

from subprocess import PIPE
from subprocess import Popen as execute

def getRevisionNumber():
    curDir = os.path.dirname(os.path.realpath(__file__))
    retVal = None

    try:
        import pysvn

        client = pysvn.Client()
        if client.info(curDir):
            retVal = client.info(curDir).revision.number
    except ImportError, _:
        process = execute("svn info %s" % curDir, shell=True, stdout=PIPE, stderr=PIPE)
        svnStdout, svnStderr = process.communicate()

        if svnStdout:
            revision = re.search("Revision:\s+([\d]+)", svnStdout)

            if revision:
                retVal = revision.group(1)
    except:
        pass

    if not retVal:
        # Reference: http://stackoverflow.com/questions/242295/how-does-one-add-a-svn-repository-build-number-to-python-code
        entriesPath = '%s/.svn/entries' % curDir

        if os.path.exists(entriesPath):
            entries = open(entriesPath, 'r').read()
            # Versions >= 7 of the entries file are flat text.  The first line is
            # the version number. The next set of digits after 'dir' is the revision.
            if re.match('(\d+)', entries):
                match = re.search('\d+\s+dir\s+(\d+)', entries)
                if match:
                    retVal = match.groups()[0]
            # Older XML versions of the file specify revision as an attribute of
            # the first entries node.
            else:
                from xml.dom import minidom
                dom = minidom.parse(entriesPath)
                retVal = dom.getElementsByTagName('entry')[0].getAttribute('revision')

    if retVal:
        try:
            retVal = int(retVal)
        except ValueError:
            retVal = None

    return retVal
{'fraction_non_alphanumeric': 0.11108260646485377, 'fraction_numerical': 0.009235505387378143, 'mean_word_length': 2.0508607198748043, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '4970298', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1134, 'n_words': 306}