<commit_before>from django.db.backends import BaseDatabaseClient
from django.conf import settings
import os
import sys

class DatabaseClient(BaseDatabaseClient):
    def runshell(self):
        if os.name=='nt':
            db = settings.DATABASE_OPTIONS.get('db', settings.DATABASE_NAME)
            user = settings.DATABASE_OPTIONS.get('user', settings.DATABASE_USER)
            password = settings.DATABASE_OPTIONS.get('passwd', settings.DATABASE_PASSWORD)
            server = settings.DATABASE_OPTIONS.get('host', settings.DATABASE_HOST)
            port = settings.DATABASE_OPTIONS.get('port', settings.DATABASE_PORT)
            defaults_file = settings.DATABASE_OPTIONS.get('read_default_file')

            args = ['osql']
            if server:
                args += ["-S", server]
            if user:
                args += ["-U", user]
                if password:
                    args += ["-P", password]
            else:
                args += ["-E"] # Try trusted connection instead
            if db:
                args += ["-d", db]
            if defaults_file:
                args += ["-i", defaults_file]
        else:
            dsn = settings.DATABASE_OPTIONS.get('dsn', settings.DATABASE_ODBC_DSN)
            user = settings.DATABASE_OPTIONS.get('user', settings.DATABASE_USER)
            password = settings.DATABASE_OPTIONS.get('passwd', settings.DATABASE_PASSWORD)
            args = ['isql -v %s %s %s' %(dsn, user, password)]

        import subprocess
        try:
            retcode = subprocess.call(args, shell=True)
            if retcode:
                print >>sys.stderr, "error level:", retcode
                sys.exit(retcode)
        except KeyboardInterrupt:
            pass
        except OSError, e:
            print >>sys.stderr, "Execution failed:", e
<commit_msg>Made some minimal client module modifications to be in line with Django r8989 and r8990.<commit_after>from django.db.backends import BaseDatabaseClient
from django.conf import settings
import os
import sys

class DatabaseClient(BaseDatabaseClient):
    if os.name=='nt':
        executable_name = 'osql'
    else:
        executable_name = 'isql'

    def runshell(self):
        user = settings.DATABASE_OPTIONS.get('user', settings.DATABASE_USER)
        password = settings.DATABASE_OPTIONS.get('passwd', settings.DATABASE_PASSWORD)
        if os.name=='nt':
            db = settings.DATABASE_OPTIONS.get('db', settings.DATABASE_NAME)
            server = settings.DATABASE_OPTIONS.get('host', settings.DATABASE_HOST)
            port = settings.DATABASE_OPTIONS.get('port', settings.DATABASE_PORT)
            defaults_file = settings.DATABASE_OPTIONS.get('read_default_file')

            args = [self.executable_name]
            if server:
                args += ["-S", server]
            if user:
                args += ["-U", user]
                if password:
                    args += ["-P", password]
            else:
                args += ["-E"] # Try trusted connection instead
            if db:
                args += ["-d", db]
            if defaults_file:
                args += ["-i", defaults_file]
        else:
            dsn = settings.DATABASE_OPTIONS.get('dsn', settings.DATABASE_ODBC_DSN)
            args = ['%s -v %s %s %s' % (self.executable_name, dsn, user, password)]

        import subprocess
        try:
            subprocess.call(args, shell=True)
        except KeyboardInterrupt:
            pass
{'fraction_non_alphanumeric': 0.10839562967222542, 'fraction_numerical': 0.0023001725129384704, 'mean_word_length': 2.012121212121212, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '746208', 'n_tokens_mistral': 1015, 'n_tokens_neox': 983, 'n_words': 225}