<commit_before>import logging

from ckan.logic import get_action, NotFound

import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit


from ckan.lib.navl.validators import (ignore_missing,
                                      not_empty,
                                      if_empty_same_as,
                                      )
from ckan.logic.validators import (url_validator,
                                   name_validator,
                                   package_name_validator)

from ckan.lib.field_types import DateType, DateConvertError
from ckan.lib.navl.dictization_functions import Invalid

from converters import (convert_to_extras,
                        convert_from_extras)

from validators import (check_empty,
                        valid_email,
                        check_resource_status,
                        valid_date,
                        get_org_sector,
                        check_branch,
                        duplicate_pkg,
                        check_duplicates,
                        check_dashes)

log = logging.getLogger(__name__)

EDC_DATASET_TYPE_VOCAB = u'dataset_type_vocab'



def date_to_db(value, context):
    try:
        value = DateType.form_to_db(value)
    except DateConvertError, e:
        raise Invalid(str(e))
    return value


def date_to_form(value, context):
    try:
        value = DateType.db_to_form(value)
    except DateConvertError, e:
        raise Invalid(str(e))
    return value



def contacts_db_schema():
    schema = {
              'name' : [check_empty, convert_to_extras],
              'organization' : [check_empty, convert_to_extras],
              'branch' : [check_empty, convert_to_extras],
              'email' : [check_empty, valid_email, convert_to_extras],
              'role' : [check_empty, convert_to_extras],
              'private' : [ignore_missing, convert_to_extras],
              'delete' :[ignore_missing, convert_to_extras]
              }
    return schema

def dates_to_db_schema():
    schema = {
              'date' : [check_empty, valid_date, convert_to_extras],
              'type' : [check_empty, convert_to_extras],
              'delete' :[ignore_missing, convert_to_extras],<commit_msg>Removed DateType, DateConvertError from dataset_form<commit_after>import logging

from ckan.logic import get_action, NotFound

import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit


from ckan.lib.navl.validators import (ignore_missing,
                                      not_empty,
                                      if_empty_same_as,
                                      )
from ckan.logic.validators import (url_validator,
                                   name_validator,
                                   package_name_validator)

from converters import (convert_to_extras,
                        convert_from_extras)

from validators import (check_empty,
                        valid_email,
                        check_resource_status,
                        valid_date,
                        get_org_sector,
                        check_branch,
                        duplicate_pkg,
                        check_duplicates,
                        check_dashes)

log = logging.getLogger(__name__)

EDC_DATASET_TYPE_VOCAB = u'dataset_type_vocab'


def contacts_db_schema():
    schema = {
              'name' : [check_empty, convert_to_extras],
              'organization' : [check_empty, convert_to_extras],
              'branch' : [check_empty, convert_to_extras],
              'email' : [check_empty, valid_email, convert_to_extras],
              'role' : [check_empty, convert_to_extras],
              'private' : [ignore_missing, convert_to_extras],
              'delete' :[ignore_missing, convert_to_extras]
              }
    return schema

def dates_to_db_schema():
    schema = {
              'date' : [check_empty, valid_date, convert_to_extras],
              'type' : [check_empty, convert_to_extras],
              'delete' :[ignore_missing, convert_to_extras],
{'fraction_non_alphanumeric': 0.07026627218934911, 'fraction_numerical': 0.0, 'mean_word_length': 1.7191689008042896, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5775633', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1101, 'n_words': 214}