<commit_before># ansisql.py
# Copyright (C) 2005, 2006, 2007 <NAME> <EMAIL>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php

"""Defines ANSI SQL operations.

Contains default implementations for the abstract objects in the sql
module.
"""

import string, re, sets, operator

from sqlalchemy import schema, sql, engine, util, exceptions
from  sqlalchemy.engine import default

ANSI_FUNCS = sets.ImmutableSet(['CURRENT_DATE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP',
                                'CURRENT_USER', 'LOCALTIME', 'LOCALTIMESTAMP',
                                'SESSION_USER', 'USER'])


RESERVED_WORDS = util.Set(['all', 'analyse', 'analyze', 'and', 'any', 'array',
                           'as', 'asc', 'asymmetric', 'authorization', 'between',
                           'binary', 'both', 'case', 'cast', 'check', 'collate',
                           'column', 'constraint', 'create', 'cross', 'current_date',
                           'current_role', 'current_time', 'current_timestamp',
                           'current_user', 'default', 'deferrable', 'desc',
                           'distinct', 'do', 'else', 'end', 'except', 'false',
                           'for', 'foreign', 'freeze', 'from', 'full', 'grant',
                           'group', 'having', 'ilike', 'in', 'initially', 'inner',
                           'intersect', 'into', 'is', 'isnull', 'join', 'leading',
                           'left', 'like', 'limit', 'localtime', 'localtimestamp',
                           'natural', 'new', 'not', 'notnull', 'null', 'off', 'offset',
                           'old', 'on', 'only', 'or', 'order', 'outer', 'overlaps',
                           'placing', 'primary', 'references', 'right', 'select',
                           'session_user', 'similar', 'some', 'symmetric', 'table',
                           'then', 'to', 'trailing', 'true', 'union', 'unique', 'user',
                           'using', 'verbose', 'when', 'where'])

LEGAL_CHARACTERS = util.Set(string.ascii_lowercase + string.ascii_uppercase + string.digits + '_$')
ILLEGAL_INITIAL_CHARACTERS = util.Set(string.digits + '$')

BIND_PARAMS = re.compile(r'(?<![:\w\x5c]):(\w+)(?!:)', re.UNICODE)
BIND_PARAMS_ESC = re.compile(r'\x5c(:\w+)(?!:)', re.UNICODE)

OPERATORS =  {
    operator.and_ : 'AND',
    operator.or_ : 'OR',
    operator.inv : 'NOT',
    operator.add : '+',
    operator.mul : '*',
    operator.sub : '-',
    operator.div : '/',
    operator.mod : '%',
    operator.truediv : '/',
    operator.lt : '<',
    operator.le : '<=',
    operator.ne : '!=',
    operator.gt : '>',
    operator.ge : '>=',
    operator.eq : '=',
    sql.ColumnOperators.distinct_op : 'DISTINCT',
    sql.ColumnOperators.concat_op : '||',
    sql.ColumnOperators.like_op : 'LIKE',
    sql.ColumnOperators.notlike_op : 'NOT LIKE',
    sql.ColumnOperators.ilike_op : 'ILIKE',<commit_msg>Added 'SET' to reserved words, plus gratuitous reindenting.<commit_after># ansisql.py
# Copyright (C) 2005, 2006, 2007 <NAME> <EMAIL>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php

"""Defines ANSI SQL operations.

Contains default implementations for the abstract objects in the sql
module.
"""

import string, re, sets, operator

from sqlalchemy import schema, sql, engine, util, exceptions
from  sqlalchemy.engine import default


ANSI_FUNCS = sets.ImmutableSet([
    'CURRENT_DATE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP',
    'CURRENT_USER', 'LOCALTIME', 'LOCALTIMESTAMP',
    'SESSION_USER', 'USER'])

RESERVED_WORDS = util.Set([
    'all', 'analyse', 'analyze', 'and', 'any', 'array',
    'as', 'asc', 'asymmetric', 'authorization', 'between',
    'binary', 'both', 'case', 'cast', 'check', 'collate',
    'column', 'constraint', 'create', 'cross', 'current_date',
    'current_role', 'current_time', 'current_timestamp',
    'current_user', 'default', 'deferrable', 'desc',
    'distinct', 'do', 'else', 'end', 'except', 'false',
    'for', 'foreign', 'freeze', 'from', 'full', 'grant',
    'group', 'having', 'ilike', 'in', 'initially', 'inner',
    'intersect', 'into', 'is', 'isnull', 'join', 'leading',
    'left', 'like', 'limit', 'localtime', 'localtimestamp',
    'natural', 'new', 'not', 'notnull', 'null', 'off', 'offset',
    'old', 'on', 'only', 'or', 'order', 'outer', 'overlaps',
    'placing', 'primary', 'references', 'right', 'select',
    'session_user', 'set', 'similar', 'some', 'symmetric', 'table',
    'then', 'to', 'trailing', 'true', 'union', 'unique', 'user',
    'using', 'verbose', 'when', 'where'])

LEGAL_CHARACTERS = util.Set(string.ascii_lowercase +
                            string.ascii_uppercase +
                            string.digits + '_$')
ILLEGAL_INITIAL_CHARACTERS = util.Set(string.digits + '$')

BIND_PARAMS = re.compile(r'(?<![:\w\x5c]):(\w+)(?!:)', re.UNICODE)
BIND_PARAMS_ESC = re.compile(r'\x5c(:\w+)(?!:)', re.UNICODE)

OPERATORS =  {
    operator.and_ : 'AND',
    operator.or_ : 'OR',
    operator.inv : 'NOT',
    operator.add : '+',
    operator.mul : '*',
    operator.sub : '-',
    operator.div : '/',
    operator.mod : '%',
    operator.truediv : '/',
    operator.lt : '<',
    operator.le : '<=',
    operator.ne : '!=',
    operator.gt : '>',
    operator.ge : '>=',
    operator.eq : '=',
    sql.ColumnOperators.distinct_op : 'DISTINCT',
    sql.ColumnOperators.concat_op : '||',
    sql.ColumnOperators.like_op : 'LIKE',
    sql.ColumnOperators.notlike_op : 'NOT LIKE',
    sql.ColumnOperators.ilike_op : 'ILIKE',
{'fraction_non_alphanumeric': 0.19581782739677475, 'fraction_numerical': 0.004961899698741804, 'mean_word_length': 2.914008321775312, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5799284', 'n_tokens_mistral': 1918, 'n_tokens_neox': 1847, 'n_words': 407}