<commit_before>"""
Contributed by Edigram SAS, Paris France Tel:01 44 77 94 00
<NAME> <<EMAIL>> 27 April 2004

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

connection creation sample::

    __connection__ = DBConnection.maxdbConnection(
        host=hostname, database=dbname,
        user=user_name, password=<PASSWORD>, autoCommit=1, debug=1)
"""

import os
from sqlobject.dbconnection import DBAPI
from sqlobject import col


class maxdbException(Exception):

    def __init__(self, value):
        self.value = value

    def __str__(self):
        return repr(self.value)


class LowerBoundOfSliceIsNotSupported(maxdbException):
    def __init__(self, value):
        maxdbException.__init__(self, '')


class IncorrectIDStyleError(maxdbException) :
    def __init__(self, value):
        maxdbException.__init__(
            self,
            'This primary key name is not in the expected style, '
            'please rename the column to %r or switch to another style'
            % value)


class StyleMismatchError(maxdbException):
    def __init__(self, value):
        maxdbException.__init__(
            self,
            'The name %r is only permitted for primary key, change the '
            'column name or switch to another style' % value)


class PrimaryKeyNotFounded(maxdbException):
    def __init__(self, value):
        maxdbException.__init__(
            self,
            "No primary key was defined on table %r" % value)


SAPDBMAX_ID_LENGTH = 32


class MaxdbConnection(DBAPI):

    supportTransactions = True
    dbName = 'maxdb'
    schemes = [dbName]

    def __init__ (self, host='', port=None, user=None, password=None,
                  database=None, autoCommit=1, sqlmode='internal',
                  isolation=None, timeout=None, **kw):
        from sapdb import dbapi
        self.module = dbapi
        self.host = host
        self.port = port
        self.user = user
        self.password = password
        self.db = database
        self.autoCommit = autoCommit
        self.sqlmode = sqlmode
        self.isolation = isolation
        self.timeout = timeout

        DBAPI.__init__(self, **kw)

    @classmethod
    def _connectionFromParams(cls, auth, password, host, port, path, args):
        path = path.replace('/', os.path.sep)
        return cls(host, port, user=auth, password=password, database=path,
                   **args)
<commit_msg>Fix #22 flake8 E127<commit_after>"""
Contributed by Edigram SAS, Paris France Tel:01 44 77 94 00
<NAME> <<EMAIL>> 27 April 2004

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

connection creation sample::

    __connection__ = DBConnection.maxdbConnection(
        host=hostname, database=dbname,
        user=user_name, password=<PASSWORD>, autoCommit=1, debug=1)
"""

import os
from sqlobject.dbconnection import DBAPI
from sqlobject import col


class maxdbException(Exception):

    def __init__(self, value):
        self.value = value

    def __str__(self):
        return repr(self.value)


class LowerBoundOfSliceIsNotSupported(maxdbException):
    def __init__(self, value):
        maxdbException.__init__(self, '')


class IncorrectIDStyleError(maxdbException) :
    def __init__(self, value):
        maxdbException.__init__(
            self,
            'This primary key name is not in the expected style, '
            'please rename the column to %r or switch to another style'
            % value)


class StyleMismatchError(maxdbException):
    def __init__(self, value):
        maxdbException.__init__(
            self,
            'The name %r is only permitted for primary key, change the '
            'column name or switch to another style' % value)


class PrimaryKeyNotFounded(maxdbException):
    def __init__(self, value):
        maxdbException.__init__(
            self,
            "No primary key was defined on table %r" % value)


SAPDBMAX_ID_LENGTH = 32


class MaxdbConnection(DBAPI):

    supportTransactions = True
    dbName = 'maxdb'
    schemes = [dbName]

    def __init__(self, host='', port=None, user=None, password=<PASSWORD>,
                 database=None, autoCommit=1, sqlmode='internal',
                 isolation=None, timeout=None, **kw):
        from sapdb import dbapi
        self.module = dbapi
        self.host = host
        self.port = port
        self.user = user
        self.password = password
        self.db = database
        self.autoCommit = autoCommit
        self.sqlmode = sqlmode
        self.isolation = isolation
        self.timeout = timeout

        DBAPI.__init__(self, **kw)

    @classmethod
    def _connectionFromParams(cls, auth, password, host, port, path, args):
        path = path.replace('/', os.path.sep)
        return cls(host, port, user=auth, password=password, database=path,
                   **args)

{'fraction_non_alphanumeric': 0.08437922378837613, 'fraction_numerical': 0.009268198493917745, 'mean_word_length': 2.707945597709377, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, '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': '1192765', 'n_tokens_mistral': 1478, 'n_tokens_neox': 1416, 'n_words': 466}