<commit_before>#!/usr/bin/python
# vim: set fileencoding=utf-8

from logging import getLogger
from datetime import datetime

import ckan.model as _model
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
import ckan.logic as logic

from ckan.common import _
from ckan.logic.action.create import user_create as ckan_user_create
from ckan.logic.action.get import package_show as ckan_package_show
from ckan.lib import helpers as h
from ckanext.ceon.config import get_site_url
from ckanext.ceon.converters import convert_to_oa_tags
from ckanext.ceon.lib.doi import get_package_doi, get_resource_doi, create_package_doi, create_resource_doi, publish_package_doi, publish_resource_doi, update_package_doi, update_resource_doi
from ckanext.ceon.lib.metadata import create_authors, get_authors, update_authors, update_oa_tag, get_ancestral_license, get_license_id, get_licenses, update_ancestral_license, update_res_license
from ckanext.ceon.model import create_tables
from ckanext.ceon.model import create_moderation_status, get_moderation_status, get_role, update_moderation_status, get_moderation_notes
from ckan.logic.action.get import package_show as ckan_package_show

log = getLogger(__name__)


def authors(package_id):
    authors = get_authors(_model.Session, package_id)
    return authors

def license_id(resource_id):
    license_id = get_license_id(_model.Session, resource_id)
    if license_id:
        return license_id
    else:
        return None

def license(resource_id):
    id = license_id(resource_id)
    if id:
        try:
            license = _model.license.LicenseRegister()[id]
        except KeyError:
            license = None<commit_msg>After pull request #7<commit_after>#!/usr/bin/python
# vim: set fileencoding=utf-8

from logging import getLogger
from datetime import datetime

import ckan.model as _model
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
import ckan.logic as logic

from ckan.common import _
from ckan.logic.action.create import user_create as ckan_user_create
from ckan.logic.action.get import package_show as ckan_package_show
from ckan.lib import helpers as h
from ckanext.ceon.config import get_site_url
from ckanext.ceon.converters import convert_to_oa_tags
from ckanext.ceon.lib.doi import get_package_doi, get_resource_doi, create_package_doi, create_resource_doi, publish_package_doi, publish_resource_doi, update_package_doi, update_resource_doi
from ckanext.ceon.lib.metadata import create_authors, get_authors, update_authors, update_oa_tag, get_ancestral_license, get_license_id, get_licenses, update_ancestral_license, update_res_license
from ckanext.ceon.model import create_tables
from ckanext.ceon.model import create_moderation_status, get_moderation_status, get_role, update_moderation_status, get_moderation_notes

log = getLogger(__name__)


def authors(package_id):
    authors = get_authors(_model.Session, package_id)
    return authors

def license_id(resource_id):
    license_id = get_license_id(_model.Session, resource_id)
    if license_id:
        return license_id
    else:
        return None

def license(resource_id):
    id = license_id(resource_id)
    if id:
        try:
            license = _model.license.LicenseRegister()[id]
        except KeyError:
            license = None
{'fraction_non_alphanumeric': 0.059214501510574016, 'fraction_numerical': 0.0009063444108761329, 'mean_word_length': 5.2120075046904315, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7519943', 'n_tokens_mistral': 1067, 'n_tokens_neox': 1033, 'n_words': 260}